OLD | NEW |
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 "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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 return 26; | 258 return 26; |
259 } | 259 } |
260 | 260 |
261 //////////////////////////////////////////////////////////////////////////////// | 261 //////////////////////////////////////////////////////////////////////////////// |
262 // PowerMenuButton, views::View implementation: | 262 // PowerMenuButton, views::View implementation: |
263 void PowerMenuButton::OnLocaleChanged() { | 263 void PowerMenuButton::OnLocaleChanged() { |
264 UpdateIconAndLabelInfo(); | 264 UpdateIconAndLabelInfo(); |
265 } | 265 } |
266 | 266 |
267 //////////////////////////////////////////////////////////////////////////////// | 267 //////////////////////////////////////////////////////////////////////////////// |
268 // PowerMenuButton, views::MenuButtonDelegate implementation: | 268 // PowerMenuButton, views::MenuButtonListener implementation: |
269 | 269 |
270 void PowerMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | 270 void PowerMenuButton::OnMenuButtonClicked(views::View* source, |
| 271 const gfx::Point& point) { |
271 // Explicitly query the power status. | 272 // Explicitly query the power status. |
272 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate( | 273 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate( |
273 PowerManagerClient::UPDATE_USER); | 274 PowerManagerClient::UPDATE_USER); |
274 | 275 |
275 views::MenuItemView* menu = new views::MenuItemView(this); | 276 views::MenuItemView* menu = new views::MenuItemView(this); |
276 // MenuRunner takes ownership of |menu|. | 277 // MenuRunner takes ownership of |menu|. |
277 menu_runner_.reset(new views::MenuRunner(menu)); | 278 menu_runner_.reset(new views::MenuRunner(menu)); |
278 views::MenuItemView* submenu = menu->AppendMenuItem( | 279 views::MenuItemView* submenu = menu->AppendMenuItem( |
279 POWER_BATTERY_PERCENTAGE_ITEM, | 280 POWER_BATTERY_PERCENTAGE_ITEM, |
280 string16(), | 281 string16(), |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 // If previous is 0, then it either was never set (initial condition) | 375 // If previous is 0, then it either was never set (initial condition) |
375 // or got down to 0. | 376 // or got down to 0. |
376 if (*previous == TimeDelta::FromMicroseconds(kInitialMS) || | 377 if (*previous == TimeDelta::FromMicroseconds(kInitialMS) || |
377 diff < kMinDiff || | 378 diff < kMinDiff || |
378 diff > kMaxDiff) { | 379 diff > kMaxDiff) { |
379 *previous = current; | 380 *previous = current; |
380 } | 381 } |
381 } | 382 } |
382 | 383 |
383 } // namespace chromeos | 384 } // namespace chromeos |
OLD | NEW |