| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 bool remembered; | 67 bool remembered; |
| 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|. |
| 78 void ConnectToNetworkAt(int index, |
| 79 const std::string& passphrase, |
| 80 const std::string& identity) const; |
| 81 |
| 77 // menus::MenuModel implementation. | 82 // menus::MenuModel implementation. |
| 78 virtual bool HasIcons() const { return true; } | 83 virtual bool HasIcons() const { return true; } |
| 79 virtual int GetItemCount() const; | 84 virtual int GetItemCount() const; |
| 80 virtual menus::MenuModel::ItemType GetTypeAt(int index) const; | 85 virtual menus::MenuModel::ItemType GetTypeAt(int index) const; |
| 81 virtual int GetCommandIdAt(int index) const { return index; } | 86 virtual int GetCommandIdAt(int index) const { return index; } |
| 82 virtual string16 GetLabelAt(int index) const; | 87 virtual string16 GetLabelAt(int index) const; |
| 83 virtual bool IsLabelDynamicAt(int index) const { return true; } | 88 virtual bool IsLabelDynamicAt(int index) const { return true; } |
| 84 virtual const gfx::Font* GetLabelFontAt(int index) const; | 89 virtual const gfx::Font* GetLabelFontAt(int index) const; |
| 85 virtual bool GetAcceleratorAt(int index, | 90 virtual bool GetAcceleratorAt(int index, |
| 86 menus::Accelerator* accelerator) const { return false; } | 91 menus::Accelerator* accelerator) const { return false; } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 112 | 117 |
| 113 protected: | 118 protected: |
| 114 virtual bool IsBrowserMode() const = 0; | 119 virtual bool IsBrowserMode() const = 0; |
| 115 virtual gfx::NativeWindow GetNativeWindow() const = 0; | 120 virtual gfx::NativeWindow GetNativeWindow() const = 0; |
| 116 virtual void OpenButtonOptions() const = 0; | 121 virtual void OpenButtonOptions() const = 0; |
| 117 virtual bool ShouldOpenButtonOptions() const = 0; | 122 virtual bool ShouldOpenButtonOptions() const = 0; |
| 118 | 123 |
| 119 // Notify subclasses that connection to |network| was initiated. | 124 // Notify subclasses that connection to |network| was initiated. |
| 120 virtual void OnConnectNetwork(const Network& network, | 125 virtual void OnConnectNetwork(const Network& network, |
| 121 SkBitmap selected_icon_) {} | 126 SkBitmap selected_icon_) {} |
| 127 // Update the menu (e.g. when the network list or status has changed). |
| 128 void UpdateMenu(); |
| 122 | 129 |
| 123 private: | 130 private: |
| 124 enum MenuItemFlags { | 131 enum MenuItemFlags { |
| 125 FLAG_DISABLED = 1 << 0, | 132 FLAG_DISABLED = 1 << 0, |
| 126 FLAG_TOGGLE_ETHERNET = 1 << 1, | 133 FLAG_TOGGLE_ETHERNET = 1 << 1, |
| 127 FLAG_TOGGLE_WIFI = 1 << 2, | 134 FLAG_TOGGLE_WIFI = 1 << 2, |
| 128 FLAG_TOGGLE_CELLULAR = 1 << 3, | 135 FLAG_TOGGLE_CELLULAR = 1 << 3, |
| 129 FLAG_TOGGLE_OFFLINE = 1 << 4, | 136 FLAG_TOGGLE_OFFLINE = 1 << 4, |
| 130 FLAG_ASSOCIATED = 1 << 5, | 137 FLAG_ASSOCIATED = 1 << 5, |
| 131 FLAG_ETHERNET = 1 << 6, | 138 FLAG_ETHERNET = 1 << 6, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 157 | 164 |
| 158 // views::ViewMenuDelegate implementation. | 165 // views::ViewMenuDelegate implementation. |
| 159 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 166 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| 160 | 167 |
| 161 // Called by RunMenu to initialize our list of menu items. | 168 // Called by RunMenu to initialize our list of menu items. |
| 162 void InitMenuItems(); | 169 void InitMenuItems(); |
| 163 | 170 |
| 164 // Shows network details in DOM UI options window. | 171 // Shows network details in DOM UI options window. |
| 165 void ShowTabbedNetworkSettings(const Network& network); | 172 void ShowTabbedNetworkSettings(const Network& network); |
| 166 | 173 |
| 174 // Show a NetworkConfigView modal dialog instance. |
| 175 // TODO(stevenjb): deprecate this once all of the UI is embedded in the menu. |
| 176 void ShowNetworkConfigView(NetworkConfigView* view, bool focus_login) const; |
| 177 |
| 167 // Set to true if we are currently refreshing the menu. | 178 // Set to true if we are currently refreshing the menu. |
| 168 bool refreshing_menu_; | 179 bool refreshing_menu_; |
| 169 | 180 |
| 170 // The number of wifi strength images. | 181 // The number of wifi strength images. |
| 171 static const int kNumWifiImages; | 182 static const int kNumWifiImages; |
| 172 | 183 |
| 173 // Our menu items. | 184 // Our menu items. |
| 174 MenuItemVector menu_items_; | 185 MenuItemVector menu_items_; |
| 175 | 186 |
| 176 // The network menu. | 187 // The network menu. |
| 177 scoped_ptr<views::Menu2> network_menu_; | 188 scoped_ptr<views::Menu2> network_menu_; |
| 178 | 189 |
| 179 // Holds minimum width or -1 if it wasn't set up. | 190 // Holds minimum width or -1 if it wasn't set up. |
| 180 int min_width_; | 191 int min_width_; |
| 181 | 192 |
| 182 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); | 193 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); |
| 183 }; | 194 }; |
| 184 | 195 |
| 185 } // namespace chromeos | 196 } // namespace chromeos |
| 186 | 197 |
| 187 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 198 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
| OLD | NEW |