| 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" | |
| 11 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
| 12 #include "dbus/message.h" | 11 #include "dbus/message.h" |
| 13 #include "third_party/cros_system_api/dbus/service_constants.h" | 12 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 13 #include "ui/display/chromeos/output_configurator.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 DisplayPowerServiceProvider::DisplayPowerServiceProvider() | 17 DisplayPowerServiceProvider::DisplayPowerServiceProvider() |
| 18 : weak_ptr_factory_(this) { | 18 : weak_ptr_factory_(this) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 DisplayPowerServiceProvider::~DisplayPowerServiceProvider() {} | 21 DisplayPowerServiceProvider::~DisplayPowerServiceProvider() {} |
| 22 | 22 |
| 23 void DisplayPowerServiceProvider::Start( | 23 void DisplayPowerServiceProvider::Start( |
| (...skipping 31 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, OutputConfigurator::kSetDisplayPowerNoFlags); | 65 state, ui::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 |