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" |
11 #include "chrome/browser/chromeos/status/status_area_button.h" | 11 #include "chrome/browser/chromeos/status/status_area_button.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 { |
| 16 class TimeDelta; |
| 17 } |
| 18 |
15 class SkBitmap; | 19 class SkBitmap; |
16 | 20 |
17 namespace chromeos { | 21 namespace chromeos { |
18 | 22 |
19 // The power menu button in the status area. | 23 // The power menu button in the status area. |
20 // 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. |
21 class PowerMenuButton : public StatusAreaButton, | 25 class PowerMenuButton : public StatusAreaButton, |
22 public views::ViewMenuDelegate, | 26 public views::ViewMenuDelegate, |
23 public menus::MenuModel, | 27 public menus::MenuModel, |
24 public PowerLibrary::Observer { | 28 public PowerLibrary::Observer { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 virtual void DrawPressed(gfx::Canvas* canvas); | 61 virtual void DrawPressed(gfx::Canvas* canvas); |
58 virtual void DrawIcon(gfx::Canvas* canvas); | 62 virtual void DrawIcon(gfx::Canvas* canvas); |
59 | 63 |
60 private: | 64 private: |
61 // views::ViewMenuDelegate implementation. | 65 // views::ViewMenuDelegate implementation. |
62 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 66 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
63 | 67 |
64 // This method will draw the |icon| in the appropriate place on the |canvas|. | 68 // This method will draw the |icon| in the appropriate place on the |canvas|. |
65 void DrawPowerIcon(gfx::Canvas* canvas, SkBitmap icon); | 69 void DrawPowerIcon(gfx::Canvas* canvas, SkBitmap icon); |
66 | 70 |
67 // Update the power icon depending on the power status. | 71 // Update the power icon and menu label info depending on the power status. |
68 void UpdateIcon(); | 72 void UpdateIconAndLabelInfo(); |
69 | 73 |
70 // The number of power images. | 74 // The number of power images. |
71 static const int kNumPowerImages; | 75 static const int kNumPowerImages; |
72 | 76 |
73 // The power menu. | 77 // The power menu. |
74 views::Menu2 power_menu_; | 78 views::Menu2 power_menu_; |
75 | 79 |
| 80 // Stored data gathered CrosLibrary::PowerLibrary. |
| 81 bool battery_is_present_; |
| 82 bool line_power_on_; |
| 83 bool battery_fully_charged_; |
| 84 double battery_percentage_; |
| 85 base::TimeDelta battery_time_to_full_; |
| 86 base::TimeDelta battery_time_to_empty_; |
| 87 |
76 // The currently showing icon bitmap id. | 88 // The currently showing icon bitmap id. |
77 int icon_id_; | 89 int icon_id_; |
78 | 90 |
79 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); | 91 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); |
80 }; | 92 }; |
81 | 93 |
82 } // namespace chromeos | 94 } // namespace chromeos |
83 | 95 |
84 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ | 96 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |
OLD | NEW |