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

Side by Side Diff: chrome/browser/chromeos/dom_ui/internet_options_handler.cc

Issue 3166028: Replace network combobox with network dropdown button (Closed)
Patch Set: Removed trailing spaces Created 10 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/network_screen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/chromeos/dom_ui/internet_options_handler.h" 5 #include "chrome/browser/chromeos/dom_ui/internet_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "app/resource_bundle.h" 11 #include "app/resource_bundle.h"
12 #include "base/base64.h" 12 #include "base/base64.h"
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/browser.h" 17 #include "chrome/browser/browser.h"
18 #include "chrome/browser/browser_list.h" 18 #include "chrome/browser/browser_list.h"
19 #include "chrome/browser/browser_window.h" 19 #include "chrome/browser/browser_window.h"
20 #include "chrome/browser/chromeos/cros/cros_library.h" 20 #include "chrome/browser/chromeos/cros/cros_library.h"
21 #include "chrome/browser/chromeos/status/network_menu_button.h" 21 #include "chrome/browser/chromeos/status/network_menu.h"
22 #include "chrome/browser/tab_contents/tab_contents.h" 22 #include "chrome/browser/tab_contents/tab_contents.h"
23 #include "chrome/browser/tab_contents/tab_contents_view.h" 23 #include "chrome/browser/tab_contents/tab_contents_view.h"
24 #include "chrome/common/notification_service.h" 24 #include "chrome/common/notification_service.h"
25 #include "gfx/codec/png_codec.h" 25 #include "gfx/codec/png_codec.h"
26 #include "grit/browser_resources.h" 26 #include "grit/browser_resources.h"
27 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
28 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
29 #include "grit/locale_settings.h" 29 #include "grit/locale_settings.h"
30 #include "grit/theme_resources.h" 30 #include "grit/theme_resources.h"
31 #include "third_party/skia/include/core/SkBitmap.h" 31 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 220 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
221 ListValue* list = new ListValue(); 221 ListValue* list = new ListValue();
222 222
223 // If ethernet is not enabled, then don't add anything. 223 // If ethernet is not enabled, then don't add anything.
224 if (cros->ethernet_enabled()) { 224 if (cros->ethernet_enabled()) {
225 const chromeos::EthernetNetwork& ethernet_network = 225 const chromeos::EthernetNetwork& ethernet_network =
226 cros->ethernet_network(); 226 cros->ethernet_network();
227 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK); 227 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK);
228 if (!ethernet_network.connecting() && 228 if (!ethernet_network.connecting() &&
229 !ethernet_network.connected()) { 229 !ethernet_network.connected()) {
230 icon = chromeos::NetworkMenuButton::IconForDisplay(icon, 230 icon = chromeos::NetworkMenu::IconForDisplay(icon,
231 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); 231 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED));
232 } 232 }
233 list->Append(GetNetwork( 233 list->Append(GetNetwork(
234 ethernet_network.service_path(), 234 ethernet_network.service_path(),
235 icon, 235 icon,
236 l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET), 236 l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET),
237 ethernet_network.connecting(), 237 ethernet_network.connecting(),
238 ethernet_network.connected(), 238 ethernet_network.connected(),
239 chromeos::TYPE_ETHERNET, 239 chromeos::TYPE_ETHERNET,
240 false)); 240 false));
241 } 241 }
242 return list; 242 return list;
243 } 243 }
244 244
245 ListValue* InternetOptionsHandler::GetWirelessList() { 245 ListValue* InternetOptionsHandler::GetWirelessList() {
246 chromeos::NetworkLibrary* cros = 246 chromeos::NetworkLibrary* cros =
247 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 247 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
248 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 248 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
249 ListValue* list = new ListValue(); 249 ListValue* list = new ListValue();
250 250
251 const chromeos::WifiNetworkVector& wifi_networks = cros->wifi_networks(); 251 const chromeos::WifiNetworkVector& wifi_networks = cros->wifi_networks();
252 for (chromeos::WifiNetworkVector::const_iterator it = 252 for (chromeos::WifiNetworkVector::const_iterator it =
253 wifi_networks.begin(); it != wifi_networks.end(); ++it) { 253 wifi_networks.begin(); it != wifi_networks.end(); ++it) {
254 SkBitmap icon = chromeos::NetworkMenuButton::IconForNetworkStrength( 254 SkBitmap icon = chromeos::NetworkMenu::IconForNetworkStrength(
255 it->strength(), true); 255 it->strength(), true);
256 if (it->encrypted()) { 256 if (it->encrypted()) {
257 icon = chromeos::NetworkMenuButton::IconForDisplay(icon, 257 icon = chromeos::NetworkMenu::IconForDisplay(icon,
258 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE)); 258 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
259 } 259 }
260 list->Append(GetNetwork( 260 list->Append(GetNetwork(
261 it->service_path(), 261 it->service_path(),
262 icon, 262 icon,
263 it->name(), 263 it->name(),
264 it->connecting(), 264 it->connecting(),
265 it->connected(), 265 it->connected(),
266 chromeos::TYPE_WIFI, 266 chromeos::TYPE_WIFI,
267 false)); 267 false));
268 } 268 }
269 269
270 const chromeos::CellularNetworkVector& cellular_networks = 270 const chromeos::CellularNetworkVector& cellular_networks =
271 cros->cellular_networks(); 271 cros->cellular_networks();
272 for (chromeos::CellularNetworkVector::const_iterator it = 272 for (chromeos::CellularNetworkVector::const_iterator it =
273 cellular_networks.begin(); it != cellular_networks.end(); ++it) { 273 cellular_networks.begin(); it != cellular_networks.end(); ++it) {
274 SkBitmap icon = chromeos::NetworkMenuButton::IconForNetworkStrength( 274 SkBitmap icon = chromeos::NetworkMenu::IconForNetworkStrength(
275 it->strength(), true); 275 it->strength(), true);
276 SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G); 276 SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G);
277 icon = chromeos::NetworkMenuButton::IconForDisplay(icon, badge); 277 icon = chromeos::NetworkMenu::IconForDisplay(icon, badge);
278 list->Append(GetNetwork( 278 list->Append(GetNetwork(
279 it->service_path(), 279 it->service_path(),
280 icon, 280 icon,
281 it->name(), 281 it->name(),
282 it->connecting(), 282 it->connecting(),
283 it->connected(), 283 it->connected(),
284 chromeos::TYPE_CELLULAR, 284 chromeos::TYPE_CELLULAR,
285 false)); 285 false));
286 } 286 }
287 287
(...skipping 17 matching lines...) Expand all
305 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 305 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
306 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 306 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
307 ListValue* list = new ListValue(); 307 ListValue* list = new ListValue();
308 308
309 const chromeos::WifiNetworkVector& wifi_networks = 309 const chromeos::WifiNetworkVector& wifi_networks =
310 cros->remembered_wifi_networks(); 310 cros->remembered_wifi_networks();
311 for (chromeos::WifiNetworkVector::const_iterator it = 311 for (chromeos::WifiNetworkVector::const_iterator it =
312 wifi_networks.begin(); it != wifi_networks.end(); ++it) { 312 wifi_networks.begin(); it != wifi_networks.end(); ++it) {
313 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0); 313 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0);
314 if (it->encrypted()) { 314 if (it->encrypted()) {
315 icon = chromeos::NetworkMenuButton::IconForDisplay(icon, 315 icon = chromeos::NetworkMenu::IconForDisplay(icon,
316 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE)); 316 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
317 } 317 }
318 list->Append(GetNetwork( 318 list->Append(GetNetwork(
319 it->service_path(), 319 it->service_path(),
320 icon, 320 icon,
321 it->name(), 321 it->name(),
322 it->connecting(), 322 it->connecting(),
323 it->connected(), 323 it->connected(),
324 chromeos::TYPE_WIFI, 324 chromeos::TYPE_WIFI,
325 true)); 325 true));
326 } 326 }
327 327
328 const chromeos::CellularNetworkVector& cellular_networks = 328 const chromeos::CellularNetworkVector& cellular_networks =
329 cros->remembered_cellular_networks(); 329 cros->remembered_cellular_networks();
330 for (chromeos::CellularNetworkVector::const_iterator it = 330 for (chromeos::CellularNetworkVector::const_iterator it =
331 cellular_networks.begin(); it != cellular_networks.end(); ++it) { 331 cellular_networks.begin(); it != cellular_networks.end(); ++it) {
332 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0); 332 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0);
333 SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G); 333 SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G);
334 icon = chromeos::NetworkMenuButton::IconForDisplay(icon, badge); 334 icon = chromeos::NetworkMenu::IconForDisplay(icon, badge);
335 list->Append(GetNetwork( 335 list->Append(GetNetwork(
336 it->service_path(), 336 it->service_path(),
337 icon, 337 icon,
338 it->name(), 338 it->name(),
339 it->connecting(), 339 it->connecting(),
340 it->connected(), 340 it->connected(),
341 chromeos::TYPE_CELLULAR, 341 chromeos::TYPE_CELLULAR,
342 true)); 342 true));
343 } 343 }
344 344
345 return list; 345 return list;
346 } 346 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/network_screen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698