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

Side by Side Diff: chrome/browser/chromeos/dom_ui/internet_options_handler.cc

Issue 6343004: Use signal strength of detected networks when displaying remembered networks. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
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
« no previous file with comments | « no previous file | 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/dom_ui/internet_options_handler.h" 5 #include "chrome/browser/chromeos/dom_ui/internet_options_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 } 997 }
998 998
999 ListValue* InternetOptionsHandler::GetRememberedList() { 999 ListValue* InternetOptionsHandler::GetRememberedList() {
1000 chromeos::NetworkLibrary* cros = 1000 chromeos::NetworkLibrary* cros =
1001 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 1001 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
1002 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 1002 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
1003 ListValue* list = new ListValue(); 1003 ListValue* list = new ListValue();
1004 1004
1005 const chromeos::WifiNetworkVector& wifi_networks = 1005 const chromeos::WifiNetworkVector& wifi_networks =
1006 cros->remembered_wifi_networks(); 1006 cros->remembered_wifi_networks();
1007 const chromeos::WifiNetworkVector& live_wifi_networks =
1008 cros->wifi_networks();
stevenjb 2011/01/21 17:11:18 Since we don't use "live_wifi_networks" elsewhere
1009
1007 for (chromeos::WifiNetworkVector::const_iterator it = 1010 for (chromeos::WifiNetworkVector::const_iterator it =
1008 wifi_networks.begin(); it != wifi_networks.end(); ++it) { 1011 wifi_networks.begin(); it != wifi_networks.end(); ++it) {
Charlie Lee 2011/01/21 19:21:09 I would recommend instead of doing this in a doubl
1009 SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0_BLACK); 1012 // The remembered networks from libcros/flimflam don't include the signal
1013 // strength. So, if this remembered network has the same name (SSID) as a
1014 // live one, use the live one's signal strength.
1015 chromeos::WifiNetworkVector::const_iterator lit =
1016 live_wifi_networks.begin();
1017 for ( ; lit != live_wifi_networks.end(); ++lit) {
1018 if ((*it)->name() == (*lit)->name())
1019 break;
stevenjb 2011/01/21 17:11:18 Need to compare both name() and encryption(). We s
1020 }
1021 // Don't show active network in the remembered list.
1022 if (lit != live_wifi_networks.end() && (*lit)->connected())
1023 continue;
1024 SkBitmap icon;
1025 if (lit == live_wifi_networks.end())
1026 icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0_BLACK);
1027 else
1028 icon = chromeos::NetworkMenu::IconForNetworkStrength(*lit, true);
1010 if ((*it)->encrypted()) { 1029 if ((*it)->encrypted()) {
1011 icon = chromeos::NetworkMenu::IconForDisplay(icon, 1030 icon = chromeos::NetworkMenu::IconForDisplay(icon,
1012 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE)); 1031 *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
stevenjb 2011/01/21 17:11:18 Does the secure icon trump the signal strength ico
Charlie Lee 2011/01/21 19:21:09 Isn't the secure icon just a badge? If so, then we
1013 } 1032 }
1014 list->Append(GetNetwork( 1033 list->Append(GetNetwork(
1015 (*it)->service_path(), 1034 (*it)->service_path(),
1016 icon, 1035 icon,
1017 (*it)->name(), 1036 (*it)->name(),
1018 (*it)->connecting(), 1037 (*it)->connecting(),
1019 (*it)->connected(), 1038 (*it)->connected(),
1020 true, 1039 true,
1021 chromeos::TYPE_WIFI, 1040 chromeos::TYPE_WIFI,
1022 true, 1041 true,
1023 chromeos::ACTIVATION_STATE_UNKNOWN, 1042 chromeos::ACTIVATION_STATE_UNKNOWN,
1024 false)); 1043 false));
1025 } 1044 }
1026 return list; 1045 return list;
1027 } 1046 }
1028 1047
1029 void InternetOptionsHandler::FillNetworkInfo( 1048 void InternetOptionsHandler::FillNetworkInfo(
1030 DictionaryValue* dictionary, chromeos::NetworkLibrary* cros) { 1049 DictionaryValue* dictionary, chromeos::NetworkLibrary* cros) {
1031 dictionary->Set("wiredList", GetWiredList()); 1050 dictionary->Set("wiredList", GetWiredList());
1032 dictionary->Set("wirelessList", GetWirelessList()); 1051 dictionary->Set("wirelessList", GetWirelessList());
1033 dictionary->Set("rememberedList", GetRememberedList()); 1052 dictionary->Set("rememberedList", GetRememberedList());
1034 dictionary->SetBoolean("wifiAvailable", cros->wifi_available()); 1053 dictionary->SetBoolean("wifiAvailable", cros->wifi_available());
1035 dictionary->SetBoolean("wifiEnabled", cros->wifi_enabled()); 1054 dictionary->SetBoolean("wifiEnabled", cros->wifi_enabled());
1036 dictionary->SetBoolean("cellularAvailable", cros->cellular_available()); 1055 dictionary->SetBoolean("cellularAvailable", cros->cellular_available());
1037 dictionary->SetBoolean("cellularEnabled", cros->cellular_enabled()); 1056 dictionary->SetBoolean("cellularEnabled", cros->cellular_enabled());
1038 } 1057 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698