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

Side by Side Diff: chromeos/dbus/power_manager_client.cc

Issue 2805433002: Adding ArcBridge interface for synchronizing brightness settings (Closed)
Patch Set: Clean things up Created 3 years, 8 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
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 dbus::MethodCall method_call( 179 dbus::MethodCall method_call(
180 power_manager::kPowerManagerInterface, 180 power_manager::kPowerManagerInterface,
181 power_manager::kGetScreenBrightnessPercentMethod); 181 power_manager::kGetScreenBrightnessPercentMethod);
182 power_manager_proxy_->CallMethod( 182 power_manager_proxy_->CallMethod(
183 &method_call, 183 &method_call,
184 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 184 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
185 base::Bind(&PowerManagerClientImpl::OnGetScreenBrightnessPercent, 185 base::Bind(&PowerManagerClientImpl::OnGetScreenBrightnessPercent,
186 weak_ptr_factory_.GetWeakPtr(), callback)); 186 weak_ptr_factory_.GetWeakPtr(), callback));
187 } 187 }
188 188
189 void SyncScreenBrightness() override {
190 GetScreenBrightnessPercent(
191 base::Bind(&PowerManagerClientImpl::NotifyBrightnessChanges,
192 weak_ptr_factory_.GetWeakPtr()));
193 }
Daniel Erat 2017/04/05 21:47:21 adding a new method isn't the right way to do this
yueli 2017/04/05 23:27:17 Done.
194
195 void NotifyBrightnessChanges(double percent) {
196 for (auto& observer : observers_)
197 observer.BrightnessChanged(static_cast<int>(percent), false);
198 }
199
189 void RequestStatusUpdate() override { 200 void RequestStatusUpdate() override {
190 POWER_LOG(USER) << "RequestStatusUpdate"; 201 POWER_LOG(USER) << "RequestStatusUpdate";
191 dbus::MethodCall method_call( 202 dbus::MethodCall method_call(
192 power_manager::kPowerManagerInterface, 203 power_manager::kPowerManagerInterface,
193 power_manager::kGetPowerSupplyPropertiesMethod); 204 power_manager::kGetPowerSupplyPropertiesMethod);
194 power_manager_proxy_->CallMethod( 205 power_manager_proxy_->CallMethod(
195 &method_call, 206 &method_call,
196 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 207 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
197 base::Bind(&PowerManagerClientImpl::OnGetPowerSupplyPropertiesMethod, 208 base::Bind(&PowerManagerClientImpl::OnGetPowerSupplyPropertiesMethod,
198 weak_ptr_factory_.GetWeakPtr())); 209 weak_ptr_factory_.GetWeakPtr()));
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 // static 954 // static
944 PowerManagerClient* PowerManagerClient::Create( 955 PowerManagerClient* PowerManagerClient::Create(
945 DBusClientImplementationType type) { 956 DBusClientImplementationType type) {
946 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 957 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
947 return new PowerManagerClientImpl(); 958 return new PowerManagerClientImpl();
948 DCHECK_EQ(FAKE_DBUS_CLIENT_IMPLEMENTATION, type); 959 DCHECK_EQ(FAKE_DBUS_CLIENT_IMPLEMENTATION, type);
949 return new FakePowerManagerClient(); 960 return new FakePowerManagerClient();
950 } 961 }
951 962
952 } // namespace chromeos 963 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698