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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc

Issue 6899025: Show hardware addresses for wifi and ethernet networks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: z Created 9 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/options/chromeos/internet_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 28 matching lines...) Expand all
39 #include "grit/generated_resources.h" 39 #include "grit/generated_resources.h"
40 #include "grit/locale_settings.h" 40 #include "grit/locale_settings.h"
41 #include "grit/theme_resources.h" 41 #include "grit/theme_resources.h"
42 #include "third_party/skia/include/core/SkBitmap.h" 42 #include "third_party/skia/include/core/SkBitmap.h"
43 #include "ui/base/l10n/l10n_util.h" 43 #include "ui/base/l10n/l10n_util.h"
44 #include "ui/base/resource/resource_bundle.h" 44 #include "ui/base/resource/resource_bundle.h"
45 #include "views/window/window.h" 45 #include "views/window/window.h"
46 46
47 static const char kOtherNetworksFakePath[] = "?"; 47 static const char kOtherNetworksFakePath[] = "?";
48 48
49 namespace {
50
51 // Format the hardware address like "0011AA22BB33" => "00:11:AA:22:BB:33".
52 std::string FormatHardwareAddress(const std::string& address) {
53 std::string output;
54 for (size_t i = 0; i < address.size(); ++i) {
55 if (i != 0 && i % 2 == 0) {
56 output.push_back(':');
57 }
58 output.push_back(toupper(address[i]));
59 }
60 return output;
61 }
62
63 } // namespace
64
65 InternetOptionsHandler::InternetOptionsHandler() 49 InternetOptionsHandler::InternetOptionsHandler()
66 : chromeos::CrosOptionsPageUIHandler( 50 : chromeos::CrosOptionsPageUIHandler(
67 new chromeos::UserCrosSettingsProvider), 51 new chromeos::UserCrosSettingsProvider),
68 use_settings_ui_(false) { 52 use_settings_ui_(false) {
69 registrar_.Add(this, NotificationType::REQUIRE_PIN_SETTING_CHANGE_ENDED, 53 registrar_.Add(this, NotificationType::REQUIRE_PIN_SETTING_CHANGE_ENDED,
70 NotificationService::AllSources()); 54 NotificationService::AllSources());
71 chromeos::NetworkLibrary* netlib = 55 chromeos::NetworkLibrary* netlib =
72 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 56 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
73 netlib->AddNetworkManagerObserver(this); 57 netlib->AddNetworkManagerObserver(this);
74 netlib->AddCellularDataPlanObserver(this); 58 netlib->AddCellularDataPlanObserver(this);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 bool auto_connect = auto_connect_str == "true"; 570 bool auto_connect = auto_connect_str == "true";
587 if (auto_connect != network->auto_connect()) 571 if (auto_connect != network->auto_connect())
588 network->SetAutoConnect(auto_connect); 572 network->SetAutoConnect(auto_connect);
589 } 573 }
590 574
591 void InternetOptionsHandler::PopulateDictionaryDetails( 575 void InternetOptionsHandler::PopulateDictionaryDetails(
592 const chromeos::Network* net, chromeos::NetworkLibrary* cros) { 576 const chromeos::Network* net, chromeos::NetworkLibrary* cros) {
593 DCHECK(net); 577 DCHECK(net);
594 DictionaryValue dictionary; 578 DictionaryValue dictionary;
595 std::string hardware_address; 579 std::string hardware_address;
596 chromeos::NetworkIPConfigVector ipconfigs = 580 chromeos::NetworkIPConfigVector ipconfigs = cros->GetIPConfigs(
597 cros->GetIPConfigs(net->device_path(), &hardware_address); 581 net->device_path(), &hardware_address,
598 if (!hardware_address.empty()) { 582 chromeos::NetworkLibrary::FORMAT_COLON_SEPARATED_HEX);
599 dictionary.SetString("hardwareAddress", 583 if (!hardware_address.empty())
600 FormatHardwareAddress(hardware_address)); 584 dictionary.SetString("hardwareAddress", hardware_address);
601 }
602 scoped_ptr<ListValue> ipconfig_list(new ListValue()); 585 scoped_ptr<ListValue> ipconfig_list(new ListValue());
603 for (chromeos::NetworkIPConfigVector::const_iterator it = ipconfigs.begin(); 586 for (chromeos::NetworkIPConfigVector::const_iterator it = ipconfigs.begin();
604 it != ipconfigs.end(); ++it) { 587 it != ipconfigs.end(); ++it) {
605 scoped_ptr<DictionaryValue> ipconfig_dict(new DictionaryValue()); 588 scoped_ptr<DictionaryValue> ipconfig_dict(new DictionaryValue());
606 const chromeos::NetworkIPConfig& ipconfig = *it; 589 const chromeos::NetworkIPConfig& ipconfig = *it;
607 ipconfig_dict->SetString("address", ipconfig.address); 590 ipconfig_dict->SetString("address", ipconfig.address);
608 ipconfig_dict->SetString("subnetAddress", ipconfig.netmask); 591 ipconfig_dict->SetString("subnetAddress", ipconfig.netmask);
609 ipconfig_dict->SetString("gateway", ipconfig.gateway); 592 ipconfig_dict->SetString("gateway", ipconfig.gateway);
610 ipconfig_dict->SetString("dns", ipconfig.name_servers); 593 ipconfig_dict->SetString("dns", ipconfig.name_servers);
611 ipconfig_list->Append(ipconfig_dict.release()); 594 ipconfig_list->Append(ipconfig_dict.release());
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 DictionaryValue* dictionary, chromeos::NetworkLibrary* cros) { 1169 DictionaryValue* dictionary, chromeos::NetworkLibrary* cros) {
1187 dictionary->SetBoolean("accessLocked", cros->IsLocked()); 1170 dictionary->SetBoolean("accessLocked", cros->IsLocked());
1188 dictionary->Set("wiredList", GetWiredList()); 1171 dictionary->Set("wiredList", GetWiredList());
1189 dictionary->Set("wirelessList", GetWirelessList()); 1172 dictionary->Set("wirelessList", GetWirelessList());
1190 dictionary->Set("rememberedList", GetRememberedList()); 1173 dictionary->Set("rememberedList", GetRememberedList());
1191 dictionary->SetBoolean("wifiAvailable", cros->wifi_available()); 1174 dictionary->SetBoolean("wifiAvailable", cros->wifi_available());
1192 dictionary->SetBoolean("wifiEnabled", cros->wifi_enabled()); 1175 dictionary->SetBoolean("wifiEnabled", cros->wifi_enabled());
1193 dictionary->SetBoolean("cellularAvailable", cros->cellular_available()); 1176 dictionary->SetBoolean("cellularAvailable", cros->cellular_available());
1194 dictionary->SetBoolean("cellularEnabled", cros->cellular_enabled()); 1177 dictionary->SetBoolean("cellularEnabled", cros->cellular_enabled());
1195 } 1178 }
OLDNEW
« chrome/app/generated_resources.grd ('K') | « chrome/browser/ui/views/about_ipc_dialog.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698