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

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

Issue 8491054: Request power status update from power manager when power button view gets created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit in a comment Created 9 years, 1 month 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 | « no previous file | chrome/browser/chromeos/status/power_menu_button.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/power_manager_client.h" 5 #include "chrome/browser/chromeos/dbus/power_manager_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 !reader.PopInt64(&status.battery_seconds_to_empty) || 201 !reader.PopInt64(&status.battery_seconds_to_empty) ||
202 !reader.PopInt64(&status.battery_seconds_to_full) || 202 !reader.PopInt64(&status.battery_seconds_to_full) ||
203 !reader.PopDouble(&status.battery_percentage) || 203 !reader.PopDouble(&status.battery_percentage) ||
204 !reader.PopBool(&status.battery_is_present) || 204 !reader.PopBool(&status.battery_is_present) ||
205 !reader.PopBool(&status.battery_is_full)) { 205 !reader.PopBool(&status.battery_is_full)) {
206 LOG(ERROR) << "Error reading response from powerd: " 206 LOG(ERROR) << "Error reading response from powerd: "
207 << response->ToString(); 207 << response->ToString();
208 return; 208 return;
209 } 209 }
210 210
211 // This is a temp hack that will be removed in few days.
satorux1 2011/11/11 21:00:22 Please start the comment with // TODO(tbarzic): I
tbarzic 2011/11/11 21:09:33 OK
212 // Right now power manager sets line_power_on to true if neither line_power
213 // nor battery system path can't be found. I'm changing that so we can
214 // detect that device doesn't have battery (e.g. Newton). This is to ensure
215 // nothing gets broken until real Chrome side patch lands.
216 status.line_power_on |= !status.battery_is_present;
217
211 VLOG(1) << "Power status: " << status.ToString(); 218 VLOG(1) << "Power status: " << status.ToString();
212 FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(status)); 219 FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(status));
213 } 220 }
214 221
215 dbus::ObjectProxy* power_manager_proxy_; 222 dbus::ObjectProxy* power_manager_proxy_;
216 ObserverList<Observer> observers_; 223 ObserverList<Observer> observers_;
217 base::WeakPtrFactory<PowerManagerClientImpl> weak_ptr_factory_; 224 base::WeakPtrFactory<PowerManagerClientImpl> weak_ptr_factory_;
218 225
219 DISALLOW_COPY_AND_ASSIGN(PowerManagerClientImpl); 226 DISALLOW_COPY_AND_ASSIGN(PowerManagerClientImpl);
220 }; 227 };
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 316
310 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) { 317 PowerManagerClient* PowerManagerClient::Create(dbus::Bus* bus) {
311 if (system::runtime_environment::IsRunningOnChromeOS()) { 318 if (system::runtime_environment::IsRunningOnChromeOS()) {
312 return new PowerManagerClientImpl(bus); 319 return new PowerManagerClientImpl(bus);
313 } else { 320 } else {
314 return new PowerManagerClientStubImpl(); 321 return new PowerManagerClientStubImpl();
315 } 322 }
316 } 323 }
317 324
318 } // namespace chromeos 325 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/status/power_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698