| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "app/menus/menu_model.h" | 9 #include "app/menus/menu_model.h" |
| 10 #include "chrome/browser/chromeos/cros/power_library.h" | 10 #include "chrome/browser/chromeos/cros/power_library.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 virtual void HighlightChangedTo(int index) {} | 50 virtual void HighlightChangedTo(int index) {} |
| 51 virtual void ActivatedAt(int index) {} | 51 virtual void ActivatedAt(int index) {} |
| 52 virtual void MenuWillShow() {} | 52 virtual void MenuWillShow() {} |
| 53 | 53 |
| 54 // PowerLibrary::Observer implementation. | 54 // PowerLibrary::Observer implementation. |
| 55 virtual void PowerChanged(PowerLibrary* obj); | 55 virtual void PowerChanged(PowerLibrary* obj); |
| 56 | 56 |
| 57 int icon_id() const { return icon_id_; } | 57 int icon_id() const { return icon_id_; } |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 // StatusAreaButton implementation. | 60 virtual int icon_width() { return 26; } |
| 61 virtual void DrawPressed(gfx::Canvas* canvas); | |
| 62 virtual void DrawIcon(gfx::Canvas* canvas); | |
| 63 | 61 |
| 64 private: | 62 private: |
| 65 // views::ViewMenuDelegate implementation. | 63 // views::ViewMenuDelegate implementation. |
| 66 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 64 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| 67 | 65 |
| 68 // This method will draw the |icon| in the appropriate place on the |canvas|. | |
| 69 void DrawPowerIcon(gfx::Canvas* canvas, SkBitmap icon); | |
| 70 | |
| 71 // Update the power icon and menu label info depending on the power status. | 66 // Update the power icon and menu label info depending on the power status. |
| 72 void UpdateIconAndLabelInfo(); | 67 void UpdateIconAndLabelInfo(); |
| 73 | 68 |
| 74 // The number of power images. | 69 // The number of power images. |
| 75 static const int kNumPowerImages; | 70 static const int kNumPowerImages; |
| 76 | 71 |
| 77 // Stored data gathered from CrosLibrary::PowerLibrary. | 72 // Stored data gathered from CrosLibrary::PowerLibrary. |
| 78 bool battery_is_present_; | 73 bool battery_is_present_; |
| 79 bool line_power_on_; | 74 bool line_power_on_; |
| 80 bool battery_fully_charged_; | 75 bool battery_fully_charged_; |
| 81 double battery_percentage_; | 76 double battery_percentage_; |
| 82 base::TimeDelta battery_time_to_full_; | 77 base::TimeDelta battery_time_to_full_; |
| 83 base::TimeDelta battery_time_to_empty_; | 78 base::TimeDelta battery_time_to_empty_; |
| 84 | 79 |
| 85 // The currently showing icon bitmap id. | 80 // The currently showing icon bitmap id. |
| 86 int icon_id_; | 81 int icon_id_; |
| 87 | 82 |
| 88 // The power menu. This needs to be initialized last since it calls into | 83 // The power menu. This needs to be initialized last since it calls into |
| 89 // GetLabelAt() during construction. | 84 // GetLabelAt() during construction. |
| 90 views::Menu2 power_menu_; | 85 views::Menu2 power_menu_; |
| 91 | 86 |
| 92 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); | 87 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); |
| 93 }; | 88 }; |
| 94 | 89 |
| 95 } // namespace chromeos | 90 } // namespace chromeos |
| 96 | 91 |
| 97 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ | 92 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |
| OLD | NEW |