Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: chrome/browser/chromeos/status/network_menu.h

Issue 4169001: Rewritten parts of NetworkLibrary to work around memory corruption that prev... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Cancels the active menu. 111 // Cancels the active menu.
112 void CancelMenu(); 112 void CancelMenu();
113 113
114 // Returns the Icon for a network strength between 0 and 100. 114 // Returns the Icon for a network strength between 0 and 100.
115 // |black| is used to specify whether to return a black icon for display 115 // |black| is used to specify whether to return a black icon for display
116 // on a light background or a white icon for display on a dark background. 116 // on a light background or a white icon for display on a dark background.
117 static SkBitmap IconForNetworkStrength(int strength, bool black); 117 static SkBitmap IconForNetworkStrength(int strength, bool black);
118 118
119 // Returns the Icon for a network strength for CellularNetwork |cellular|. 119 // Returns the Icon for a network strength for CellularNetwork |cellular|.
120 // This returns different colored bars depending on cellular data left. 120 // This returns different colored bars depending on cellular data left.
121 static SkBitmap IconForNetworkStrength(CellularNetwork cellular); 121 static SkBitmap IconForNetworkStrength(const CellularNetwork* cellular);
122 122
123 // This method will convert the |icon| bitmap to the correct size for display. 123 // This method will convert the |icon| bitmap to the correct size for display.
124 // If the |badge| icon is not empty, it will draw that on top of the icon. 124 // If the |badge| icon is not empty, it will draw that on top of the icon.
125 static SkBitmap IconForDisplay(SkBitmap icon, SkBitmap badge); 125 static SkBitmap IconForDisplay(SkBitmap icon, SkBitmap badge);
126 126
127 protected: 127 protected:
128 virtual bool IsBrowserMode() const = 0; 128 virtual bool IsBrowserMode() const = 0;
129 virtual gfx::NativeWindow GetNativeWindow() const = 0; 129 virtual gfx::NativeWindow GetNativeWindow() const = 0;
130 virtual void OpenButtonOptions() const = 0; 130 virtual void OpenButtonOptions() const = 0;
131 virtual bool ShouldOpenButtonOptions() const = 0; 131 virtual bool ShouldOpenButtonOptions() const = 0;
132 132
133 // Notify subclasses that connection to |network| was initiated. 133 // Notify subclasses that connection to |network| was initiated.
134 virtual void OnConnectNetwork(const Network& network, 134 virtual void OnConnectNetwork(const Network* network,
135 SkBitmap selected_icon_) {} 135 SkBitmap selected_icon_) {}
136 // Update the menu (e.g. when the network list or status has changed). 136 // Update the menu (e.g. when the network list or status has changed).
137 void UpdateMenu(); 137 void UpdateMenu();
138 138
139 private: 139 private:
140 enum MenuItemFlags { 140 enum MenuItemFlags {
141 FLAG_DISABLED = 1 << 0, 141 FLAG_DISABLED = 1 << 0,
142 FLAG_TOGGLE_ETHERNET = 1 << 1, 142 FLAG_TOGGLE_ETHERNET = 1 << 1,
143 FLAG_TOGGLE_WIFI = 1 << 2, 143 FLAG_TOGGLE_WIFI = 1 << 2,
144 FLAG_TOGGLE_CELLULAR = 1 << 3, 144 FLAG_TOGGLE_CELLULAR = 1 << 3,
(...skipping 26 matching lines...) Expand all
171 }; 171 };
172 typedef std::vector<MenuItem> MenuItemVector; 172 typedef std::vector<MenuItem> MenuItemVector;
173 173
174 // views::ViewMenuDelegate implementation. 174 // views::ViewMenuDelegate implementation.
175 virtual void RunMenu(views::View* source, const gfx::Point& pt); 175 virtual void RunMenu(views::View* source, const gfx::Point& pt);
176 176
177 // Called by RunMenu to initialize our list of menu items. 177 // Called by RunMenu to initialize our list of menu items.
178 void InitMenuItems(); 178 void InitMenuItems();
179 179
180 // Shows network details in DOM UI options window. 180 // Shows network details in DOM UI options window.
181 void ShowTabbedNetworkSettings(const Network& network) const; 181 void ShowTabbedNetworkSettings(const Network* network) const;
182 182
183 // Show a NetworkConfigView modal dialog instance. 183 // Show a NetworkConfigView modal dialog instance.
184 // TODO(stevenjb): deprecate this once all of the UI is embedded in the menu. 184 // TODO(stevenjb): deprecate this once all of the UI is embedded in the menu.
185 void ShowNetworkConfigView(NetworkConfigView* view, bool focus_login) const; 185 void ShowNetworkConfigView(NetworkConfigView* view, bool focus_login) const;
186 186
187 // Wrappers for the ShowNetworkConfigView / ShowTabbedNetworkSettings. 187 // Wrappers for the ShowNetworkConfigView / ShowTabbedNetworkSettings.
188 void ShowWifi(const WifiNetwork& wifi, bool focus_login) const; 188 void ShowWifi(const WifiNetwork* wifi, bool focus_login) const;
189 void ShowCellular(const CellularNetwork& cellular, bool focus_login) const; 189 void ShowCellular(const CellularNetwork* cellular, bool focus_login) const;
190 void ActivateCellular(const CellularNetwork& cellular) const; 190 void ActivateCellular(const CellularNetwork* cellular) const;
191 void ShowEthernet(const EthernetNetwork& ethernet) const; 191 void ShowEthernet(const EthernetNetwork* ethernet) const;
192 void ShowOther() const; 192 void ShowOther() const;
193 193
194 // Set to true if we are currently refreshing the menu. 194 // Set to true if we are currently refreshing the menu.
195 bool refreshing_menu_; 195 bool refreshing_menu_;
196 196
197 // The number of wifi strength images. 197 // The number of wifi strength images.
198 static const int kNumWifiImages; 198 static const int kNumWifiImages;
199 199
200 // Bars image resources. 200 // Bars image resources.
201 static const int kBarsImages[]; 201 static const int kBarsImages[];
(...skipping 12 matching lines...) Expand all
214 214
215 // If true, call into the settings UI for network configuration dialogs. 215 // If true, call into the settings UI for network configuration dialogs.
216 bool use_settings_ui_; 216 bool use_settings_ui_;
217 217
218 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); 218 DISALLOW_COPY_AND_ASSIGN(NetworkMenu);
219 }; 219 };
220 220
221 } // namespace chromeos 221 } // namespace chromeos
222 222
223 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ 223 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/network_dropdown_button.cc ('k') | chrome/browser/chromeos/status/network_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698