| 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 "third_party/chromeos_power/chromeos_power.h" |
| 10 #include "views/controls/menu/simple_menu_model.h" | 10 #include "views/controls/menu/simple_menu_model.h" |
| 11 #include "views/controls/menu/view_menu_delegate.h" | 11 #include "views/controls/menu/view_menu_delegate.h" |
| 12 #include "views/view.h" | 12 #include "views/view.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 class NetworkMenuButton; |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 class MenuButton; | 18 class MenuButton; |
| 18 class ImageView; | 19 class ImageView; |
| 19 } | 20 } |
| 20 | 21 |
| 21 // This class is used to wrap the small informative widgets in the upper-right | 22 // This class is used to wrap the small informative widgets in the upper-right |
| 22 // of the window title bar. It is used on ChromeOS only. | 23 // of the window title bar. It is used on ChromeOS only. |
| 23 class StatusAreaView : public views::View, | 24 class StatusAreaView : public views::View, |
| 24 public views::SimpleMenuModel::Delegate, | 25 public views::SimpleMenuModel::Delegate, |
| 25 public views::ViewMenuDelegate { | 26 public views::ViewMenuDelegate { |
| 26 public: | 27 public: |
| 27 enum OpenTabsMode { | 28 enum OpenTabsMode { |
| 28 OPEN_TABS_ON_LEFT = 1, | 29 OPEN_TABS_ON_LEFT = 1, |
| 29 OPEN_TABS_CLOBBER, | 30 OPEN_TABS_CLOBBER, |
| 30 OPEN_TABS_ON_RIGHT | 31 OPEN_TABS_ON_RIGHT |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 StatusAreaView(Browser* browser); | 34 explicit StatusAreaView(Browser* browser); |
| 34 virtual ~StatusAreaView(); | 35 virtual ~StatusAreaView(); |
| 35 | 36 |
| 36 void Init(); | 37 void Init(); |
| 37 | 38 |
| 38 // views::View* overrides. | 39 // views::View* overrides. |
| 39 virtual gfx::Size GetPreferredSize(); | 40 virtual gfx::Size GetPreferredSize(); |
| 40 virtual void Layout(); | 41 virtual void Layout(); |
| 41 virtual void Paint(gfx::Canvas* canvas); | 42 virtual void Paint(gfx::Canvas* canvas); |
| 42 | 43 |
| 43 static OpenTabsMode GetOpenTabsMode(); | 44 static OpenTabsMode GetOpenTabsMode(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 61 | 62 |
| 62 static void LoadPowerLibrary(); | 63 static void LoadPowerLibrary(); |
| 63 // Called whenever the battery status changes. Dispatches to | 64 // Called whenever the battery status changes. Dispatches to |
| 64 // PowerStatusChanged() instance method. | 65 // PowerStatusChanged() instance method. |
| 65 static void PowerStatusChangedHandler( | 66 static void PowerStatusChangedHandler( |
| 66 void* object, const chromeos::PowerStatus& status); | 67 void* object, const chromeos::PowerStatus& status); |
| 67 | 68 |
| 68 // The browser window that owns us. | 69 // The browser window that owns us. |
| 69 Browser* browser_; | 70 Browser* browser_; |
| 70 | 71 |
| 72 NetworkMenuButton* network_view_; |
| 71 views::ImageView* battery_view_; | 73 views::ImageView* battery_view_; |
| 72 views::MenuButton* menu_view_; | 74 views::MenuButton* menu_view_; |
| 73 | 75 |
| 74 scoped_ptr<views::SimpleMenuModel> app_menu_contents_; | 76 scoped_ptr<views::SimpleMenuModel> app_menu_contents_; |
| 75 scoped_ptr<views::SimpleMenuModel> options_menu_contents_; | 77 scoped_ptr<views::SimpleMenuModel> options_menu_contents_; |
| 76 scoped_ptr<views::Menu2> app_menu_menu_; | 78 scoped_ptr<views::Menu2> app_menu_menu_; |
| 77 // A reference to the battery power api, to allow callbacks when the | 79 // A reference to the battery power api, to allow callbacks when the |
| 78 // battery status changes. | 80 // battery status changes. |
| 79 chromeos::PowerStatusConnection power_status_connection_; | 81 chromeos::PowerStatusConnection power_status_connection_; |
| 80 | 82 |
| 81 static OpenTabsMode open_tabs_mode_; | 83 static OpenTabsMode open_tabs_mode_; |
| 82 // Handle to result of dlopen() of the power shared object. | 84 // Handle to result of dlopen() of the power shared object. |
| 83 static void* power_library_; | 85 static void* power_library_; |
| 84 // True if there was an error loading the power shared object. | 86 // True if there was an error loading the power shared object. |
| 85 static bool power_library_error_; | 87 static bool power_library_error_; |
| 86 | 88 |
| 87 DISALLOW_COPY_AND_ASSIGN(StatusAreaView); | 89 DISALLOW_COPY_AND_ASSIGN(StatusAreaView); |
| 88 }; | 90 }; |
| 89 | 91 |
| 90 #endif // CHROME_BROWSER_CHROMEOS_STATUS_AREA_VIEW_H_ | 92 #endif // CHROME_BROWSER_CHROMEOS_STATUS_AREA_VIEW_H_ |
| OLD | NEW |