Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: ash/system/chromeos/brightness/brightness_controller_chromeos.cc

Issue 2131733002: mash: Migrate [Keyboard]Brightness code to ash/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h"
6
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"
11
12 namespace ash {
13 namespace system {
14
15 void BrightnessControllerChromeos::HandleBrightnessDown(
16 const ui::Accelerator& accelerator) {
17 if (accelerator.key_code() == ui::VKEY_BRIGHTNESS_DOWN)
18 base::RecordAction(base::UserMetricsAction("Accel_BrightnessDown_F6"));
19
20 chromeos::DBusThreadManager::Get()
21 ->GetPowerManagerClient()
22 ->DecreaseScreenBrightness(true);
23 }
24
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"));
29
30 chromeos::DBusThreadManager::Get()
31 ->GetPowerManagerClient()
32 ->IncreaseScreenBrightness();
33 }
34
35 void BrightnessControllerChromeos::SetBrightnessPercent(double percent,
36 bool gradual) {
37 chromeos::DBusThreadManager::Get()
38 ->GetPowerManagerClient()
39 ->SetScreenBrightnessPercent(percent, gradual);
40 }
41
42 void BrightnessControllerChromeos::GetBrightnessPercent(
43 const base::Callback<void(double)>& callback) {
44 chromeos::DBusThreadManager::Get()
45 ->GetPowerManagerClient()
46 ->GetScreenBrightnessPercent(callback);
47 }
48
49 } // namespace system
50 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698