OLD | NEW |
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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 79 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
80 if (CrosLibrary::Get()->EnsureLoaded()) { | 80 if (CrosLibrary::Get()->EnsureLoaded()) { |
81 // Always show the higher priority connection first. Ethernet then wifi. | 81 // Always show the higher priority connection first. Ethernet then wifi. |
82 if (cros->ethernet_connected()) { | 82 if (cros->ethernet_connected()) { |
83 animation_connecting_.Stop(); | 83 animation_connecting_.Stop(); |
84 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED)); | 84 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED)); |
85 SetText(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); | 85 SetText(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)); |
86 } else if (cros->wifi_connected()) { | 86 } else if (cros->wifi_connected()) { |
87 animation_connecting_.Stop(); | 87 animation_connecting_.Stop(); |
88 SetIcon(IconForNetworkStrength( | 88 SetIcon(IconForNetworkStrength( |
89 cros->wifi_network().strength(), true)); | 89 cros->wifi_network()->strength(), true)); |
90 SetText(ASCIIToWide(cros->wifi_network().name())); | 90 SetText(ASCIIToWide(cros->wifi_network()->name())); |
91 } else if (cros->cellular_connected()) { | 91 } else if (cros->cellular_connected()) { |
92 animation_connecting_.Stop(); | 92 animation_connecting_.Stop(); |
93 SetIcon(IconForNetworkStrength( | 93 SetIcon(IconForNetworkStrength( |
94 cros->cellular_network().strength(), false)); | 94 cros->cellular_network()->strength(), false)); |
95 SetText(ASCIIToWide(cros->cellular_network().name())); | 95 SetText(ASCIIToWide(cros->cellular_network()->name())); |
96 } else if (cros->wifi_connecting() || cros->cellular_connecting()) { | 96 } else if (cros->wifi_connecting() || cros->cellular_connecting()) { |
97 if (!animation_connecting_.is_animating()) { | 97 if (!animation_connecting_.is_animating()) { |
98 animation_connecting_.Reset(); | 98 animation_connecting_.Reset(); |
99 animation_connecting_.StartThrobbing(-1); | 99 animation_connecting_.StartThrobbing(-1); |
100 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS1_BLACK)); | 100 SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS1_BLACK)); |
101 } | 101 } |
102 | 102 |
103 if (cros->wifi_connecting()) | 103 if (cros->wifi_connecting()) |
104 SetText(ASCIIToWide(cros->wifi_network().name())); | 104 SetText(ASCIIToWide(cros->wifi_network()->name())); |
105 else if (cros->cellular_connecting()) | 105 else if (cros->cellular_connecting()) |
106 SetText(ASCIIToWide(cros->cellular_network().name())); | 106 SetText(ASCIIToWide(cros->cellular_network()->name())); |
107 } | 107 } |
108 | 108 |
109 if (!cros->Connected() && !cros->Connecting()) { | 109 if (!cros->Connected() && !cros->Connecting()) { |
110 animation_connecting_.Stop(); | 110 animation_connecting_.Stop(); |
111 SetIcon(SkBitmap()); | 111 SetIcon(SkBitmap()); |
112 SetText(l10n_util::GetString(IDS_NETWORK_SELECTION_NONE)); | 112 SetText(l10n_util::GetString(IDS_NETWORK_SELECTION_NONE)); |
113 } | 113 } |
114 } else { | 114 } else { |
115 animation_connecting_.Stop(); | 115 animation_connecting_.Stop(); |
116 SetIcon(SkBitmap()); | 116 SetIcon(SkBitmap()); |
117 SetText(l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); | 117 SetText(l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)); |
118 } | 118 } |
119 | 119 |
120 SchedulePaint(); | 120 SchedulePaint(); |
121 } | 121 } |
122 | 122 |
123 } // namespace chromeos | 123 } // namespace chromeos |
OLD | NEW |