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_NETWORK_MENU_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 class NetworkMenu { | 63 class NetworkMenu { |
64 public: | 64 public: |
65 class Delegate { | 65 class Delegate { |
66 public: | 66 public: |
67 virtual views::MenuButton* GetMenuButton() = 0; | 67 virtual views::MenuButton* GetMenuButton() = 0; |
68 virtual gfx::NativeWindow GetNativeWindow() const = 0; | 68 virtual gfx::NativeWindow GetNativeWindow() const = 0; |
69 virtual void OpenButtonOptions() = 0; | 69 virtual void OpenButtonOptions() = 0; |
70 virtual bool ShouldOpenButtonOptions() const = 0; | 70 virtual bool ShouldOpenButtonOptions() const = 0; |
71 }; | 71 }; |
72 | 72 |
73 NetworkMenu(Delegate* delegate, bool is_browser_mode); | 73 explicit NetworkMenu(Delegate* delegate); |
74 virtual ~NetworkMenu(); | 74 virtual ~NetworkMenu(); |
75 | 75 |
76 // Access to menu definition. | 76 // Access to menu definition. |
77 ui::MenuModel* GetMenuModel(); | 77 ui::MenuModel* GetMenuModel(); |
78 | 78 |
79 // Cancels the active menu. | 79 // Cancels the active menu. |
80 void CancelMenu(); | 80 void CancelMenu(); |
81 | 81 |
82 // Update the menu (e.g. when the network list or status has changed). | 82 // Update the menu (e.g. when the network list or status has changed). |
83 virtual void UpdateMenu(); | 83 virtual void UpdateMenu(); |
84 | 84 |
85 // Run the menu. | 85 // Run the menu. |
86 void RunMenu(views::View* source); | 86 void RunMenu(views::View* source); |
87 | 87 |
88 // Shows network details in Web UI options window. | 88 // Shows network details in Web UI options window. |
89 void ShowTabbedNetworkSettings(const Network* network) const; | 89 void ShowTabbedNetworkSettings(const Network* network) const; |
90 | 90 |
91 // Getters. | 91 // Getters. |
92 Delegate* delegate() const { return delegate_; } | 92 Delegate* delegate() const { return delegate_; } |
93 bool is_browser_mode() const { return is_browser_mode_; } | |
94 | 93 |
95 // Setters. | 94 // Setters. |
96 void set_min_width(int min_width) { min_width_ = min_width; } | 95 void set_min_width(int min_width) { min_width_ = min_width; } |
97 | 96 |
98 private: | 97 private: |
99 friend class NetworkMenuModel; | 98 friend class NetworkMenuModel; |
100 | 99 |
101 // Weak ptr to delegate. | 100 // Weak ptr to delegate. |
102 Delegate* delegate_; | 101 Delegate* delegate_; |
103 | 102 |
104 // True if the browser is visible (i.e. not login/OOBE). | |
105 bool is_browser_mode_; | |
106 | |
107 // Set to true if we are currently refreshing the menu. | 103 // Set to true if we are currently refreshing the menu. |
108 bool refreshing_menu_; | 104 bool refreshing_menu_; |
109 | 105 |
110 // The network menu. | 106 // The network menu. |
111 scoped_ptr<NetworkMenuModel> main_menu_model_; | 107 scoped_ptr<NetworkMenuModel> main_menu_model_; |
112 scoped_ptr<views::MenuModelAdapter> menu_model_adapter_; | 108 scoped_ptr<views::MenuModelAdapter> menu_model_adapter_; |
113 views::MenuItemView* menu_item_view_; | 109 views::MenuItemView* menu_item_view_; |
114 scoped_ptr<views::MenuRunner> menu_runner_; | 110 scoped_ptr<views::MenuRunner> menu_runner_; |
115 | 111 |
116 // Holds minimum width of the menu. | 112 // Holds minimum width of the menu. |
117 int min_width_; | 113 int min_width_; |
118 | 114 |
119 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); | 115 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); |
120 }; | 116 }; |
121 | 117 |
122 } // namespace chromeos | 118 } // namespace chromeos |
123 | 119 |
124 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 120 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
OLD | NEW |