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(); | |
221 } | 220 } |
222 | 221 |
223 PowerMenuButton::~PowerMenuButton() { | 222 PowerMenuButton::~PowerMenuButton() { |
224 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 223 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
225 } | 224 } |
226 | 225 |
227 // PowerMenuButton, views::MenuDelegate implementation: | 226 // PowerMenuButton, views::MenuDelegate implementation: |
228 | 227 |
229 string16 PowerMenuButton::GetLabel(int id) const { | 228 string16 PowerMenuButton::GetLabel(int id) const { |
230 return string16(); | 229 return string16(); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // If previous is 0, then it either was never set (initial condition) | 380 // If previous is 0, then it either was never set (initial condition) |
382 // or got down to 0. | 381 // or got down to 0. |
383 if (*previous == TimeDelta::FromMicroseconds(kInitialMS) || | 382 if (*previous == TimeDelta::FromMicroseconds(kInitialMS) || |
384 diff < kMinDiff || | 383 diff < kMinDiff || |
385 diff > kMaxDiff) { | 384 diff > kMaxDiff) { |
386 *previous = current; | 385 *previous = current; |
387 } | 386 } |
388 } | 387 } |
389 | 388 |
390 } // namespace chromeos | 389 } // namespace chromeos |
OLD | NEW |