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

Unified Diff: chrome/browser/chromeos/webui/internet_options_handler.cc

Issue 6591017: Cache network connecting bitmaps. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/webui/internet_options_handler.cc
===================================================================
--- chrome/browser/chromeos/webui/internet_options_handler.cc (revision 76240)
+++ chrome/browser/chromeos/webui/internet_options_handler.cc (working copy)
@@ -933,16 +933,14 @@
if (cros->ethernet_enabled()) {
const chromeos::EthernetNetwork* ethernet_network =
cros->ethernet_network();
- SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK);
- if (!ethernet_network || (!ethernet_network->connecting() &&
- !ethernet_network->connected())) {
- icon = chromeos::NetworkMenu::IconForDisplay(icon,
- *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED));
- }
+ SkBitmap* icon = rb.GetBitmapNamed(IDR_STATUSBAR_WIRED_BLACK);
stevenjb 2011/02/28 23:02:37 nit: const*
Charlie Lee 2011/02/28 23:54:13 Done.
+ SkBitmap* badge = !ethernet_network ||
stevenjb 2011/02/28 23:02:37 nit: const*
Charlie Lee 2011/02/28 23:54:13 Done.
+ (!ethernet_network->connecting() && !ethernet_network->connected()) ?
+ rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED) : NULL;
if (ethernet_network) {
list->Append(GetNetwork(
ethernet_network->service_path(),
- icon,
+ chromeos::NetworkMenu::IconForDisplay(icon, badge),
l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET),
ethernet_network->connecting(),
ethernet_network->connected(),
@@ -965,14 +963,13 @@
const chromeos::WifiNetworkVector& wifi_networks = cros->wifi_networks();
for (chromeos::WifiNetworkVector::const_iterator it =
wifi_networks.begin(); it != wifi_networks.end(); ++it) {
- SkBitmap icon = chromeos::NetworkMenu::IconForNetworkStrength(*it, true);
- if ((*it)->encrypted()) {
- icon = chromeos::NetworkMenu::IconForDisplay(icon,
- *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
- }
+ const SkBitmap* icon =
+ chromeos::NetworkMenu::IconForNetworkStrength(*it, true);
+ const SkBitmap* badge = (*it)->encrypted() ?
+ rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE) : NULL;
list->Append(GetNetwork(
(*it)->service_path(),
- icon,
+ chromeos::NetworkMenu::IconForDisplay(icon, badge),
(*it)->name(),
(*it)->connecting(),
(*it)->connected(),
@@ -987,12 +984,13 @@
cros->cellular_networks();
for (chromeos::CellularNetworkVector::const_iterator it =
cellular_networks.begin(); it != cellular_networks.end(); ++it) {
- SkBitmap icon = chromeos::NetworkMenu::IconForNetworkStrength(*it, true);
- SkBitmap badge = chromeos::NetworkMenu::BadgeForNetworkTechnology(*it);
- icon = chromeos::NetworkMenu::IconForDisplay(icon, badge);
+ const SkBitmap* icon =
+ chromeos::NetworkMenu::IconForNetworkStrength(*it, true);
+ const SkBitmap* badge =
+ chromeos::NetworkMenu::BadgeForNetworkTechnology(*it);
list->Append(GetNetwork(
(*it)->service_path(),
- icon,
+ chromeos::NetworkMenu::IconForDisplay(icon, badge),
(*it)->name(),
(*it)->connecting(),
(*it)->connected(),
@@ -1058,21 +1056,17 @@
// Don't show the active network in the remembered list.
if (found && (it->second)->connected())
continue;
- SkBitmap icon;
- if (found)
- icon = chromeos::NetworkMenu::IconForNetworkStrength(it->second, true);
- else
- icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0_BLACK);
+ const SkBitmap* icon = found ?
+ chromeos::NetworkMenu::IconForNetworkStrength(it->second, true) :
+ rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0_BLACK);
// Place the secure badge on the icon if the remembered network is
// encrypted (the matching detected network, if any, will have the same
// encrypted property by definition).
- if (wifi->encrypted()) {
- icon = chromeos::NetworkMenu::IconForDisplay(icon,
- *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
- }
+ const SkBitmap* badge = wifi->encrypted() ?
+ rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE) : NULL;
list->Append(GetNetwork(
wifi->service_path(),
- icon,
+ chromeos::NetworkMenu::IconForDisplay(icon, badge),
wifi->name(),
wifi->connecting(),
wifi->connected(),

Powered by Google App Engine
This is Rietveld 408576698