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

Side by Side Diff: chrome/browser/chromeos/status/network_dropdown_button.cc

Issue 6156001: Remove wstring from l10n_util. Part 8, the last part.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 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/status/network_dropdown_button.h" 5 #include "chrome/browser/chromeos/status/network_dropdown_button.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
11 #include "chrome/browser/chromeos/options/network_config_view.h" 11 #include "chrome/browser/chromeos/options/network_config_view.h"
12 #include "chrome/browser/chromeos/status/status_area_host.h" 12 #include "chrome/browser/chromeos/status/status_area_host.h"
13 #include "gfx/canvas_skia.h" 13 #include "gfx/canvas_skia.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "grit/theme_resources.h" 15 #include "grit/theme_resources.h"
16 #include "views/window/window.h" 16 #include "views/window/window.h"
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 //////////////////////////////////////////////////////////////////////////////// 20 ////////////////////////////////////////////////////////////////////////////////
21 // NetworkDropdownButton 21 // NetworkDropdownButton
22 22
23 // static 23 // static
24 const int NetworkDropdownButton::kThrobDuration = 1000; 24 const int NetworkDropdownButton::kThrobDuration = 1000;
25 25
26 NetworkDropdownButton::NetworkDropdownButton(bool browser_mode, 26 NetworkDropdownButton::NetworkDropdownButton(bool browser_mode,
27 gfx::NativeWindow parent_window) 27 gfx::NativeWindow parent_window)
28 : DropDownButton(NULL, 28 : DropDownButton(NULL,
29 l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE), 29 UTF16ToWide(l10n_util::GetStringUTF16(
30 IDS_STATUSBAR_NO_NETWORKS_MESSAGE)),
30 this, 31 this,
31 true), 32 true),
32 browser_mode_(browser_mode), 33 browser_mode_(browser_mode),
33 ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)), 34 ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)),
34 parent_window_(parent_window) { 35 parent_window_(parent_window) {
35 animation_connecting_.SetThrobDuration(kThrobDuration); 36 animation_connecting_.SetThrobDuration(kThrobDuration);
36 animation_connecting_.SetTweenType(Tween::EASE_IN_OUT); 37 animation_connecting_.SetTweenType(Tween::EASE_IN_OUT);
37 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this); 38 CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this);
38 // The initial state will be updated on Refresh. 39 // The initial state will be updated on Refresh.
39 // See network_selection_view.cc. 40 // See network_selection_view.cc.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // in CrosMock::SetNetworkLibraryStatusAreaExpectations(). 73 // in CrosMock::SetNetworkLibraryStatusAreaExpectations().
73 74
74 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 75 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
75 if (CrosLibrary::Get()->EnsureLoaded()) { 76 if (CrosLibrary::Get()->EnsureLoaded()) {
76 // Always show the active network, if any 77 // Always show the active network, if any
77 const Network* active_network = cros->active_network(); 78 const Network* active_network = cros->active_network();
78 if (active_network != NULL) { 79 if (active_network != NULL) {
79 animation_connecting_.Stop(); 80 animation_connecting_.Stop();
80 if (active_network->type() == TYPE_ETHERNET) { 81 if (active_network->type() == TYPE_ETHERNET) {
81 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED)); 82 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED));
82 SetText(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); 83 SetText(UTF16ToWide(
84 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)));
83 } else if (active_network->type() == TYPE_WIFI) { 85 } else if (active_network->type() == TYPE_WIFI) {
84 const WifiNetwork* wifi = 86 const WifiNetwork* wifi =
85 static_cast<const WifiNetwork*>(active_network); 87 static_cast<const WifiNetwork*>(active_network);
86 SetIcon(IconForNetworkStrength(wifi, true)); 88 SetIcon(IconForNetworkStrength(wifi, true));
87 SetText(ASCIIToWide(wifi->name())); 89 SetText(ASCIIToWide(wifi->name()));
88 } else if (active_network->type() == TYPE_CELLULAR) { 90 } else if (active_network->type() == TYPE_CELLULAR) {
89 const CellularNetwork* cellular = 91 const CellularNetwork* cellular =
90 static_cast<const CellularNetwork*>(active_network); 92 static_cast<const CellularNetwork*>(active_network);
91 SetIcon(IconForNetworkStrength(cellular, true)); 93 SetIcon(IconForNetworkStrength(cellular, true));
92 SetText(ASCIIToWide(cellular->name())); 94 SetText(ASCIIToWide(cellular->name()));
93 } else { 95 } else {
94 NOTREACHED(); 96 NOTREACHED();
95 } 97 }
96 } else if (cros->wifi_connecting() || cros->cellular_connecting()) { 98 } else if (cros->wifi_connecting() || cros->cellular_connecting()) {
97 if (!animation_connecting_.is_animating()) { 99 if (!animation_connecting_.is_animating()) {
98 animation_connecting_.Reset(); 100 animation_connecting_.Reset();
99 animation_connecting_.StartThrobbing(-1); 101 animation_connecting_.StartThrobbing(-1);
100 SetIcon(IconForNetworkConnecting(0, true)); 102 SetIcon(IconForNetworkConnecting(0, true));
101 } 103 }
102 if (cros->wifi_connecting()) 104 if (cros->wifi_connecting())
103 SetText(ASCIIToWide(cros->wifi_network()->name())); 105 SetText(ASCIIToWide(cros->wifi_network()->name()));
104 else if (cros->cellular_connecting()) 106 else if (cros->cellular_connecting())
105 SetText(ASCIIToWide(cros->cellular_network()->name())); 107 SetText(ASCIIToWide(cros->cellular_network()->name()));
106 } 108 }
107 109
108 if (!cros->Connected() && !cros->Connecting()) { 110 if (!cros->Connected() && !cros->Connecting()) {
109 animation_connecting_.Stop(); 111 animation_connecting_.Stop();
110 SetIcon(SkBitmap()); 112 SetIcon(SkBitmap());
111 SetText(l10n_util::GetString(IDS_NETWORK_SELECTION_NONE)); 113 SetText(UTF16ToWide(
114 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_NONE)));
112 } 115 }
113 } else { 116 } else {
114 animation_connecting_.Stop(); 117 animation_connecting_.Stop();
115 SetIcon(SkBitmap()); 118 SetIcon(SkBitmap());
116 SetText(l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); 119 SetText(UTF16ToWide(
120 l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)));
117 } 121 }
118 122
119 SchedulePaint(); 123 SchedulePaint();
120 UpdateMenu(); 124 UpdateMenu();
121 } 125 }
122 126
123 } // namespace chromeos 127 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/wifi_config_view.cc ('k') | chrome/browser/chromeos/status/network_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698