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 "third_party/cros/chromeos_power.h" | |
stevenjb
2011/10/18 23:08:23
We shouldn't use the PowerStatus struct defined in
Simon Que
2011/10/18 23:17:28
Agreed, but I was hoping to do it after this patch
| |
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 } |
(...skipping 10 matching lines...) Expand all Loading... | |
31 public PowerLibrary::Observer { | 32 public PowerLibrary::Observer { |
32 public: | 33 public: |
33 explicit PowerMenuButton(StatusAreaHost* host); | 34 explicit PowerMenuButton(StatusAreaHost* host); |
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; |
38 virtual bool IsCommandEnabled(int id) const; | 39 virtual bool IsCommandEnabled(int id) const; |
39 | 40 |
40 // PowerLibrary::Observer implementation. | 41 // PowerLibrary::Observer implementation. |
41 virtual void PowerChanged(PowerLibrary* obj); | 42 virtual void PowerChanged(const PowerStatus& power_status); |
42 virtual void SystemResumed() {} | 43 virtual void SystemResumed() {} |
43 | 44 |
44 int battery_index() const { return battery_index_; } | 45 int battery_index() const { return battery_index_; } |
45 | 46 |
46 protected: | 47 protected: |
47 virtual int icon_width(); | 48 virtual int icon_width(); |
48 | 49 |
49 private: | 50 private: |
50 class StatusView; | 51 class StatusView; |
51 | 52 |
(...skipping 12 matching lines...) Expand all Loading... | |
64 // Update Battery time. Try to make it monotonically decreasing unless | 65 // Update Battery time. Try to make it monotonically decreasing unless |
65 // there's a large delta. | 66 // there's a large delta. |
66 void UpdateBatteryTime(base::TimeDelta* previous, | 67 void UpdateBatteryTime(base::TimeDelta* previous, |
67 const base::TimeDelta& current); | 68 const base::TimeDelta& current); |
68 | 69 |
69 // Stored data gathered from CrosLibrary::PowerLibrary. | 70 // Stored data gathered from CrosLibrary::PowerLibrary. |
70 bool battery_is_present_; | 71 bool battery_is_present_; |
71 bool line_power_on_; | 72 bool line_power_on_; |
72 double battery_percentage_; | 73 double battery_percentage_; |
73 int battery_index_; | 74 int battery_index_; |
75 PowerStatus power_status_; | |
76 | |
74 base::TimeDelta battery_time_to_full_; | 77 base::TimeDelta battery_time_to_full_; |
75 base::TimeDelta battery_time_to_empty_; | 78 base::TimeDelta battery_time_to_empty_; |
76 | 79 |
77 // The currently showing status view. NULL if menu is not being displayed. | 80 // The currently showing status view. NULL if menu is not being displayed. |
78 StatusView* status_; | 81 StatusView* status_; |
79 | 82 |
80 // If non-null the menu is showing. | 83 // If non-null the menu is showing. |
81 scoped_ptr<views::MenuRunner> menu_runner_; | 84 scoped_ptr<views::MenuRunner> menu_runner_; |
82 | 85 |
83 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); | 86 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); |
84 }; | 87 }; |
85 | 88 |
86 } // namespace chromeos | 89 } // namespace chromeos |
87 | 90 |
88 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ | 91 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |
OLD | NEW |