| 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 "chrome/browser/chromeos/cros/power_library.h" | 9 #include "chrome/browser/chromeos/cros/power_library.h" |
| 10 #include "chrome/browser/chromeos/status/status_area_button.h" | 10 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 11 #include "ui/base/models/menu_model.h" | 11 #include "ui/base/models/menu_model.h" |
| 12 #include "views/controls/menu/menu_2.h" | 12 #include "views/controls/menu/menu_2.h" |
| 13 #include "views/controls/menu/view_menu_delegate.h" | 13 #include "views/controls/menu/view_menu_delegate.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class TimeDelta; | 16 class TimeDelta; |
| 17 } | 17 } |
| 18 | 18 |
| 19 class SkBitmap; | 19 class SkBitmap; |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 // The power menu button in the status area. | 23 // The power menu button in the status area. |
| 24 // This class will handle getting the power status and populating the menu. | 24 // This class will handle getting the power status and populating the menu. |
| 25 class PowerMenuButton : public StatusAreaButton, | 25 class PowerMenuButton : public StatusAreaButton, |
| 26 public views::ViewMenuDelegate, | 26 public views::ViewMenuDelegate, |
| 27 public ui::MenuModel, | 27 public ui::MenuModel, |
| 28 public PowerLibrary::Observer { | 28 public PowerLibrary::Observer { |
| 29 public: | 29 public: |
| 30 PowerMenuButton(); | 30 PowerMenuButton(StatusAreaHost* host); |
| 31 virtual ~PowerMenuButton(); | 31 virtual ~PowerMenuButton(); |
| 32 | 32 |
| 33 // ui::MenuModel implementation. | 33 // ui::MenuModel implementation. |
| 34 virtual bool HasIcons() const { return false; } | 34 virtual bool HasIcons() const { return false; } |
| 35 virtual int GetItemCount() const; | 35 virtual int GetItemCount() const; |
| 36 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; | 36 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; |
| 37 virtual int GetCommandIdAt(int index) const { return index; } | 37 virtual int GetCommandIdAt(int index) const { return index; } |
| 38 virtual string16 GetLabelAt(int index) const; | 38 virtual string16 GetLabelAt(int index) const; |
| 39 virtual bool IsItemDynamicAt(int index) const { return true; } | 39 virtual bool IsItemDynamicAt(int index) const { return true; } |
| 40 virtual bool GetAcceleratorAt(int index, | 40 virtual bool GetAcceleratorAt(int index, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // The power menu. This needs to be initialized last since it calls into | 88 // The power menu. This needs to be initialized last since it calls into |
| 89 // GetLabelAt() during construction. | 89 // GetLabelAt() during construction. |
| 90 views::Menu2 power_menu_; | 90 views::Menu2 power_menu_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); | 92 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace chromeos | 95 } // namespace chromeos |
| 96 | 96 |
| 97 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ | 97 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |
| OLD | NEW |