| 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 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 10 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 10 #include "chrome/browser/chromeos/status/status_area_button.h" | 11 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 11 #include "views/controls/menu/menu_delegate.h" | 12 #include "views/controls/menu/menu_delegate.h" |
| 12 #include "views/controls/menu/view_menu_delegate.h" | 13 #include "views/controls/menu/view_menu_delegate.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class TimeDelta; | 16 class TimeDelta; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace views { | 19 namespace views { |
| 19 class MenuRunner; | 20 class MenuRunner; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 | 24 |
| 24 class StatusAreaBubbleContentView; | 25 class StatusAreaBubbleContentView; |
| 25 | 26 |
| 26 // The power menu button in the status area. | 27 // The power menu button in the status area. |
| 27 // This class will handle getting the power status and populating the menu. | 28 // This class will handle getting the power status and populating the menu. |
| 28 class PowerMenuButton : public StatusAreaButton, | 29 class PowerMenuButton : public StatusAreaButton, |
| 29 public views::MenuDelegate, | 30 public views::MenuDelegate, |
| 30 public views::ViewMenuDelegate, | 31 public views::ViewMenuDelegate, |
| 31 public PowerManagerClient::Observer { | 32 public PowerManagerClient::Observer { |
| 32 public: | 33 public: |
| 33 explicit PowerMenuButton(StatusAreaButton::Delegate* delegate); | 34 explicit PowerMenuButton(StatusAreaButton::Delegate* delegate); |
| 34 virtual ~PowerMenuButton(); | 35 virtual ~PowerMenuButton(); |
| 35 | 36 |
| 36 // views::MenuDelegate implementation. | 37 // views::MenuDelegate implementation. |
| 37 virtual string16 GetLabel(int id) const; | 38 virtual string16 GetLabel(int id) const OVERRIDE; |
| 38 | 39 |
| 39 // PowerLibrary::Observer implementation. | 40 // PowerLibrary::Observer implementation. |
| 40 virtual void PowerChanged(const PowerSupplyStatus& power_status); | 41 virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE; |
| 41 virtual void SystemResumed() {} | 42 virtual void SystemResumed() {} |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 virtual int icon_width(); | 45 virtual int icon_width() OVERRIDE; |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 // views::View | 48 // views::View |
| 48 virtual void OnLocaleChanged() OVERRIDE; | 49 virtual void OnLocaleChanged() OVERRIDE; |
| 49 | 50 |
| 50 // views::ViewMenuDelegate implementation. | 51 // views::ViewMenuDelegate implementation. |
| 51 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 52 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; |
| 52 | 53 |
| 53 // Format strings with power status | 54 // Format strings with power status |
| 54 string16 GetBatteryIsChargedText() const; | 55 string16 GetBatteryIsChargedText() const; |
| 55 | 56 |
| 56 // Update the power icon and menu label info depending on the power status. | 57 // Update the power icon and menu label info depending on the power status. |
| 57 void UpdateIconAndLabelInfo(); | 58 void UpdateIconAndLabelInfo(); |
| 58 | 59 |
| 59 // Update status view | 60 // Update status view |
| 60 void UpdateStatusView(); | 61 void UpdateStatusView(); |
| 61 | 62 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 79 | 80 |
| 80 // If non-null the menu is showing. | 81 // If non-null the menu is showing. |
| 81 scoped_ptr<views::MenuRunner> menu_runner_; | 82 scoped_ptr<views::MenuRunner> menu_runner_; |
| 82 | 83 |
| 83 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); | 84 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 } // namespace chromeos | 87 } // namespace chromeos |
| 87 | 88 |
| 88 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ | 89 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |
| OLD | NEW |