OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/dbus/power_manager_client.h" | 5 #include "chromeos/dbus/power_manager_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 power_manager_proxy_->CallMethod( | 134 power_manager_proxy_->CallMethod( |
135 &method_call, | 135 &method_call, |
136 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 136 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
137 dbus::ObjectProxy::EmptyResponseCallback()); | 137 dbus::ObjectProxy::EmptyResponseCallback()); |
138 } | 138 } |
139 | 139 |
140 virtual void IncreaseScreenBrightness() OVERRIDE { | 140 virtual void IncreaseScreenBrightness() OVERRIDE { |
141 SimpleMethodCallToPowerManager(power_manager::kIncreaseScreenBrightness); | 141 SimpleMethodCallToPowerManager(power_manager::kIncreaseScreenBrightness); |
142 } | 142 } |
143 | 143 |
| 144 virtual void DecreaseKeyboardBrightness() OVERRIDE { |
| 145 SimpleMethodCallToPowerManager(power_manager::kDecreaseKeyboardBrightness); |
| 146 } |
| 147 |
| 148 virtual void IncreaseKeyboardBrightness() OVERRIDE { |
| 149 SimpleMethodCallToPowerManager(power_manager::kIncreaseKeyboardBrightness); |
| 150 } |
| 151 |
144 virtual void SetScreenBrightnessPercent(double percent, bool gradual) { | 152 virtual void SetScreenBrightnessPercent(double percent, bool gradual) { |
145 dbus::MethodCall method_call( | 153 dbus::MethodCall method_call( |
146 power_manager::kPowerManagerInterface, | 154 power_manager::kPowerManagerInterface, |
147 power_manager::kSetScreenBrightnessPercent); | 155 power_manager::kSetScreenBrightnessPercent); |
148 dbus::MessageWriter writer(&method_call); | 156 dbus::MessageWriter writer(&method_call); |
149 writer.AppendDouble(percent); | 157 writer.AppendDouble(percent); |
150 writer.AppendInt32( | 158 writer.AppendInt32( |
151 gradual ? | 159 gradual ? |
152 power_manager::kBrightnessTransitionGradual : | 160 power_manager::kBrightnessTransitionGradual : |
153 power_manager::kBrightnessTransitionInstant); | 161 power_manager::kBrightnessTransitionInstant); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 VLOG(1) << "Requested to set screen brightness to " << percent << "% " | 560 VLOG(1) << "Requested to set screen brightness to " << percent << "% " |
553 << (gradual ? "gradually" : "instantaneously"); | 561 << (gradual ? "gradually" : "instantaneously"); |
554 SetBrightness(percent, false); | 562 SetBrightness(percent, false); |
555 } | 563 } |
556 | 564 |
557 virtual void GetScreenBrightnessPercent( | 565 virtual void GetScreenBrightnessPercent( |
558 const GetScreenBrightnessPercentCallback& callback) OVERRIDE { | 566 const GetScreenBrightnessPercentCallback& callback) OVERRIDE { |
559 callback.Run(brightness_); | 567 callback.Run(brightness_); |
560 } | 568 } |
561 | 569 |
| 570 virtual void DecreaseKeyboardBrightness() OVERRIDE { |
| 571 VLOG(1) << "Requested to descrease keyboard brightness"; |
| 572 } |
| 573 |
| 574 virtual void IncreaseKeyboardBrightness() OVERRIDE { |
| 575 VLOG(1) << "Requested to increase keyboard brightness"; |
| 576 } |
| 577 |
562 virtual void RequestStatusUpdate(UpdateRequestType update_type) OVERRIDE { | 578 virtual void RequestStatusUpdate(UpdateRequestType update_type) OVERRIDE { |
563 if (update_type == UPDATE_INITIAL) { | 579 if (update_type == UPDATE_INITIAL) { |
564 Update(); | 580 Update(); |
565 return; | 581 return; |
566 } | 582 } |
567 if (!timer_.IsRunning() && update_type == UPDATE_USER) { | 583 if (!timer_.IsRunning() && update_type == UPDATE_USER) { |
568 timer_.Start( | 584 timer_.Start( |
569 FROM_HERE, | 585 FROM_HERE, |
570 base::TimeDelta::FromMilliseconds(1000), | 586 base::TimeDelta::FromMilliseconds(1000), |
571 this, | 587 this, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 PowerManagerClient* PowerManagerClient::Create( | 671 PowerManagerClient* PowerManagerClient::Create( |
656 DBusClientImplementationType type, | 672 DBusClientImplementationType type, |
657 dbus::Bus* bus) { | 673 dbus::Bus* bus) { |
658 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 674 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
659 return new PowerManagerClientImpl(bus); | 675 return new PowerManagerClientImpl(bus); |
660 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 676 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
661 return new PowerManagerClientStubImpl(); | 677 return new PowerManagerClientStubImpl(); |
662 } | 678 } |
663 | 679 |
664 } // namespace chromeos | 680 } // namespace chromeos |
OLD | NEW |