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

Side by Side Diff: chrome/browser/chromeos/status/power_menu_button.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: remove power_manager_client.cc part 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 | 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) 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/status/power_menu_button.h" 5 #include "chrome/browser/chromeos/status/power_menu_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 : StatusAreaButton(delegate, this), 210 : StatusAreaButton(delegate, this),
211 battery_is_present_(false), 211 battery_is_present_(false),
212 line_power_on_(false), 212 line_power_on_(false),
213 battery_percentage_(0.0), 213 battery_percentage_(0.0),
214 battery_time_to_full_(TimeDelta::FromMicroseconds(kInitialMS)), 214 battery_time_to_full_(TimeDelta::FromMicroseconds(kInitialMS)),
215 battery_time_to_empty_(TimeDelta::FromMicroseconds(kInitialMS)), 215 battery_time_to_empty_(TimeDelta::FromMicroseconds(kInitialMS)),
216 status_(NULL) { 216 status_(NULL) {
217 set_id(VIEW_ID_STATUS_BUTTON_POWER); 217 set_id(VIEW_ID_STATUS_BUTTON_POWER);
218 UpdateIconAndLabelInfo(); 218 UpdateIconAndLabelInfo();
219 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); 219 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
220 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate();
220 } 221 }
221 222
222 PowerMenuButton::~PowerMenuButton() { 223 PowerMenuButton::~PowerMenuButton() {
223 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); 224 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
224 } 225 }
225 226
226 // PowerMenuButton, views::MenuDelegate implementation: 227 // PowerMenuButton, views::MenuDelegate implementation:
227 228
228 string16 PowerMenuButton::GetLabel(int id) const { 229 string16 PowerMenuButton::GetLabel(int id) const {
229 return string16(); 230 return string16();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // If previous is 0, then it either was never set (initial condition) 381 // If previous is 0, then it either was never set (initial condition)
381 // or got down to 0. 382 // or got down to 0.
382 if (*previous == TimeDelta::FromMicroseconds(kInitialMS) || 383 if (*previous == TimeDelta::FromMicroseconds(kInitialMS) ||
383 diff < kMinDiff || 384 diff < kMinDiff ||
384 diff > kMaxDiff) { 385 diff > kMaxDiff) {
385 *previous = current; 386 *previous = current;
386 } 387 }
387 } 388 }
388 389
389 } // namespace chromeos 390 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698