OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_AREA_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_AREA_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_AREA_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_AREA_VIEW_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "third_party/chromeos_power/chromeos_power.h" |
9 #include "views/controls/menu/simple_menu_model.h" | 10 #include "views/controls/menu/simple_menu_model.h" |
10 #include "views/controls/menu/view_menu_delegate.h" | 11 #include "views/controls/menu/view_menu_delegate.h" |
11 #include "views/view.h" | 12 #include "views/view.h" |
12 | 13 |
13 class Browser; | 14 class Browser; |
14 | 15 |
15 namespace views { | 16 namespace views { |
16 class MenuButton; | 17 class MenuButton; |
17 class ImageView; | 18 class ImageView; |
18 } | 19 } |
(...skipping 29 matching lines...) Expand all Loading... |
48 // views::SimpleMenuModel::Delegate implementation. | 49 // views::SimpleMenuModel::Delegate implementation. |
49 virtual bool IsCommandIdChecked(int command_id) const; | 50 virtual bool IsCommandIdChecked(int command_id) const; |
50 virtual bool IsCommandIdEnabled(int command_id) const; | 51 virtual bool IsCommandIdEnabled(int command_id) const; |
51 virtual bool GetAcceleratorForCommandId(int command_id, | 52 virtual bool GetAcceleratorForCommandId(int command_id, |
52 views::Accelerator* accelerator); | 53 views::Accelerator* accelerator); |
53 virtual void ExecuteCommand(int command_id); | 54 virtual void ExecuteCommand(int command_id); |
54 | 55 |
55 // views::ViewMenuDelegate implementation. | 56 // views::ViewMenuDelegate implementation. |
56 virtual void RunMenu(views::View* source, const gfx::Point& pt, | 57 virtual void RunMenu(views::View* source, const gfx::Point& pt, |
57 gfx::NativeView hwnd); | 58 gfx::NativeView hwnd); |
| 59 // Called whenever the battery status changes. |
| 60 void PowerStatusChanged(const chromeos::PowerStatus& status); |
| 61 |
| 62 static void LoadPowerLibrary(); |
| 63 // Called whenever the battery status changes. Dispatches to |
| 64 // PowerStatusChanged() instance method. |
| 65 static void PowerStatusChangedHandler( |
| 66 void* object, const chromeos::PowerStatus& status); |
58 | 67 |
59 // The browser window that owns us. | 68 // The browser window that owns us. |
60 Browser* browser_; | 69 Browser* browser_; |
61 | 70 |
62 views::ImageView* battery_view_; | 71 views::ImageView* battery_view_; |
63 views::MenuButton* menu_view_; | 72 views::MenuButton* menu_view_; |
64 | 73 |
65 scoped_ptr<views::SimpleMenuModel> app_menu_contents_; | 74 scoped_ptr<views::SimpleMenuModel> app_menu_contents_; |
66 scoped_ptr<views::SimpleMenuModel> options_menu_contents_; | 75 scoped_ptr<views::SimpleMenuModel> options_menu_contents_; |
67 scoped_ptr<views::Menu2> app_menu_menu_; | 76 scoped_ptr<views::Menu2> app_menu_menu_; |
| 77 // A reference to the battery power api, to allow callbacks when the |
| 78 // battery status changes. |
| 79 chromeos::PowerStatusConnection power_status_connection_; |
68 | 80 |
69 static OpenTabsMode open_tabs_mode_; | 81 static OpenTabsMode open_tabs_mode_; |
| 82 // Handle to result of dlopen() of the power shared object. |
| 83 static void* power_library_; |
| 84 // True if there was an error loading the power shared object. |
| 85 static bool power_library_error_; |
70 | 86 |
71 DISALLOW_COPY_AND_ASSIGN(StatusAreaView); | 87 DISALLOW_COPY_AND_ASSIGN(StatusAreaView); |
72 }; | 88 }; |
73 | 89 |
74 #endif // CHROME_BROWSER_CHROMEOS_STATUS_AREA_VIEW_H_ | 90 #endif // CHROME_BROWSER_CHROMEOS_STATUS_AREA_VIEW_H_ |
OLD | NEW |