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

Side by Side Diff: chrome/browser/chromeos/options/internet_page_view.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
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/options/internet_page_view.h" 5 #include "chrome/browser/chromeos/options/internet_page_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/chromeos/cros/cros_library.h" 13 #include "chrome/browser/chromeos/cros/cros_library.h"
14 #include "chrome/browser/chromeos/options/network_config_view.h" 14 #include "chrome/browser/chromeos/options/network_config_view.h"
15 #include "chrome/browser/chromeos/options/options_window_view.h" 15 #include "chrome/browser/chromeos/options/options_window_view.h"
16 #include "chrome/browser/chromeos/status/network_menu_button.h" 16 #include "chrome/browser/chromeos/status/network_menu.h"
17 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
18 #include "grit/theme_resources.h" 18 #include "grit/theme_resources.h"
19 #include "views/controls/button/native_button.h" 19 #include "views/controls/button/native_button.h"
20 #include "views/controls/combobox/combobox.h" 20 #include "views/controls/combobox/combobox.h"
21 #include "views/controls/image_view.h" 21 #include "views/controls/image_view.h"
22 #include "views/controls/scroll_view.h" 22 #include "views/controls/scroll_view.h"
23 #include "views/widget/widget.h" 23 #include "views/widget/widget.h"
24 #include "views/window/window.h" 24 #include "views/window/window.h"
25 25
26 namespace chromeos { 26 namespace chromeos {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 : NetworkSection(parent, profile, 242 : NetworkSection(parent, profile,
243 IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIRED_NETWORK) { 243 IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIRED_NETWORK) {
244 } 244 }
245 245
246 void WiredSection::InitSection() { 246 void WiredSection::InitSection() {
247 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 247 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
248 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 248 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
249 249
250 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK); 250 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK);
251 if (!cros->ethernet_connecting() && !cros->ethernet_connected()) { 251 if (!cros->ethernet_connecting() && !cros->ethernet_connected()) {
252 icon = NetworkMenuButton::IconForDisplay(icon, 252 icon = NetworkMenu::IconForDisplay(icon,
253 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); 253 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED));
254 } 254 }
255 255
256 std::wstring name = 256 std::wstring name =
257 l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); 257 l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
258 258
259 int s = IDS_STATUSBAR_NETWORK_DEVICE_DISABLED; 259 int s = IDS_STATUSBAR_NETWORK_DEVICE_DISABLED;
260 if (cros->ethernet_connecting()) 260 if (cros->ethernet_connecting())
261 s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING; 261 s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING;
262 else if (cros->ethernet_connected()) 262 else if (cros->ethernet_connected())
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 void WirelessSection::InitSection() { 314 void WirelessSection::InitSection() {
315 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 315 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
316 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 316 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
317 317
318 // Wifi 318 // Wifi
319 wifi_networks_ = cros->wifi_networks(); 319 wifi_networks_ = cros->wifi_networks();
320 for (size_t i = 0; i < wifi_networks_.size(); ++i) { 320 for (size_t i = 0; i < wifi_networks_.size(); ++i) {
321 std::wstring name = ASCIIToWide(wifi_networks_[i].name()); 321 std::wstring name = ASCIIToWide(wifi_networks_[i].name());
322 322
323 SkBitmap icon = NetworkMenuButton::IconForNetworkStrength( 323 SkBitmap icon = NetworkMenu::IconForNetworkStrength(
324 wifi_networks_[i].strength(), true); 324 wifi_networks_[i].strength(), true);
325 if (wifi_networks_[i].encrypted()) { 325 if (wifi_networks_[i].encrypted()) {
326 icon = NetworkMenuButton::IconForDisplay(icon, 326 icon = NetworkMenu::IconForDisplay(icon,
327 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE)); 327 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
328 } 328 }
329 329
330 bool connecting = wifi_networks_[i].connecting(); 330 bool connecting = wifi_networks_[i].connecting();
331 bool connected = wifi_networks_[i].connected(); 331 bool connected = wifi_networks_[i].connected();
332 AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_WIFI); 332 AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_WIFI);
333 } 333 }
334 334
335 // Cellular 335 // Cellular
336 celluar_networks_ = cros->cellular_networks(); 336 celluar_networks_ = cros->cellular_networks();
337 // Cellular networks ssids. 337 // Cellular networks ssids.
338 for (size_t i = 0; i < celluar_networks_.size(); ++i) { 338 for (size_t i = 0; i < celluar_networks_.size(); ++i) {
339 std::wstring name = ASCIIToWide(celluar_networks_[i].name()); 339 std::wstring name = ASCIIToWide(celluar_networks_[i].name());
340 340
341 SkBitmap icon = NetworkMenuButton::IconForNetworkStrength( 341 SkBitmap icon = NetworkMenu::IconForNetworkStrength(
342 celluar_networks_[i].strength(), true); 342 celluar_networks_[i].strength(), true);
343 // TODO(chocobo): Check cellular network 3g/edge. 343 // TODO(chocobo): Check cellular network 3g/edge.
344 SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G); 344 SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G);
345 // SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_EDGE); 345 // SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_EDGE);
346 icon = NetworkMenuButton::IconForDisplay(icon, badge); 346 icon = NetworkMenu::IconForDisplay(icon, badge);
347 347
348 bool connecting = celluar_networks_[i].connecting(); 348 bool connecting = celluar_networks_[i].connecting();
349 bool connected = celluar_networks_[i].connected(); 349 bool connected = celluar_networks_[i].connected();
350 AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_CELLULAR); 350 AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_CELLULAR);
351 } 351 }
352 } 352 }
353 353
354 void WirelessSection::ButtonClicked(int button, int connection_type, int id) { 354 void WirelessSection::ButtonClicked(int button, int connection_type, int id) {
355 if (connection_type == TYPE_CELLULAR) { 355 if (connection_type == TYPE_CELLULAR) {
356 if (static_cast<int>(celluar_networks_.size()) > id) { 356 if (static_cast<int>(celluar_networks_.size()) > id) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 442 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
443 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 443 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
444 444
445 // Wifi 445 // Wifi
446 wifi_networks_ = cros->remembered_wifi_networks(); 446 wifi_networks_ = cros->remembered_wifi_networks();
447 for (size_t i = 0; i < wifi_networks_.size(); ++i) { 447 for (size_t i = 0; i < wifi_networks_.size(); ++i) {
448 std::wstring name = ASCIIToWide(wifi_networks_[i].name()); 448 std::wstring name = ASCIIToWide(wifi_networks_[i].name());
449 449
450 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0); 450 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0);
451 if (wifi_networks_[i].encrypted()) { 451 if (wifi_networks_[i].encrypted()) {
452 icon = NetworkMenuButton::IconForDisplay(icon, 452 icon = NetworkMenu::IconForDisplay(icon,
453 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE)); 453 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
454 } 454 }
455 455
456 AddNetwork(i, icon, name, false, std::wstring(), FORGET_BUTTON, TYPE_WIFI); 456 AddNetwork(i, icon, name, false, std::wstring(), FORGET_BUTTON, TYPE_WIFI);
457 } 457 }
458 458
459 // Cellular 459 // Cellular
460 celluar_networks_ = cros->remembered_cellular_networks(); 460 celluar_networks_ = cros->remembered_cellular_networks();
461 // Cellular networks ssids. 461 // Cellular networks ssids.
462 for (size_t i = 0; i < celluar_networks_.size(); ++i) { 462 for (size_t i = 0; i < celluar_networks_.size(); ++i) {
463 std::wstring name = ASCIIToWide(celluar_networks_[i].name()); 463 std::wstring name = ASCIIToWide(celluar_networks_[i].name());
464 464
465 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0); 465 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0);
466 // TODO(chocobo): Check cellular network 3g/edge. 466 // TODO(chocobo): Check cellular network 3g/edge.
467 SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G); 467 SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G);
468 // SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_EDGE); 468 // SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_EDGE);
469 icon = NetworkMenuButton::IconForDisplay(icon, badge); 469 icon = NetworkMenu::IconForDisplay(icon, badge);
470 470
471 AddNetwork(i, icon, name, false, std::wstring(), FORGET_BUTTON, 471 AddNetwork(i, icon, name, false, std::wstring(), FORGET_BUTTON,
472 TYPE_CELLULAR); 472 TYPE_CELLULAR);
473 } 473 }
474 } 474 }
475 475
476 void RememberedSection::ButtonClicked(int button, int connection_type, int id) { 476 void RememberedSection::ButtonClicked(int button, int connection_type, int id) {
477 if (connection_type == TYPE_CELLULAR) { 477 if (connection_type == TYPE_CELLULAR) {
478 if (static_cast<int>(celluar_networks_.size()) > id) { 478 if (static_cast<int>(celluar_networks_.size()) > id) {
479 CrosLibrary::Get()->GetNetworkLibrary()->ForgetWirelessNetwork( 479 CrosLibrary::Get()->GetNetworkLibrary()->ForgetWirelessNetwork(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 scroll_view_->SetBounds(GetLocalBounds(false)); 611 scroll_view_->SetBounds(GetLocalBounds(false));
612 scroll_view_->Layout(); 612 scroll_view_->Layout();
613 } 613 }
614 614
615 void InternetPageView::InitControlLayout() { 615 void InternetPageView::InitControlLayout() {
616 AddChildView(scroll_view_); 616 AddChildView(scroll_view_);
617 scroll_view_->SetContents(contents_view_); 617 scroll_view_->SetContents(contents_view_);
618 } 618 }
619 619
620 } // namespace chromeos 620 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698