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 "base/bind.h" | 8 #include "base/bind.h" |
9 #include "dbus/bus.h" | 9 #include "dbus/bus.h" |
10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void DisplayPowerServiceProvider::SetDisplayPower( | 50 void DisplayPowerServiceProvider::SetDisplayPower( |
51 dbus::MethodCall* method_call, | 51 dbus::MethodCall* method_call, |
52 dbus::ExportedObject::ResponseSender response_sender) { | 52 dbus::ExportedObject::ResponseSender response_sender) { |
53 dbus::MessageReader reader(method_call); | 53 dbus::MessageReader reader(method_call); |
54 int int_state = 0; | 54 int int_state = 0; |
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 wm::UserActivityDetector::Get()->OnDisplayPowerChanging(); |
61 OnDisplayPowerChanging(); | |
62 | 61 |
63 DisplayPowerState state = static_cast<DisplayPowerState>(int_state); | 62 DisplayPowerState state = static_cast<DisplayPowerState>(int_state); |
64 ash::Shell::GetInstance()->display_configurator()->SetDisplayPower( | 63 ash::Shell::GetInstance()->display_configurator()->SetDisplayPower( |
65 state, ui::DisplayConfigurator::kSetDisplayPowerNoFlags); | 64 state, ui::DisplayConfigurator::kSetDisplayPowerNoFlags); |
66 } else { | 65 } else { |
67 LOG(ERROR) << "Unable to parse " << kSetDisplayPower << " request"; | 66 LOG(ERROR) << "Unable to parse " << kSetDisplayPower << " request"; |
68 } | 67 } |
69 | 68 |
70 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 69 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
71 } | 70 } |
72 | 71 |
73 void DisplayPowerServiceProvider::SetDisplaySoftwareDimming( | 72 void DisplayPowerServiceProvider::SetDisplaySoftwareDimming( |
74 dbus::MethodCall* method_call, | 73 dbus::MethodCall* method_call, |
75 dbus::ExportedObject::ResponseSender response_sender) { | 74 dbus::ExportedObject::ResponseSender response_sender) { |
76 dbus::MessageReader reader(method_call); | 75 dbus::MessageReader reader(method_call); |
77 bool dimmed = false; | 76 bool dimmed = false; |
78 if (reader.PopBool(&dimmed)) { | 77 if (reader.PopBool(&dimmed)) { |
79 ash::Shell::GetInstance()->SetDimming(dimmed); | 78 ash::Shell::GetInstance()->SetDimming(dimmed); |
80 } else { | 79 } else { |
81 LOG(ERROR) << "Unable to parse " << kSetDisplaySoftwareDimming | 80 LOG(ERROR) << "Unable to parse " << kSetDisplaySoftwareDimming |
82 << " request"; | 81 << " request"; |
83 } | 82 } |
84 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 83 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
85 } | 84 } |
86 | 85 |
87 } // namespace chromeos | 86 } // namespace chromeos |
OLD | NEW |