OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/dbus/chrome_display_power_service_provider_del
egate.h" | 5 #include "chrome/browser/chromeos/dbus/chrome_display_power_service_provider_del
egate.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ui/base/user_activity/user_activity_detector.h" | 8 #include "ui/base/user_activity/user_activity_detector.h" |
9 #include "ui/display/chromeos/display_configurator.h" | 9 #include "ui/display/chromeos/display_configurator.h" |
10 | 10 |
11 namespace chromeos { | 11 namespace chromeos { |
12 | 12 |
13 ChromeDisplayPowerServiceProviderDelegate:: | 13 ChromeDisplayPowerServiceProviderDelegate:: |
14 ChromeDisplayPowerServiceProviderDelegate() { | 14 ChromeDisplayPowerServiceProviderDelegate() { |
15 } | 15 } |
16 | 16 |
17 ChromeDisplayPowerServiceProviderDelegate:: | 17 ChromeDisplayPowerServiceProviderDelegate:: |
18 ~ChromeDisplayPowerServiceProviderDelegate() { | 18 ~ChromeDisplayPowerServiceProviderDelegate() { |
19 } | 19 } |
20 | 20 |
21 void ChromeDisplayPowerServiceProviderDelegate::SetDisplayPower( | 21 void ChromeDisplayPowerServiceProviderDelegate::SetDisplayPower( |
22 DisplayPowerState power_state) { | 22 DisplayPowerState power_state, |
| 23 const ResponseCallback& callback) { |
23 // Turning displays off when the device becomes idle or on just before | 24 // Turning displays off when the device becomes idle or on just before |
24 // we suspend may trigger a mouse move, which would then be incorrectly | 25 // we suspend may trigger a mouse move, which would then be incorrectly |
25 // reported as user activity. Let the UserActivityDetector | 26 // reported as user activity. Let the UserActivityDetector |
26 // know so that it can ignore such events. | 27 // know so that it can ignore such events. |
27 ui::UserActivityDetector::Get()->OnDisplayPowerChanging(); | 28 ui::UserActivityDetector::Get()->OnDisplayPowerChanging(); |
28 | 29 |
29 ash::Shell::GetInstance()->display_configurator()->SetDisplayPower( | 30 ash::Shell::GetInstance()->display_configurator()->SetDisplayPower( |
30 power_state, ui::DisplayConfigurator::kSetDisplayPowerNoFlags); | 31 power_state, ui::DisplayConfigurator::kSetDisplayPowerNoFlags, callback); |
31 } | 32 } |
32 | 33 |
33 void ChromeDisplayPowerServiceProviderDelegate::SetDimming(bool dimmed) { | 34 void ChromeDisplayPowerServiceProviderDelegate::SetDimming(bool dimmed) { |
34 ash::Shell::GetInstance()->SetDimming(dimmed); | 35 ash::Shell::GetInstance()->SetDimming(dimmed); |
35 } | 36 } |
36 | 37 |
37 } // namespace chromeos | 38 } // namespace chromeos |
OLD | NEW |