Elim cr-checkbox
[chromium-blink-merge.git] / ash / system / chromeos / brightness / brightness_controller_chromeos.cc
blobd8accce73ac0f04e7f552855b79e55b6ae4294a6
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h"
7 #include "base/metrics/user_metrics.h"
8 #include "chromeos/dbus/dbus_thread_manager.h"
9 #include "chromeos/dbus/power_manager_client.h"
10 #include "ui/base/accelerators/accelerator.h"
12 namespace ash {
13 namespace system {
15 void BrightnessControllerChromeos::HandleBrightnessDown(
16 const ui::Accelerator& accelerator) {
17 if (accelerator.key_code() == ui::VKEY_BRIGHTNESS_DOWN)
18 base::RecordAction(
19 base::UserMetricsAction("Accel_BrightnessDown_F6"));
21 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
22 DecreaseScreenBrightness(true);
25 void BrightnessControllerChromeos::HandleBrightnessUp(
26 const ui::Accelerator& accelerator) {
27 if (accelerator.key_code() == ui::VKEY_BRIGHTNESS_UP)
28 base::RecordAction(base::UserMetricsAction("Accel_BrightnessUp_F7"));
30 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
31 IncreaseScreenBrightness();
34 void BrightnessControllerChromeos::SetBrightnessPercent(double percent,
35 bool gradual) {
36 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
37 SetScreenBrightnessPercent(percent, gradual);
40 void BrightnessControllerChromeos::GetBrightnessPercent(
41 const base::Callback<void(double)>& callback) {
42 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
43 GetScreenBrightnessPercent(callback);
46 } // namespace system
47 } // namespace ash