Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: chrome/browser/chromeos/dbus/display_power_service_provider.cc

Issue 12770015: chromeos: Export SetDisplaySoftwareDimming D-Bus method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/dbus/display_power_service_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 22
23 void DisplayPowerServiceProvider::Start( 23 void DisplayPowerServiceProvider::Start(
24 scoped_refptr<dbus::ExportedObject> exported_object) { 24 scoped_refptr<dbus::ExportedObject> exported_object) {
25 exported_object->ExportMethod( 25 exported_object->ExportMethod(
26 kLibCrosServiceInterface, 26 kLibCrosServiceInterface,
27 kSetDisplayPower, 27 kSetDisplayPower,
28 base::Bind(&DisplayPowerServiceProvider::SetDisplayPower, 28 base::Bind(&DisplayPowerServiceProvider::SetDisplayPower,
29 weak_ptr_factory_.GetWeakPtr()), 29 weak_ptr_factory_.GetWeakPtr()),
30 base::Bind(&DisplayPowerServiceProvider::OnExported, 30 base::Bind(&DisplayPowerServiceProvider::OnExported,
31 weak_ptr_factory_.GetWeakPtr())); 31 weak_ptr_factory_.GetWeakPtr()));
32 exported_object->ExportMethod(
33 kLibCrosServiceInterface,
34 kSetDisplaySoftwareDimming,
35 base::Bind(&DisplayPowerServiceProvider::SetDisplaySoftwareDimming,
36 weak_ptr_factory_.GetWeakPtr()),
37 base::Bind(&DisplayPowerServiceProvider::OnExported,
38 weak_ptr_factory_.GetWeakPtr()));
32 } 39 }
33 40
34 void DisplayPowerServiceProvider::OnExported(const std::string& interface_name, 41 void DisplayPowerServiceProvider::OnExported(const std::string& interface_name,
35 const std::string& method_name, 42 const std::string& method_name,
36 bool success) { 43 bool success) {
37 if (!success) { 44 if (!success) {
38 LOG(ERROR) << "Failed to export " << interface_name << "." 45 LOG(ERROR) << "Failed to export " << interface_name << "."
39 << method_name; 46 << method_name;
40 } 47 }
41 } 48 }
(...skipping 14 matching lines...) Expand all
56 DisplayPowerState state = static_cast<DisplayPowerState>(int_state); 63 DisplayPowerState state = static_cast<DisplayPowerState>(int_state);
57 ash::Shell::GetInstance()->output_configurator()->SetDisplayPower( 64 ash::Shell::GetInstance()->output_configurator()->SetDisplayPower(
58 state, false); 65 state, false);
59 } else { 66 } else {
60 LOG(ERROR) << "Unable to parse " << kSetDisplayPower << " request"; 67 LOG(ERROR) << "Unable to parse " << kSetDisplayPower << " request";
61 } 68 }
62 69
63 response_sender.Run(dbus::Response::FromMethodCall(method_call)); 70 response_sender.Run(dbus::Response::FromMethodCall(method_call));
64 } 71 }
65 72
73 void DisplayPowerServiceProvider::SetDisplaySoftwareDimming(
74 dbus::MethodCall* method_call,
75 dbus::ExportedObject::ResponseSender response_sender) {
76 dbus::MessageReader reader(method_call);
77 bool dimmed = false;
78 if (reader.PopBool(&dimmed)) {
79 ash::Shell::GetInstance()->SetDimming(dimmed);
80 } else {
81 LOG(ERROR) << "Unable to parse " << kSetDisplaySoftwareDimming
82 << " request";
83 }
84 response_sender.Run(dbus::Response::FromMethodCall(method_call));
85 }
86
66 } // namespace chromeos 87 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/dbus/display_power_service_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698