| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 #include "app/menus/menu_model.h" | 8 #include "app/menus/menu_model.h" |
| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } | 39 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } |
| 40 virtual bool IsEnabledAt(int index) const { return false; } | 40 virtual bool IsEnabledAt(int index) const { return false; } |
| 41 virtual menus::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } | 41 virtual menus::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } |
| 42 virtual void HighlightChangedTo(int index) {} | 42 virtual void HighlightChangedTo(int index) {} |
| 43 virtual void ActivatedAt(int index) {} | 43 virtual void ActivatedAt(int index) {} |
| 44 virtual void MenuWillShow() {} | 44 virtual void MenuWillShow() {} |
| 45 | 45 |
| 46 // PowerLibrary::Observer implementation. | 46 // PowerLibrary::Observer implementation. |
| 47 virtual void PowerChanged(PowerLibrary* obj); | 47 virtual void PowerChanged(PowerLibrary* obj); |
| 48 | 48 |
| 49 const int icon_id() const { return icon_id_; } |
| 50 |
| 49 protected: | 51 protected: |
| 50 // StatusAreaButton implementation. | 52 // StatusAreaButton implementation. |
| 51 virtual void DrawPressed(gfx::Canvas* canvas); | 53 virtual void DrawPressed(gfx::Canvas* canvas); |
| 52 virtual void DrawIcon(gfx::Canvas* canvas); | 54 virtual void DrawIcon(gfx::Canvas* canvas); |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 // views::ViewMenuDelegate implementation. | 57 // views::ViewMenuDelegate implementation. |
| 56 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 58 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| 57 | 59 |
| 58 // This method will draw the |icon| in the appropriate place on the |canvas|. | 60 // This method will draw the |icon| in the appropriate place on the |canvas|. |
| 59 void DrawPowerIcon(gfx::Canvas* canvas, SkBitmap icon); | 61 void DrawPowerIcon(gfx::Canvas* canvas, SkBitmap icon); |
| 60 | 62 |
| 61 // Update the power icon depending on the power status. | 63 // Update the power icon depending on the power status. |
| 62 void UpdateIcon(); | 64 void UpdateIcon(); |
| 63 | 65 |
| 64 // The number of power images. | 66 // The number of power images. |
| 65 static const int kNumPowerImages; | 67 static const int kNumPowerImages; |
| 66 | 68 |
| 67 // The power menu. | 69 // The power menu. |
| 68 views::Menu2 power_menu_; | 70 views::Menu2 power_menu_; |
| 69 | 71 |
| 72 // The currently showing icon bitmap id. |
| 73 int icon_id_; |
| 74 |
| 70 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); | 75 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 } // namespace chromeos | 78 } // namespace chromeos |
| 74 | 79 |
| 75 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ | 80 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |
| OLD | NEW |