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 "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/dbus/power_manager_client.h"
9 #include "content/public/browser/user_metrics.h"
10 #include "ui/base/accelerators/accelerator.h"
15 bool BrightnessControllerChromeos::HandleBrightnessDown(
16 const ui::Accelerator& accelerator) {
17 if (accelerator.key_code() == ui::VKEY_BRIGHTNESS_DOWN)
18 content::RecordAction(
19 content::UserMetricsAction("Accel_BrightnessDown_F6"));
21 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
22 DecreaseScreenBrightness(true);
26 bool BrightnessControllerChromeos::HandleBrightnessUp(
27 const ui::Accelerator& accelerator) {
28 if (accelerator.key_code() == ui::VKEY_BRIGHTNESS_UP)
29 content::RecordAction(content::UserMetricsAction("Accel_BrightnessUp_F7"));
31 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
32 IncreaseScreenBrightness();
36 void BrightnessControllerChromeos::SetBrightnessPercent(double percent,
38 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
39 SetScreenBrightnessPercent(percent, gradual);
42 void BrightnessControllerChromeos::GetBrightnessPercent(
43 const base::Callback<void(double)>& callback) {
44 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
45 GetScreenBrightnessPercent(callback);