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