OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/display_power_service_provider.h" | 5 #include "chrome/browser/chromeos/dbus/display_power_service_provider.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/user_activity_detector.h" | 8 #include "ash/wm/user_activity_detector.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "chromeos/display/output_configurator.h" | 10 #include "chromeos/display/output_configurator.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 if (reader.PopInt32(&int_state)) { | 55 if (reader.PopInt32(&int_state)) { |
56 // Turning displays off when the device becomes idle or on just before | 56 // Turning displays off when the device becomes idle or on just before |
57 // we suspend may trigger a mouse move, which would then be incorrectly | 57 // we suspend may trigger a mouse move, which would then be incorrectly |
58 // reported as user activity. Let the UserActivityDetector | 58 // reported as user activity. Let the UserActivityDetector |
59 // know so that it can ignore such events. | 59 // know so that it can ignore such events. |
60 ash::Shell::GetInstance()->user_activity_detector()-> | 60 ash::Shell::GetInstance()->user_activity_detector()-> |
61 OnDisplayPowerChanging(); | 61 OnDisplayPowerChanging(); |
62 | 62 |
63 DisplayPowerState state = static_cast<DisplayPowerState>(int_state); | 63 DisplayPowerState state = static_cast<DisplayPowerState>(int_state); |
64 ash::Shell::GetInstance()->output_configurator()->SetDisplayPower( | 64 ash::Shell::GetInstance()->output_configurator()->SetDisplayPower( |
65 state, false); | 65 state, OutputConfigurator::kSetDisplayPowerNoFlags); |
66 } else { | 66 } else { |
67 LOG(ERROR) << "Unable to parse " << kSetDisplayPower << " request"; | 67 LOG(ERROR) << "Unable to parse " << kSetDisplayPower << " request"; |
68 } | 68 } |
69 | 69 |
70 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 70 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
71 } | 71 } |
72 | 72 |
73 void DisplayPowerServiceProvider::SetDisplaySoftwareDimming( | 73 void DisplayPowerServiceProvider::SetDisplaySoftwareDimming( |
74 dbus::MethodCall* method_call, | 74 dbus::MethodCall* method_call, |
75 dbus::ExportedObject::ResponseSender response_sender) { | 75 dbus::ExportedObject::ResponseSender response_sender) { |
76 dbus::MessageReader reader(method_call); | 76 dbus::MessageReader reader(method_call); |
77 bool dimmed = false; | 77 bool dimmed = false; |
78 if (reader.PopBool(&dimmed)) { | 78 if (reader.PopBool(&dimmed)) { |
79 ash::Shell::GetInstance()->SetDimming(dimmed); | 79 ash::Shell::GetInstance()->SetDimming(dimmed); |
80 } else { | 80 } else { |
81 LOG(ERROR) << "Unable to parse " << kSetDisplaySoftwareDimming | 81 LOG(ERROR) << "Unable to parse " << kSetDisplaySoftwareDimming |
82 << " request"; | 82 << " request"; |
83 } | 83 } |
84 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 84 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
85 } | 85 } |
86 | 86 |
87 } // namespace chromeos | 87 } // namespace chromeos |
OLD | NEW |