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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Connect or reconnect to the network at |index|. | 56 // Connect or reconnect to the network at |index|. |
57 // If remember >= 0, set the favorite state of the network. | 57 // If remember >= 0, set the favorite state of the network. |
58 // Returns true if a connect occurred (e.g. menu should be closed). | 58 // Returns true if a connect occurred (e.g. menu should be closed). |
59 bool ConnectToNetworkAt(int index, | 59 bool ConnectToNetworkAt(int index, |
60 const std::string& passphrase, | 60 const std::string& passphrase, |
61 const std::string& ssid, | 61 const std::string& ssid, |
62 int remember) const; | 62 int remember) const; |
63 | 63 |
64 // Called by NetworkMenu::RunMenu to initialize list of menu items. | 64 // Called by NetworkMenu::RunMenu to initialize list of menu items. |
65 virtual void InitMenuItems(bool is_browser_mode, | 65 virtual void InitMenuItems(bool is_browser_mode, |
66 bool should_open_button_options) {} | 66 bool should_open_button_options) = 0; |
67 | 67 |
68 // ui::MenuModel implementation. | 68 // ui::MenuModel implementation. |
69 virtual bool HasIcons() const { return true; } | 69 virtual bool HasIcons() const { return true; } |
70 virtual int GetItemCount() const; | 70 virtual int GetItemCount() const; |
71 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; | 71 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; |
72 virtual int GetCommandIdAt(int index) const { return index; } | 72 virtual int GetCommandIdAt(int index) const { return index; } |
73 virtual string16 GetLabelAt(int index) const; | 73 virtual string16 GetLabelAt(int index) const; |
74 virtual bool IsItemDynamicAt(int index) const { return true; } | 74 virtual bool IsItemDynamicAt(int index) const { return true; } |
75 virtual const gfx::Font* GetLabelFontAt(int index) const; | 75 virtual const gfx::Font* GetLabelFontAt(int index) const; |
76 virtual bool GetAcceleratorAt(int index, | 76 virtual bool GetAcceleratorAt(int index, |
77 ui::Accelerator* accelerator) const { return false; } | 77 ui::Accelerator* accelerator) const { return false; } |
78 virtual bool IsItemCheckedAt(int index) const; | 78 virtual bool IsItemCheckedAt(int index) const; |
79 virtual int GetGroupIdAt(int index) const { return 0; } | 79 virtual int GetGroupIdAt(int index) const { return 0; } |
80 virtual bool GetIconAt(int index, SkBitmap* icon); | 80 virtual bool GetIconAt(int index, SkBitmap* icon); |
81 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const { | 81 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const { |
82 return NULL; | 82 return NULL; |
83 } | 83 } |
84 virtual bool IsEnabledAt(int index) const; | 84 virtual bool IsEnabledAt(int index) const; |
85 virtual ui::MenuModel* GetSubmenuModelAt(int index) const; | 85 virtual ui::MenuModel* GetSubmenuModelAt(int index) const; |
86 virtual void HighlightChangedTo(int index) {} | 86 virtual void HighlightChangedTo(int index) {} |
87 virtual void ActivatedAt(int index); | 87 virtual void ActivatedAt(int index); |
88 virtual void MenuWillShow() {} | 88 virtual void MenuWillShow() {} |
89 virtual void SetMenuModelDelegate(ui::MenuModelDelegate* delegate) {} | 89 virtual void SetMenuModelDelegate(ui::MenuModelDelegate* delegate) {} |
90 | 90 |
91 protected: | 91 protected: |
92 enum MenuItemFlags { | 92 enum MenuItemFlags { |
| 93 FLAG_NONE = 0, |
93 FLAG_DISABLED = 1 << 0, | 94 FLAG_DISABLED = 1 << 0, |
94 FLAG_TOGGLE_ETHERNET = 1 << 1, | 95 FLAG_TOGGLE_ETHERNET = 1 << 1, |
95 FLAG_TOGGLE_WIFI = 1 << 2, | 96 FLAG_TOGGLE_WIFI = 1 << 2, |
96 FLAG_TOGGLE_CELLULAR = 1 << 3, | 97 FLAG_TOGGLE_CELLULAR = 1 << 3, |
97 FLAG_TOGGLE_OFFLINE = 1 << 4, | 98 FLAG_TOGGLE_OFFLINE = 1 << 4, |
98 FLAG_ASSOCIATED = 1 << 5, | 99 FLAG_ASSOCIATED = 1 << 5, |
99 FLAG_ETHERNET = 1 << 6, | 100 FLAG_ETHERNET = 1 << 6, |
100 FLAG_WIFI = 1 << 7, | 101 FLAG_WIFI = 1 << 7, |
101 FLAG_CELLULAR = 1 << 8, | 102 FLAG_CELLULAR = 1 << 8, |
102 FLAG_PRIVATE_NETWORKS = 1 << 9, | 103 FLAG_OPTIONS = 1 << 9, |
103 FLAG_OPTIONS = 1 << 10, | 104 FLAG_ADD_WIFI = 1 << 10, |
104 FLAG_ADD_WIFI = 1 << 11, | 105 FLAG_ADD_CELLULAR = 1 << 11, |
105 FLAG_ADD_CELLULAR = 1 << 12, | 106 FLAG_VPN = 1 << 12, |
106 FLAG_VPN = 1 << 13, | 107 FLAG_ADD_VPN = 1 << 13, |
107 FLAG_ADD_VPN = 1 << 14, | 108 FLAG_DISCONNECT_VPN = 1 << 14, |
108 FLAG_DISCONNECT_VPN = 1 << 15, | |
109 }; | 109 }; |
110 | 110 |
111 struct MenuItem { | 111 struct MenuItem { |
112 MenuItem() | 112 MenuItem() |
113 : type(ui::MenuModel::TYPE_SEPARATOR), | 113 : type(ui::MenuModel::TYPE_SEPARATOR), |
114 sub_menu_model(NULL), | 114 sub_menu_model(NULL), |
115 flags(0) {} | 115 flags(0) {} |
116 MenuItem(ui::MenuModel::ItemType type, string16 label, SkBitmap icon, | 116 MenuItem(ui::MenuModel::ItemType type, string16 label, SkBitmap icon, |
117 const std::string& service_path, int flags) | 117 const std::string& service_path, int flags) |
118 : type(type), | 118 : type(type), |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 // If true, call into the settings UI for network configuration dialogs. | 299 // If true, call into the settings UI for network configuration dialogs. |
300 bool use_settings_ui_; | 300 bool use_settings_ui_; |
301 | 301 |
302 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); | 302 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); |
303 }; | 303 }; |
304 | 304 |
305 } // namespace chromeos | 305 } // namespace chromeos |
306 | 306 |
307 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 307 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
OLD | NEW |