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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/dbus/chrome_display_power_service_provider_delegate.h"
8 #include "ui/base/user_activity/user_activity_detector.h"
9 #include "ui/display/chromeos/display_configurator.h"
13 ChromeDisplayPowerServiceProviderDelegate::
14 ChromeDisplayPowerServiceProviderDelegate() {
17 ChromeDisplayPowerServiceProviderDelegate::
18 ~ChromeDisplayPowerServiceProviderDelegate() {
21 void ChromeDisplayPowerServiceProviderDelegate::SetDisplayPower(
22 DisplayPowerState power_state
,
23 const ResponseCallback
& callback
) {
24 // Turning displays off when the device becomes idle or on just before
25 // we suspend may trigger a mouse move, which would then be incorrectly
26 // reported as user activity. Let the UserActivityDetector
27 // know so that it can ignore such events.
28 ui::UserActivityDetector::Get()->OnDisplayPowerChanging();
30 ash::Shell::GetInstance()->display_configurator()->SetDisplayPower(
31 power_state
, ui::DisplayConfigurator::kSetDisplayPowerNoFlags
, callback
);
34 void ChromeDisplayPowerServiceProviderDelegate::SetDimming(bool dimmed
) {
35 ash::Shell::GetInstance()->SetDimming(dimmed
);
38 } // namespace chromeos