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

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

Issue 4169001: Rewritten parts of NetworkLibrary to work around memory corruption that prev... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
Property Changes:
Added: svn:eol-style
+ LF
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"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/wifi_config_view_browsertest.cc ('k') | chrome/browser/chromeos/status/network_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698