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

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

Issue 6591017: Cache network connecting bitmaps. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months 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) 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 virtual ui::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } 107 virtual ui::MenuModel* GetSubmenuModelAt(int index) const { return NULL; }
108 virtual void HighlightChangedTo(int index) {} 108 virtual void HighlightChangedTo(int index) {}
109 virtual void ActivatedAt(int index); 109 virtual void ActivatedAt(int index);
110 virtual void MenuWillShow() {} 110 virtual void MenuWillShow() {}
111 111
112 void SetFirstLevelMenuWidth(int width); 112 void SetFirstLevelMenuWidth(int width);
113 113
114 // Cancels the active menu. 114 // Cancels the active menu.
115 void CancelMenu(); 115 void CancelMenu();
116 116
117 // The following methods returns pointer to a shared instance of the SkBitmap.
118 // This shared bitmap is owned by the resource bundle and should not be freed.
119
117 // Returns the Icon for a network strength for a WifiNetwork |wifi|. 120 // Returns the Icon for a network strength for a WifiNetwork |wifi|.
118 // |black| is used to specify whether to return a black icon for display 121 // |black| is used to specify whether to return a black icon for display
119 // on a light background or a white icon for display on a dark background. 122 // on a light background or a white icon for display on a dark background.
120 static SkBitmap IconForNetworkStrength(const WifiNetwork* wifi, bool black); 123 // Expected to never return NULL.
124 static const SkBitmap* IconForNetworkStrength(const WifiNetwork* wifi,
125 bool black);
121 // Returns the Icon for a network strength for CellularNetwork |cellular|. 126 // Returns the Icon for a network strength for CellularNetwork |cellular|.
122 // |black| is used to specify whether to return a black icon for display 127 // |black| is used to specify whether to return a black icon for display
123 // on a light background or a white icon for display on a dark background. 128 // on a light background or a white icon for display on a dark background.
124 static SkBitmap IconForNetworkStrength(const CellularNetwork* cellular, 129 // Expected to never return NULL.
125 bool black); 130 static const SkBitmap* IconForNetworkStrength(const CellularNetwork* cellular,
131 bool black);
126 // Returns the Icon for animating network connecting. 132 // Returns the Icon for animating network connecting.
127 // |animation_value| is the value from Animation.GetCurrentValue() 133 // |animation_value| is the value from Animation.GetCurrentValue()
128 // |black| is used to specify whether to return a black icon for display 134 // |black| is used to specify whether to return a black icon for display
129 // on a light background or a white icon for display on a dark background. 135 // on a light background or a white icon for display on a dark background.
130 static SkBitmap IconForNetworkConnecting(double animation_value, bool black); 136 // Expected to never return NULL.
137 static const SkBitmap* IconForNetworkConnecting(double animation_value,
138 bool black);
131 // Returns the Badge for a given network technology. 139 // Returns the Badge for a given network technology.
132 // This returns different colored symbols depending on cellular data left. 140 // This returns different colored symbols depending on cellular data left.
133 static SkBitmap BadgeForNetworkTechnology(const CellularNetwork* cellular); 141 // Returns NULL if not badge is needed.
142 static const SkBitmap* BadgeForNetworkTechnology(
143 const CellularNetwork* cellular);
134 // This method will convert the |icon| bitmap to the correct size for display. 144 // This method will convert the |icon| bitmap to the correct size for display.
135 // If the |badge| icon is not empty, it will draw that on top of the icon. 145 // |icon| must be non-NULL.
136 static SkBitmap IconForDisplay(SkBitmap icon, SkBitmap badge); 146 // If the |badge| icon is not NULL, it will draw that on top of the icon.
147 static SkBitmap IconForDisplay(const SkBitmap* icon, const SkBitmap* badge);
137 148
138 protected: 149 protected:
139 virtual bool IsBrowserMode() const = 0; 150 virtual bool IsBrowserMode() const = 0;
140 virtual gfx::NativeWindow GetNativeWindow() const = 0; 151 virtual gfx::NativeWindow GetNativeWindow() const = 0;
141 virtual void OpenButtonOptions() = 0; 152 virtual void OpenButtonOptions() = 0;
142 virtual bool ShouldOpenButtonOptions() const = 0; 153 virtual bool ShouldOpenButtonOptions() const = 0;
143 154
144 // Notify subclasses that connection to |network| was initiated. 155 // Notify subclasses that connection to |network| was initiated.
145 virtual void OnConnectNetwork(const Network* network, 156 virtual void OnConnectNetwork(const Network* network,
146 SkBitmap selected_icon_) {} 157 SkBitmap selected_icon_) {}
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // The number of bars images for representing network strength. 215 // The number of bars images for representing network strength.
205 static const int kNumBarsImages; 216 static const int kNumBarsImages;
206 217
207 // Bars image resources. 218 // Bars image resources.
208 static const int kBarsImages[]; 219 static const int kBarsImages[];
209 static const int kBarsImagesBlack[]; 220 static const int kBarsImagesBlack[];
210 // TODO(chocobo): Add these back when we decide to do colored bars again. 221 // TODO(chocobo): Add these back when we decide to do colored bars again.
211 // static const int kBarsImagesLowData[]; 222 // static const int kBarsImagesLowData[];
212 // static const int kBarsImagesVLowData[]; 223 // static const int kBarsImagesVLowData[];
213 224
225 // The number of animating images for network connecting.
226 static const int kNumAnimatingImages;
227 // Animation images. These are created lazily.
228 static SkBitmap kAnimatingImages[];
229 static SkBitmap kAnimatingImagesBlack[];
230
214 // Our menu items. 231 // Our menu items.
215 MenuItemVector menu_items_; 232 MenuItemVector menu_items_;
216 233
217 // The network menu. 234 // The network menu.
218 scoped_ptr<views::Menu2> network_menu_; 235 scoped_ptr<views::Menu2> network_menu_;
219 236
220 // Holds minimum width or -1 if it wasn't set up. 237 // Holds minimum width or -1 if it wasn't set up.
221 int min_width_; 238 int min_width_;
222 239
223 // If true, call into the settings UI for network configuration dialogs. 240 // If true, call into the settings UI for network configuration dialogs.
224 bool use_settings_ui_; 241 bool use_settings_ui_;
225 242
226 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); 243 DISALLOW_COPY_AND_ASSIGN(NetworkMenu);
227 }; 244 };
228 245
229 } // namespace chromeos 246 } // namespace chromeos
230 247
231 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ 248 #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