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

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

Issue 3744009: chromium-os:5494 Networks with identical names not handled properly. (Closed)
Patch Set: Rebase from trunk. Created 10 years, 2 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 | « chrome/browser/chromeos/status/network_menu.cc ('k') | no next file » | 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/status/network_menu_button.h" 5 #include "chrome/browser/chromeos/status/network_menu_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 91 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
92 if (CrosLibrary::Get()->EnsureLoaded()) { 92 if (CrosLibrary::Get()->EnsureLoaded()) {
93 if (cros->wifi_connecting() || cros->cellular_connecting()) { 93 if (cros->wifi_connecting() || cros->cellular_connecting()) {
94 // Start the connecting animation if not running. 94 // Start the connecting animation if not running.
95 if (!animation_connecting_.is_animating()) { 95 if (!animation_connecting_.is_animating()) {
96 animation_connecting_.Reset(); 96 animation_connecting_.Reset();
97 animation_connecting_.StartThrobbing(std::numeric_limits<int>::max()); 97 animation_connecting_.StartThrobbing(std::numeric_limits<int>::max());
98 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS1)); 98 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS1));
99 } 99 }
100 std::string network_name = cros->wifi_connecting() ? 100 std::string network_name = cros->wifi_connecting() ?
101 cros->wifi_name() : cros->cellular_name(); 101 cros->wifi_network().name() : cros->cellular_network().name();
102 SetTooltipText( 102 SetTooltipText(
103 l10n_util::GetStringF(IDS_STATUSBAR_NETWORK_CONNECTING_TOOLTIP, 103 l10n_util::GetStringF(IDS_STATUSBAR_NETWORK_CONNECTING_TOOLTIP,
104 UTF8ToWide(network_name))); 104 UTF8ToWide(network_name)));
105 } else { 105 } else {
106 // Stop connecting animation since we are not connecting. 106 // Stop connecting animation since we are not connecting.
107 animation_connecting_.Stop(); 107 animation_connecting_.Stop();
108 108
109 // Always show the higher priority connection first. Ethernet then wifi. 109 // Always show the higher priority connection first. Ethernet then wifi.
110 if (cros->ethernet_connected()) { 110 if (cros->ethernet_connected()) {
111 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED)); 111 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED));
112 SetTooltipText( 112 SetTooltipText(
113 l10n_util::GetStringF( 113 l10n_util::GetStringF(
114 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP, 114 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP,
115 l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET))); 115 l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)));
116 } else if (cros->wifi_connected()) { 116 } else if (cros->wifi_connected()) {
117 SetIcon(IconForNetworkStrength(cros->wifi_strength(), false)); 117 SetIcon(IconForNetworkStrength(
118 cros->wifi_network().strength(), false));
118 SetTooltipText(l10n_util::GetStringF( 119 SetTooltipText(l10n_util::GetStringF(
119 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP, 120 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP,
120 UTF8ToWide(cros->wifi_name()))); 121 UTF8ToWide(cros->wifi_network().name())));
121 } else if (cros->cellular_connected()) { 122 } else if (cros->cellular_connected()) {
122 SetIcon(IconForNetworkStrength(cros->cellular_strength(), false)); 123 SetIcon(IconForNetworkStrength(
124 cros->cellular_network().strength(), false));
123 SetTooltipText(l10n_util::GetStringF( 125 SetTooltipText(l10n_util::GetStringF(
124 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP, 126 IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP,
125 UTF8ToWide(cros->cellular_name()))); 127 UTF8ToWide(cros->cellular_network().name())));
126 } else { 128 } else {
127 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0)); 129 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0));
128 SetTooltipText(l10n_util::GetString( 130 SetTooltipText(l10n_util::GetString(
129 IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP)); 131 IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP));
130 } 132 }
131 } 133 }
132 134
133 if (!cros->Connected() && !cros->Connecting()) { 135 if (!cros->Connected() && !cros->Connecting()) {
134 SetBadge(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED)); 136 SetBadge(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED));
135 } else if (!cros->ethernet_connected() && !cros->wifi_connected() && 137 } else if (!cros->ethernet_connected() && !cros->wifi_connected() &&
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 170
169 void NetworkMenuButton::OpenButtonOptions() const { 171 void NetworkMenuButton::OpenButtonOptions() const {
170 host_->OpenButtonOptions(this); 172 host_->OpenButtonOptions(this);
171 } 173 }
172 174
173 bool NetworkMenuButton::ShouldOpenButtonOptions() const { 175 bool NetworkMenuButton::ShouldOpenButtonOptions() const {
174 return host_->ShouldOpenButtonOptions(this); 176 return host_->ShouldOpenButtonOptions(this);
175 } 177 }
176 178
177 } // namespace chromeos 179 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/network_menu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698