OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |