OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 }; | 68 }; |
69 | 69 |
70 NetworkMenu(); | 70 NetworkMenu(); |
71 virtual ~NetworkMenu(); | 71 virtual ~NetworkMenu(); |
72 | 72 |
73 // Retrieves network info for the DOMUI NetworkMenu (NetworkMenuUI). | 73 // Retrieves network info for the DOMUI NetworkMenu (NetworkMenuUI). |
74 // |index| is the index in menu_items_, set when the menu is built. | 74 // |index| is the index in menu_items_, set when the menu is built. |
75 bool GetNetworkAt(int index, NetworkInfo* info) const; | 75 bool GetNetworkAt(int index, NetworkInfo* info) const; |
76 | 76 |
77 // Connect or reconnect to the network at |index|. | 77 // Connect or reconnect to the network at |index|. |
78 void ConnectToNetworkAt(int index, | 78 // If remember >= 0, set the favorite state of the network. |
| 79 // Returns true if a connect occurred (e.g. menu should be closed). |
| 80 bool ConnectToNetworkAt(int index, |
79 const std::string& passphrase, | 81 const std::string& passphrase, |
80 const std::string& identity) const; | 82 const std::string& ssid, |
| 83 int remember) const; |
81 | 84 |
82 // menus::MenuModel implementation. | 85 // menus::MenuModel implementation. |
83 virtual bool HasIcons() const { return true; } | 86 virtual bool HasIcons() const { return true; } |
84 virtual int GetItemCount() const; | 87 virtual int GetItemCount() const; |
85 virtual menus::MenuModel::ItemType GetTypeAt(int index) const; | 88 virtual menus::MenuModel::ItemType GetTypeAt(int index) const; |
86 virtual int GetCommandIdAt(int index) const { return index; } | 89 virtual int GetCommandIdAt(int index) const { return index; } |
87 virtual string16 GetLabelAt(int index) const; | 90 virtual string16 GetLabelAt(int index) const; |
88 virtual bool IsLabelDynamicAt(int index) const { return true; } | 91 virtual bool IsLabelDynamicAt(int index) const { return true; } |
89 virtual const gfx::Font* GetLabelFontAt(int index) const; | 92 virtual const gfx::Font* GetLabelFontAt(int index) const; |
90 virtual bool GetAcceleratorAt(int index, | 93 virtual bool GetAcceleratorAt(int index, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 }; | 165 }; |
163 typedef std::vector<MenuItem> MenuItemVector; | 166 typedef std::vector<MenuItem> MenuItemVector; |
164 | 167 |
165 // views::ViewMenuDelegate implementation. | 168 // views::ViewMenuDelegate implementation. |
166 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 169 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
167 | 170 |
168 // Called by RunMenu to initialize our list of menu items. | 171 // Called by RunMenu to initialize our list of menu items. |
169 void InitMenuItems(); | 172 void InitMenuItems(); |
170 | 173 |
171 // Shows network details in DOM UI options window. | 174 // Shows network details in DOM UI options window. |
172 void ShowTabbedNetworkSettings(const Network& network); | 175 void ShowTabbedNetworkSettings(const Network& network) const; |
173 | 176 |
174 // Show a NetworkConfigView modal dialog instance. | 177 // Show a NetworkConfigView modal dialog instance. |
175 // TODO(stevenjb): deprecate this once all of the UI is embedded in the menu. | 178 // TODO(stevenjb): deprecate this once all of the UI is embedded in the menu. |
176 void ShowNetworkConfigView(NetworkConfigView* view, bool focus_login) const; | 179 void ShowNetworkConfigView(NetworkConfigView* view, bool focus_login) const; |
177 | 180 |
| 181 // Wrappers for the ShowNetworkConfigView / ShowTabbedNetworkSettings. |
| 182 void ShowWifi(const WifiNetwork& wifi, bool focus_login) const; |
| 183 void ShowCellular(const CellularNetwork& cellular, bool focus_login) const; |
| 184 void ShowEthernet(const EthernetNetwork& ethernet) const; |
| 185 void ShowOther() const; |
| 186 |
178 // Set to true if we are currently refreshing the menu. | 187 // Set to true if we are currently refreshing the menu. |
179 bool refreshing_menu_; | 188 bool refreshing_menu_; |
180 | 189 |
181 // The number of wifi strength images. | 190 // The number of wifi strength images. |
182 static const int kNumWifiImages; | 191 static const int kNumWifiImages; |
183 | 192 |
184 // Our menu items. | 193 // Our menu items. |
185 MenuItemVector menu_items_; | 194 MenuItemVector menu_items_; |
186 | 195 |
187 // The network menu. | 196 // The network menu. |
188 scoped_ptr<views::Menu2> network_menu_; | 197 scoped_ptr<views::Menu2> network_menu_; |
189 | 198 |
190 // Holds minimum width or -1 if it wasn't set up. | 199 // Holds minimum width or -1 if it wasn't set up. |
191 int min_width_; | 200 int min_width_; |
192 | 201 |
193 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); | 202 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); |
194 }; | 203 }; |
195 | 204 |
196 } // namespace chromeos | 205 } // namespace chromeos |
197 | 206 |
198 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 207 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
OLD | NEW |