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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 static const SkBitmap* IconForNetworkStrength(const WifiNetwork* wifi, |
| 124 bool black); |
121 // Returns the Icon for a network strength for CellularNetwork |cellular|. | 125 // Returns the Icon for a network strength for CellularNetwork |cellular|. |
122 // |black| is used to specify whether to return a black icon for display | 126 // |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. | 127 // on a light background or a white icon for display on a dark background. |
124 static SkBitmap IconForNetworkStrength(const CellularNetwork* cellular, | 128 static const SkBitmap* IconForNetworkStrength(const CellularNetwork* cellular, |
125 bool black); | 129 bool black); |
126 // Returns the Icon for animating network connecting. | 130 // Returns the Icon for animating network connecting. |
127 // |animation_value| is the value from Animation.GetCurrentValue() | 131 // |animation_value| is the value from Animation.GetCurrentValue() |
128 // |black| is used to specify whether to return a black icon for display | 132 // |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. | 133 // on a light background or a white icon for display on a dark background. |
130 static SkBitmap IconForNetworkConnecting(double animation_value, bool black); | 134 static const SkBitmap* IconForNetworkConnecting(double animation_value, |
| 135 bool black); |
131 // Returns the Badge for a given network technology. | 136 // Returns the Badge for a given network technology. |
132 // This returns different colored symbols depending on cellular data left. | 137 // This returns different colored symbols depending on cellular data left. |
133 static SkBitmap BadgeForNetworkTechnology(const CellularNetwork* cellular); | 138 // Returns NULL if not badge is needed. |
| 139 static const SkBitmap* BadgeForNetworkTechnology( |
| 140 const CellularNetwork* cellular); |
134 // This method will convert the |icon| bitmap to the correct size for display. | 141 // 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. | 142 // |icon| must be non-NULL. |
136 static SkBitmap IconForDisplay(SkBitmap icon, SkBitmap badge); | 143 // If the |badge| icon is not NULL, it will draw that on top of the icon. |
| 144 static SkBitmap IconForDisplay(const SkBitmap* icon, const SkBitmap* badge); |
137 | 145 |
138 protected: | 146 protected: |
139 virtual bool IsBrowserMode() const = 0; | 147 virtual bool IsBrowserMode() const = 0; |
140 virtual gfx::NativeWindow GetNativeWindow() const = 0; | 148 virtual gfx::NativeWindow GetNativeWindow() const = 0; |
141 virtual void OpenButtonOptions() = 0; | 149 virtual void OpenButtonOptions() = 0; |
142 virtual bool ShouldOpenButtonOptions() const = 0; | 150 virtual bool ShouldOpenButtonOptions() const = 0; |
143 | 151 |
144 // Notify subclasses that connection to |network| was initiated. | 152 // Notify subclasses that connection to |network| was initiated. |
145 virtual void OnConnectNetwork(const Network* network, | 153 virtual void OnConnectNetwork(const Network* network, |
146 SkBitmap selected_icon_) {} | 154 SkBitmap selected_icon_) {} |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // The number of bars images for representing network strength. | 212 // The number of bars images for representing network strength. |
205 static const int kNumBarsImages; | 213 static const int kNumBarsImages; |
206 | 214 |
207 // Bars image resources. | 215 // Bars image resources. |
208 static const int kBarsImages[]; | 216 static const int kBarsImages[]; |
209 static const int kBarsImagesBlack[]; | 217 static const int kBarsImagesBlack[]; |
210 // TODO(chocobo): Add these back when we decide to do colored bars again. | 218 // TODO(chocobo): Add these back when we decide to do colored bars again. |
211 // static const int kBarsImagesLowData[]; | 219 // static const int kBarsImagesLowData[]; |
212 // static const int kBarsImagesVLowData[]; | 220 // static const int kBarsImagesVLowData[]; |
213 | 221 |
| 222 // The number of animating images for network connecting. |
| 223 static const int kNumAnimatingImages; |
| 224 // Animation images. These are created lazily. |
| 225 static SkBitmap kAnimatingImages[]; |
| 226 static SkBitmap kAnimatingImagesBlack[]; |
| 227 |
214 // Our menu items. | 228 // Our menu items. |
215 MenuItemVector menu_items_; | 229 MenuItemVector menu_items_; |
216 | 230 |
217 // The network menu. | 231 // The network menu. |
218 scoped_ptr<views::Menu2> network_menu_; | 232 scoped_ptr<views::Menu2> network_menu_; |
219 | 233 |
220 // Holds minimum width or -1 if it wasn't set up. | 234 // Holds minimum width or -1 if it wasn't set up. |
221 int min_width_; | 235 int min_width_; |
222 | 236 |
223 // If true, call into the settings UI for network configuration dialogs. | 237 // If true, call into the settings UI for network configuration dialogs. |
224 bool use_settings_ui_; | 238 bool use_settings_ui_; |
225 | 239 |
226 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); | 240 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); |
227 }; | 241 }; |
228 | 242 |
229 } // namespace chromeos | 243 } // namespace chromeos |
230 | 244 |
231 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 245 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
OLD | NEW |