summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/system/chromeos/network/network_connect.cc6
-rw-r--r--chrome/browser/automation/testing_automation_provider_chromeos.cc2
-rw-r--r--chrome/browser/chromeos/mobile/mobile_activator.cc44
-rw-r--r--chrome/browser/chromeos/mobile/mobile_activator.h9
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc8
-rw-r--r--chrome/browser/resources/chromeos/network.html6
-rw-r--r--chrome/browser/resources/chromeos/network.js14
-rw-r--r--chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc217
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc10
-rw-r--r--chrome/test/data/extensions/api_test/networking/test.js8
-rw-r--r--chromeos/network/network_state.cc46
-rw-r--r--chromeos/network/network_state.h53
12 files changed, 266 insertions, 157 deletions
diff --git a/ash/system/chromeos/network/network_connect.cc b/ash/system/chromeos/network/network_connect.cc
index 3002856..709b972 100644
--- a/ash/system/chromeos/network/network_connect.cc
+++ b/ash/system/chromeos/network/network_connect.cc
@@ -350,10 +350,8 @@ void ActivateCellular(const std::string& service_path) {
}
if (!IsDirectActivatedCarrier(cellular_device->carrier())) {
// For non direct activation, show the mobile setup dialog which can be
- // used to activate the network. Only show the dialog, if an account
- // management URL is available.
- if (!cellular->payment_url().empty())
- ShowMobileSetup(service_path);
+ // used to activate the network.
+ ShowMobileSetup(service_path);
return;
}
if (cellular->activation_state() == flimflam::kActivationStateActivated) {
diff --git a/chrome/browser/automation/testing_automation_provider_chromeos.cc b/chrome/browser/automation/testing_automation_provider_chromeos.cc
index 38f2e42..11d6c0c 100644
--- a/chrome/browser/automation/testing_automation_provider_chromeos.cc
+++ b/chrome/browser/automation/testing_automation_provider_chromeos.cc
@@ -564,8 +564,6 @@ void TestingAutomationProvider::GetNetworkInfo(DictionaryValue* args,
item->SetInteger("strength", cellular_networks[i]->strength());
item->SetString("operator_name", cellular_networks[i]->operator_name());
item->SetString("operator_code", cellular_networks[i]->operator_code());
- item->SetString("payment_url", cellular_networks[i]->payment_url());
- item->SetString("usage_url", cellular_networks[i]->usage_url());
item->SetString("network_technology",
cellular_networks[i]->GetNetworkTechnologyString());
item->SetString("activation_state",
diff --git a/chrome/browser/chromeos/mobile/mobile_activator.cc b/chrome/browser/chromeos/mobile/mobile_activator.cc
index 9475e6e..c0781b9 100644
--- a/chrome/browser/chromeos/mobile/mobile_activator.cc
+++ b/chrome/browser/chromeos/mobile/mobile_activator.cc
@@ -165,7 +165,8 @@ MobileActivator::MobileActivator()
initial_OTASP_attempts_(0),
trying_OTASP_attempts_(0),
final_OTASP_attempts_(0),
- payment_reconnect_count_(0) {
+ payment_reconnect_count_(0),
+ weak_ptr_factory_(this) {
}
MobileActivator::~MobileActivator() {
@@ -268,9 +269,35 @@ void MobileActivator::InitiateActivation(const std::string& service_path) {
}
void MobileActivator::ContinueActivation() {
- const NetworkState* network = GetNetworkState(service_path_);
- if (!network ||
- (network->payment_url().empty() && network->usage_url().empty()))
+ NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ service_path_,
+ base::Bind(&MobileActivator::GetPropertiesAndContinueActivation,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::Bind(&MobileActivator::GetPropertiesFailure,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void MobileActivator::GetPropertiesAndContinueActivation(
+ const std::string& service_path,
+ const base::DictionaryValue& properties) {
+ if (service_path != service_path_) {
+ NET_LOG_EVENT("MobileActivator::GetProperties received for stale network",
+ service_path);
+ return; // Edge case; abort.
+ }
+ const DictionaryValue* payment_dict;
+ std::string usage_url, payment_url;
+ if (!properties.GetStringWithoutPathExpansion(
+ flimflam::kUsageURLProperty, &usage_url) ||
+ !properties.GetDictionaryWithoutPathExpansion(
+ flimflam::kPaymentPortalProperty, &payment_dict) ||
+ !payment_dict->GetStringWithoutPathExpansion(
+ flimflam::kPaymentPortalURL, &payment_url)) {
+ NET_LOG_ERROR("MobileActivator missing properties", service_path_);
+ return;
+ }
+
+ if (payment_url.empty() && usage_url.empty())
return;
DisableCertRevocationChecking();
@@ -279,13 +306,20 @@ void MobileActivator::ContinueActivation() {
DictionaryValue auto_connect_property;
auto_connect_property.SetBoolean(flimflam::kAutoConnectProperty, true);
NetworkHandler::Get()->network_configuration_handler()->SetProperties(
- network->path(),
+ service_path_,
auto_connect_property,
base::Bind(&base::DoNothing),
network_handler::ErrorCallback());
StartActivation();
}
+void MobileActivator::GetPropertiesFailure(
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data) {
+ NET_LOG_ERROR("MobileActivator GetProperties Failed: " + error_name,
+ service_path_);
+}
+
void MobileActivator::OnSetTransactionStatus(bool success) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&MobileActivator::HandleSetTransactionStatus,
diff --git a/chrome/browser/chromeos/mobile/mobile_activator.h b/chrome/browser/chromeos/mobile/mobile_activator.h
index 19bf158..2e86bf4d 100644
--- a/chrome/browser/chromeos/mobile/mobile_activator.h
+++ b/chrome/browser/chromeos/mobile/mobile_activator.h
@@ -144,8 +144,14 @@ class MobileActivator
virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE;
virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE;
- // Continue activation after inital setup (config load).
+ // Continue activation after inital setup (config load). Makes an
+ // asynchronous call to NetworkConfigurationHandler::GetProperties.
void ContinueActivation();
+ void GetPropertiesAndContinueActivation(
+ const std::string& service_path,
+ const base::DictionaryValue& properties);
+ void GetPropertiesFailure(const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data);
// Handles the signal that the payment portal has finished loading.
void HandlePortalLoaded(bool success);
// Handles the signal that the user has finished with the portal.
@@ -289,6 +295,7 @@ class MobileActivator
base::Time cellular_plan_payment_time_;
ObserverList<Observer> observers_;
+ base::WeakPtrFactory<MobileActivator> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(MobileActivator);
};
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
index d7a4884..f50af50 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
@@ -160,7 +160,6 @@ bool NetworkingPrivateGetStateFunction::RunImpl() {
" \"Name\": \"wifi2_PSK\","
" \"Type\": \"WiFi\","
" \"WiFi\": {"
- " \"AutoConnect\": false,"
" \"Security\": \"WPA-PSK\","
" \"SignalStrength\": 80"
" }"
@@ -241,7 +240,6 @@ bool NetworkingPrivateGetVisibleNetworksFunction::RunImpl() {
" \"Name\": \"wifi1\","
" \"Type\": \"WiFi\","
" \"WiFi\": {"
- " \"AutoConnect\": false,"
" \"Security\": \"WEP-PSK\","
" \"SignalStrength\": 0"
" }"
@@ -250,10 +248,7 @@ bool NetworkingPrivateGetVisibleNetworksFunction::RunImpl() {
" \"ConnectionState\": \"Connected\","
" \"GUID\": \"stub_vpn1\","
" \"Name\": \"vpn1\","
- " \"Type\": \"VPN\","
- " \"VPN\": {"
- " \"AutoConnect\": false"
- " }"
+ " \"Type\": \"VPN\""
" },"
" {"
" \"ConnectionState\": \"NotConnected\","
@@ -261,7 +256,6 @@ bool NetworkingPrivateGetVisibleNetworksFunction::RunImpl() {
" \"Name\": \"wifi2_PSK\","
" \"Type\": \"WiFi\","
" \"WiFi\": {"
- " \"AutoConnect\": false,"
" \"Security\": \"WPA-PSK\","
" \"SignalStrength\": 80"
" }"
diff --git a/chrome/browser/resources/chromeos/network.html b/chrome/browser/resources/chromeos/network.html
index cfcb7c3..1e9b11b 100644
--- a/chrome/browser/resources/chromeos/network.html
+++ b/chrome/browser/resources/chromeos/network.html
@@ -31,6 +31,8 @@
<h3>Networks: </h3>
<table id="network-status-table">
<tr class="network-status-table-header">
+ <td>Path</td>
+ <td>GUID</td>
<td>Name</td>
<td>Type</td>
<td>Status</td>
@@ -44,10 +46,6 @@
<td>Roaming</td>
<td>OOC</td>
<td>Strength</td>
- <td>Auto</td>
- <td>Fav</td>
- <td>Pri</td>
- <td>Path</td>
</tr>
</table>
<script src="chrome://resources/js/i18n_template2.js"></script>
diff --git a/chrome/browser/resources/chromeos/network.js b/chrome/browser/resources/chromeos/network.js
index 9c55d57..49abd050 100644
--- a/chrome/browser/resources/chromeos/network.js
+++ b/chrome/browser/resources/chromeos/network.js
@@ -4,11 +4,12 @@
var NetworkUI = function() {
// Properties to display in the network state table
- var NETWORK_STATE_FIELDS = ['Name', 'Type', 'State', 'Profile', 'Connectable',
- 'Error', 'ADdress', 'Security', 'Cellular.NetworkTechnology',
- 'Cellular.ActivationState', 'Cellular.RoamingState',
- 'Cellular.OutOfCredits', 'signalStrength', 'AutoConnect',
- 'Favorite', 'Priority'];
+ var NETWORK_STATE_FIELDS = [
+ 'Name', 'Type', 'State', 'Profile', 'Connectable',
+ 'Error', 'Address', 'Security', 'Cellular.NetworkTechnology',
+ 'Cellular.ActivationState', 'Cellular.RoamingState',
+ 'Cellular.OutOfCredits', 'Strength'
+ ];
var LOG_LEVEL_CLASSNAME = {
'Error': 'network-log-level-error',
@@ -104,10 +105,11 @@ var NetworkUI = function() {
var createStatusTableRow = function(path, status) {
var row = document.createElement('tr');
row.className = 'network-status-table-row';
+ row.appendChild(createStatusTableCell(path));
+ row.appendChild(createStatusTableCell(status['GUID'].slice(1, 9)));
for (var i = 0; i < NETWORK_STATE_FIELDS.length; ++i) {
row.appendChild(createStatusTableCell(status[NETWORK_STATE_FIELDS[i]]));
}
- row.appendChild(createStatusTableCell(path));
return row;
};
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
index c34c8fa..2671fd2 100644
--- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
@@ -13,6 +13,7 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ref_counted_memory.h"
+#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_piece.h"
@@ -26,6 +27,8 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "chromeos/network/device_state.h"
+#include "chromeos/network/network_configuration_handler.h"
+#include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_state_handler_observer.h"
@@ -74,6 +77,60 @@ const char kJsGetDeviceInfoCallback[] =
const char kJsConnectivityChangedCallback[] =
"mobile.MobileSetupPortal.onConnectivityChanged";
+void DataRequestFailed(
+ const std::string& service_path,
+ const content::URLDataSource::GotDataCallback& callback) {
+ NET_LOG_ERROR("Data Request Failed for Mobile Setup", service_path);
+ scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes);
+ callback.Run(html_bytes.get());
+}
+
+// Converts the network properties into a JS object.
+void GetDeviceInfo(const DictionaryValue& properties, DictionaryValue* value) {
+ std::string name;
+ properties.GetStringWithoutPathExpansion(
+ flimflam::kNameProperty, &name);
+ bool activate_over_non_cellular_networks = false;
+ properties.GetBooleanWithoutPathExpansion(
+ shill::kActivateOverNonCellularNetworkProperty,
+ &activate_over_non_cellular_networks);
+ const DictionaryValue* payment_dict;
+ std::string payment_url, post_method, post_data;
+ if (properties.GetDictionaryWithoutPathExpansion(
+ flimflam::kPaymentPortalProperty, &payment_dict)) {
+ payment_dict->GetStringWithoutPathExpansion(
+ flimflam::kPaymentPortalURL, &payment_url);
+ payment_dict->GetStringWithoutPathExpansion(
+ flimflam::kPaymentPortalMethod, &post_method);
+ payment_dict->GetStringWithoutPathExpansion(
+ flimflam::kPaymentPortalPostData, &post_data);
+ }
+
+ value->SetBoolean("activate_over_non_cellular_network",
+ activate_over_non_cellular_networks);
+ value->SetString("carrier", name);
+ value->SetString("payment_url", payment_url);
+ if (LowerCaseEqualsASCII(post_method, "post") && !post_data.empty())
+ value->SetString("post_data", post_data);
+
+ // Use the cached DeviceState properties.
+ std::string device_path;
+ if (!properties.GetStringWithoutPathExpansion(
+ flimflam::kDeviceProperty, &device_path) ||
+ device_path.empty()) {
+ return;
+ }
+ const chromeos::DeviceState* device =
+ NetworkHandler::Get()->network_state_handler()->GetDeviceState(
+ device_path);
+ if (!device)
+ return;
+
+ value->SetString("MEID", device->meid());
+ value->SetString("IMEI", device->imei());
+ value->SetString("MDN", device->mdn());
+}
+
} // namespace
// Observes IPC messages from the rederer and notifies JS if frame loading error
@@ -142,6 +199,18 @@ class MobileSetupUIHTMLSource : public content::URLDataSource {
private:
virtual ~MobileSetupUIHTMLSource() {}
+ void GetPropertiesAndStartDataRequest(
+ const content::URLDataSource::GotDataCallback& callback,
+ const std::string& service_path,
+ const base::DictionaryValue& properties);
+ void GetPropertiesFailure(
+ const content::URLDataSource::GotDataCallback& callback,
+ const std::string& service_path,
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data);
+
+ base::WeakPtrFactory<MobileSetupUIHTMLSource> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(MobileSetupUIHTMLSource);
};
@@ -177,6 +246,21 @@ class MobileSetupHandler
MobileActivator::PlanActivationState new_state,
const std::string& error_description) OVERRIDE;
+ // Callbacks for NetworkConfigurationHandler::GetProperties.
+ void GetPropertiesAndCallStatusChanged(
+ MobileActivator::PlanActivationState state,
+ const std::string& error_description,
+ const std::string& service_path,
+ const base::DictionaryValue& properties);
+ void GetPropertiesAndCallGetDeviceInfo(
+ const std::string& service_path,
+ const base::DictionaryValue& properties);
+ void GetPropertiesFailure(
+ const std::string& service_path,
+ const std::string& callback_name,
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data);
+
// Handlers for JS WebUI messages.
void HandleSetTransactionStatus(const ListValue* args);
void HandleStartActivation(const ListValue* args);
@@ -197,16 +281,13 @@ class MobileSetupHandler
// Sends message to host registration page with system/user info data.
void SendDeviceInfo();
- // Converts the currently active CellularNetwork device into a JS object.
- static void GetDeviceInfo(const NetworkState* network,
- DictionaryValue* value);
-
// Type of the mobilesetup webui deduced from received messages.
Type type_;
// Whether portal page for lte networks can be reached in current network
// connection state. This value is reflected in portal webui for lte networks.
// Initial value is true.
bool lte_portal_reachable_;
+ base::WeakPtrFactory<MobileSetupHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(MobileSetupHandler);
};
@@ -217,7 +298,8 @@ class MobileSetupHandler
//
////////////////////////////////////////////////////////////////////////////////
-MobileSetupUIHTMLSource::MobileSetupUIHTMLSource() {
+MobileSetupUIHTMLSource::MobileSetupUIHTMLSource()
+ : weak_ptr_factory_(this) {
}
std::string MobileSetupUIHTMLSource::GetSource() const {
@@ -229,27 +311,48 @@ void MobileSetupUIHTMLSource::StartDataRequest(
int render_process_id,
int render_view_id,
const content::URLDataSource::GotDataCallback& callback) {
- const NetworkState* network = NULL;
- if (!path.empty()) {
- network = NetworkHandler::Get()->network_state_handler()->GetNetworkState(
- path);
+ NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ path,
+ base::Bind(&MobileSetupUIHTMLSource::GetPropertiesAndStartDataRequest,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback),
+ base::Bind(&MobileSetupUIHTMLSource::GetPropertiesFailure,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback, path));
+}
+
+void MobileSetupUIHTMLSource::GetPropertiesAndStartDataRequest(
+ const content::URLDataSource::GotDataCallback& callback,
+ const std::string& service_path,
+ const base::DictionaryValue& properties) {
+ const DictionaryValue* payment_dict;
+ std::string name, usage_url, activation_state, payment_url;
+ if (!properties.GetStringWithoutPathExpansion(
+ flimflam::kNameProperty, &name) ||
+ !properties.GetStringWithoutPathExpansion(
+ flimflam::kUsageURLProperty, &usage_url) ||
+ !properties.GetStringWithoutPathExpansion(
+ flimflam::kActivationStateProperty, &activation_state) ||
+ !properties.GetDictionaryWithoutPathExpansion(
+ flimflam::kPaymentPortalProperty, &payment_dict) ||
+ !payment_dict->GetStringWithoutPathExpansion(
+ flimflam::kPaymentPortalURL, &payment_url)) {
+ DataRequestFailed(service_path, callback);
+ return;
}
- if (!network ||
- (network->payment_url().empty() && network->usage_url().empty() &&
- network->activation_state() != flimflam::kActivationStateActivated)) {
- LOG(WARNING) << "Can't find device to activate for service path " << path;
- scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes);
- callback.Run(html_bytes.get());
+ if (payment_url.empty() && usage_url.empty() &&
+ activation_state != flimflam::kActivationStateActivated) {
+ DataRequestFailed(service_path, callback);
return;
}
- LOG(WARNING) << "Starting mobile setup for " << path;
+ NET_LOG_EVENT("Starting mobile setup", service_path);
DictionaryValue strings;
strings.SetString("connecting_header",
l10n_util::GetStringFUTF16(IDS_MOBILE_CONNECTING_HEADER,
- network ? UTF8ToUTF16(network->name()) : string16()));
+ UTF8ToUTF16(name)));
strings.SetString("error_header",
l10n_util::GetStringUTF16(IDS_MOBILE_ERROR_HEADER));
strings.SetString("activating_header",
@@ -277,7 +380,7 @@ void MobileSetupUIHTMLSource::StartDataRequest(
// network is activated, the webui goes straight to portal. Otherwise the
// webui is used for activation flow.
std::string full_html;
- if (network->activation_state() == flimflam::kActivationStateActivated) {
+ if (activation_state == flimflam::kActivationStateActivated) {
static const base::StringPiece html_for_activated(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_MOBILE_SETUP_PORTAL_PAGE_HTML));
@@ -292,6 +395,14 @@ void MobileSetupUIHTMLSource::StartDataRequest(
callback.Run(base::RefCountedString::TakeString(&full_html));
}
+void MobileSetupUIHTMLSource::GetPropertiesFailure(
+ const content::URLDataSource::GotDataCallback& callback,
+ const std::string& service_path,
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data) {
+ DataRequestFailed(service_path, callback);
+}
+
////////////////////////////////////////////////////////////////////////////////
//
// MobileSetupHandler
@@ -299,7 +410,8 @@ void MobileSetupUIHTMLSource::StartDataRequest(
////////////////////////////////////////////////////////////////////////////////
MobileSetupHandler::MobileSetupHandler()
: type_(TYPE_UNDETERMINED),
- lte_portal_reachable_(true) {
+ lte_portal_reachable_(true),
+ weak_ptr_factory_(this) {
}
MobileSetupHandler::~MobileSetupHandler() {
@@ -319,10 +431,25 @@ void MobileSetupHandler::OnActivationStateChanged(
DCHECK_EQ(TYPE_ACTIVATION, type_);
if (!web_ui())
return;
+ NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ network->path(),
+ base::Bind(&MobileSetupHandler::GetPropertiesAndCallStatusChanged,
+ weak_ptr_factory_.GetWeakPtr(),
+ state,
+ error_description),
+ base::Bind(&MobileSetupHandler::GetPropertiesFailure,
+ weak_ptr_factory_.GetWeakPtr(),
+ network->path(),
+ kJsDeviceStatusChangedCallback));
+}
+void MobileSetupHandler::GetPropertiesAndCallStatusChanged(
+ MobileActivator::PlanActivationState state,
+ const std::string& error_description,
+ const std::string& service_path,
+ const base::DictionaryValue& properties) {
DictionaryValue device_dict;
- if (network)
- GetDeviceInfo(network, &device_dict);
+ GetDeviceInfo(properties, &device_dict);
device_dict.SetInteger("state", state);
if (error_description.length())
device_dict.SetString("error", error_description);
@@ -437,11 +564,36 @@ void MobileSetupHandler::HandleGetDeviceInfo(const ListValue* args) {
}
}
+ NetworkHandler::Get()->network_configuration_handler()->GetProperties(
+ network->path(),
+ base::Bind(&MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::Bind(&MobileSetupHandler::GetPropertiesFailure,
+ weak_ptr_factory_.GetWeakPtr(),
+ network->path(),
+ kJsGetDeviceInfoCallback));
+}
+
+void MobileSetupHandler::GetPropertiesAndCallGetDeviceInfo(
+ const std::string& service_path,
+ const base::DictionaryValue& properties) {
DictionaryValue device_info;
- GetDeviceInfo(network, &device_info);
+ GetDeviceInfo(properties, &device_info);
web_ui()->CallJavascriptFunction(kJsGetDeviceInfoCallback, device_info);
}
+void MobileSetupHandler::GetPropertiesFailure(
+ const std::string& service_path,
+ const std::string& callback_name,
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data) {
+ NET_LOG_ERROR("MobileActivator GetProperties Failed: " + error_name,
+ service_path);
+ // Invoke |callback_name| with an empty dictionary.
+ DictionaryValue device_dict;
+ web_ui()->CallJavascriptFunction(callback_name, device_dict);
+}
+
void MobileSetupHandler::NetworkManagerChanged() {
if (!web_ui())
return;
@@ -490,27 +642,6 @@ void MobileSetupHandler::UpdatePortalReachability(
lte_portal_reachable_ = portal_reachable;
}
-void MobileSetupHandler::GetDeviceInfo(const NetworkState* network,
- DictionaryValue* value) {
- DCHECK(network);
- value->SetBoolean("activate_over_non_cellular_network",
- network->activate_over_non_cellular_networks());
- value->SetString("carrier", network->name());
- value->SetString("payment_url", network->payment_url());
- if (LowerCaseEqualsASCII(network->post_method(), "post") &&
- !network->post_data().empty())
- value->SetString("post_data", network->post_data());
-
- const chromeos::DeviceState* device =
- NetworkHandler::Get()->network_state_handler()->GetDeviceState(
- network->device_path());
- if (device) {
- value->SetString("MEID", device->meid());
- value->SetString("IMEI", device->imei());
- value->SetString("MDN", device->mdn());
- }
-}
-
////////////////////////////////////////////////////////////////////////////////
//
// MobileSetupUI
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index 2ebaf29..bed50f6 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -1560,7 +1560,10 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
dictionary.SetBoolean(kTagShowStaticIPConfig, staticIPConfig);
dictionary.SetBoolean(kTagShowPreferred, !network->profile_path().empty());
- bool preferred = network->priority() > 0;
+ int priority = 0;
+ shill_properties.GetIntegerWithoutPathExpansion(
+ flimflam::kPriorityProperty, &priority);
+ bool preferred = priority > 0;
SetValueDictionary(&dictionary, kTagPreferred,
new base::FundamentalValue(preferred),
property_ui_data);
@@ -1582,8 +1585,11 @@ void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
auto_connect_ui_data.ParseOncProperty(
onc_source, onc, onc_path_to_auto_connect);
}
+ bool auto_connect = false;
+ shill_properties.GetBooleanWithoutPathExpansion(
+ flimflam::kAutoConnectProperty, &auto_connect);
SetValueDictionary(&dictionary, kTagAutoConnect,
- new base::FundamentalValue(network->auto_connect()),
+ new base::FundamentalValue(auto_connect),
auto_connect_ui_data);
PopulateConnectionDetails(network, shill_properties, &dictionary);
diff --git a/chrome/test/data/extensions/api_test/networking/test.js b/chrome/test/data/extensions/api_test/networking/test.js
index 3968b93..3a8980f 100644
--- a/chrome/test/data/extensions/api_test/networking/test.js
+++ b/chrome/test/data/extensions/api_test/networking/test.js
@@ -123,7 +123,6 @@ var availableTests = [
"Name": "wifi1",
"Type": "WiFi",
"WiFi": {
- "AutoConnect": false,
"Security": "WEP-PSK",
"SignalStrength": 0
}
@@ -133,9 +132,6 @@ var availableTests = [
"GUID": "stub_vpn1",
"Name": "vpn1",
"Type": "VPN",
- "VPN": {
- "AutoConnect": false
- }
},
{
"ConnectionState": "NotConnected",
@@ -143,7 +139,6 @@ var availableTests = [
"Name": "wifi2_PSK",
"Type": "WiFi",
"WiFi": {
- "AutoConnect": false,
"Security": "WPA-PSK",
"SignalStrength": 80
}
@@ -172,7 +167,6 @@ var availableTests = [
"Name": "wifi1",
"Type": "WiFi",
"WiFi": {
- "AutoConnect": false,
"Security": "WEP-PSK",
"SignalStrength": 0
}
@@ -183,7 +177,6 @@ var availableTests = [
"Name": "wifi2_PSK",
"Type": "WiFi",
"WiFi": {
- "AutoConnect": false,
"Security": "WPA-PSK",
"SignalStrength": 80
}
@@ -306,7 +299,6 @@ var availableTests = [
"Name": "wifi2_PSK",
"Type": "WiFi",
"WiFi": {
- "AutoConnect": false,
"Security": "WPA-PSK",
"SignalStrength": 80
}
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
index 834022b..df42d51 100644
--- a/chromeos/network/network_state.cc
+++ b/chromeos/network/network_state.cc
@@ -60,12 +60,9 @@ namespace chromeos {
NetworkState::NetworkState(const std::string& path)
: ManagedState(MANAGED_TYPE_NETWORK, path),
- auto_connect_(false),
- favorite_(false),
- priority_(0),
+ connectable_(false),
prefix_length_(0),
signal_strength_(0),
- connectable_(false),
activate_over_non_cellular_networks_(false),
cellular_out_of_credits_(false),
has_ca_cert_nss_(false) {
@@ -129,12 +126,6 @@ bool NetworkState::PropertyChanged(const std::string& key,
return GetStringValue(key, value, &roaming_);
} else if (key == flimflam::kSecurityProperty) {
return GetStringValue(key, value, &security_);
- } else if (key == flimflam::kAutoConnectProperty) {
- return GetBooleanValue(key, value, &auto_connect_);
- } else if (key == flimflam::kFavoriteProperty) {
- return GetBooleanValue(key, value, &favorite_);
- } else if (key == flimflam::kPriorityProperty) {
- return GetIntegerValue(key, value, &priority_);
} else if (key == flimflam::kProxyConfigProperty) {
std::string proxy_config_str;
if (!value.GetAsString(&proxy_config_str)) {
@@ -179,21 +170,6 @@ bool NetworkState::PropertyChanged(const std::string& key,
return GetBooleanValue(key, value, &activate_over_non_cellular_networks_);
} else if (key == shill::kOutOfCreditsProperty) {
return GetBooleanValue(key, value, &cellular_out_of_credits_);
- } else if (key == flimflam::kUsageURLProperty) {
- return GetStringValue(key, value, &usage_url_);
- } else if (key == flimflam::kPaymentPortalProperty) {
- const DictionaryValue* dict;
- if (!value.GetAsDictionary(&dict))
- return false;
- if (!dict->GetStringWithoutPathExpansion(
- flimflam::kPaymentPortalURL, &payment_url_) ||
- !dict->GetStringWithoutPathExpansion(
- flimflam::kPaymentPortalMethod, &post_method_) ||
- !dict->GetStringWithoutPathExpansion(
- flimflam::kPaymentPortalPostData, &post_data_)) {
- return false;
- }
- return true;
}
return false;
}
@@ -232,8 +208,6 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const {
name_servers->AppendStrings(dns_servers_);
ipconfig_properties->SetWithoutPathExpansion(flimflam::kNameServersProperty,
name_servers);
- ipconfig_properties->SetIntegerWithoutPathExpansion(
- flimflam::kPrefixlenProperty, prefix_length_);
ipconfig_properties->SetStringWithoutPathExpansion(
shill::kWebProxyAutoDiscoveryUrlProperty,
web_proxy_auto_discovery_url_.spec());
@@ -246,12 +220,6 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const {
roaming_);
dictionary->SetStringWithoutPathExpansion(flimflam::kSecurityProperty,
security_);
- dictionary->SetBooleanWithoutPathExpansion(flimflam::kAutoConnectProperty,
- auto_connect_);
- dictionary->SetBooleanWithoutPathExpansion(flimflam::kFavoriteProperty,
- favorite_);
- dictionary->SetIntegerWithoutPathExpansion(flimflam::kPriorityProperty,
- priority_);
// Proxy config and ONC source are intentionally omitted: These properties are
// placed in NetworkState to transition ProxyConfigServiceImpl from
// NetworkLibrary to the new network stack. The networking extension API
@@ -270,18 +238,6 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const {
activate_over_non_cellular_networks_);
dictionary->SetBooleanWithoutPathExpansion(shill::kOutOfCreditsProperty,
cellular_out_of_credits_);
- base::DictionaryValue* payment_portal_properties = new DictionaryValue;
- payment_portal_properties->SetStringWithoutPathExpansion(
- flimflam::kPaymentPortalURL,
- payment_url_);
- payment_portal_properties->SetStringWithoutPathExpansion(
- flimflam::kPaymentPortalMethod,
- post_method_);
- payment_portal_properties->SetStringWithoutPathExpansion(
- flimflam::kPaymentPortalPostData,
- post_data_);
- dictionary->SetWithoutPathExpansion(flimflam::kPaymentPortalProperty,
- payment_portal_properties);
}
bool NetworkState::IsConnectedState() const {
diff --git a/chromeos/network/network_state.h b/chromeos/network/network_state.h
index 427e2af..87c9c3c 100644
--- a/chromeos/network/network_state.h
+++ b/chromeos/network/network_state.h
@@ -23,8 +23,6 @@ namespace chromeos {
// the network.
class CHROMEOS_EXPORT NetworkState : public ManagedState {
public:
- typedef std::vector<int> FrequencyList;
-
explicit NetworkState(const std::string& path);
virtual ~NetworkState();
@@ -47,22 +45,23 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
const std::string& connection_state() const { return connection_state_; }
const std::string& profile_path() const { return profile_path_; }
const std::string& error() const { return error_; }
- bool auto_connect() const { return auto_connect_; }
- bool favorite() const { return favorite_; }
- int priority() const { return priority_; }
+ bool connectable() const { return connectable_; }
+
const base::DictionaryValue& proxy_config() const { return proxy_config_; }
const NetworkUIData& ui_data() const { return ui_data_; }
- // IPConfig Properties
+
+ // IPConfig Properties. These require an extra call to ShillIPConfigClient,
+ // so cache them to avoid excessively complex client code.
const std::string& ip_address() const { return ip_address_; }
const std::string& gateway() const { return gateway_; }
const std::vector<std::string>& dns_servers() const { return dns_servers_; }
- const int prefix_length() const { return prefix_length_; }
const GURL& web_proxy_auto_discovery_url() const {
return web_proxy_auto_discovery_url_;
}
+
// Wireless property accessors
int signal_strength() const { return signal_strength_; }
- bool connectable() const { return connectable_; }
+
// Cellular property accessors
const std::string& network_technology() const {
return network_technology_;
@@ -73,10 +72,6 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
return activate_over_non_cellular_networks_;
}
bool cellular_out_of_credits() const { return cellular_out_of_credits_; }
- const std::string& usage_url() const { return usage_url_; }
- const std::string& payment_url() const { return payment_url_; }
- const std::string& post_method() const { return post_method_; }
- const std::string& post_data() const { return post_data_; }
// Whether this network has a CACertNSS nickname set.
bool HasCACertNSS() const { return has_ca_cert_nss_; }
@@ -101,8 +96,7 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
static bool StateIsConnected(const std::string& connection_state);
static bool StateIsConnecting(const std::string& connection_state);
- // Helper to return a full prefixed version of an IPConfig property
- // key.
+ // Helper to return a full prefixed version of an IPConfig property key.
static std::string IPConfigProperty(const char* key);
@@ -115,44 +109,43 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState {
// Returns true if |name_| changes.
bool UpdateName(const base::DictionaryValue& properties);
- // TODO(gauravsh): Audit the list of properties that we are caching. We should
- // only be doing this for commonly accessed properties. crbug.com/252553
- // Common Network Service properties
+ // Network Service properties. Avoid adding any additional properties here.
+ // Instead use NetworkConfigurationHandler::GetProperties() to asynchronously
+ // request properties from Shill.
std::string security_;
std::string device_path_;
std::string guid_;
std::string connection_state_;
std::string profile_path_;
std::string error_;
- bool auto_connect_;
- bool favorite_;
- int priority_;
+ bool connectable_;
+
// TODO(pneubeck): Remove ProxyConfig once NetworkConfigurationHandler
- // provides proxy configuration. crbug/241775
+ // provides proxy configuration. crbug.com/241775
base::DictionaryValue proxy_config_;
+
+ // This is convenient to keep cached for now, but shouldn't be necessary;
+ // avoid using it if possible.
NetworkUIData ui_data_;
+
// IPConfig properties.
// Note: These do not correspond to actual Shill.Service properties
// but are derived from the service's corresponding IPConfig object.
std::string ip_address_;
std::string gateway_;
std::vector<std::string> dns_servers_;
- int prefix_length_;
+ int prefix_length_; // Used by GetNetmask()
GURL web_proxy_auto_discovery_url_;
- // Wireless properties
+
+ // Wireless properties, used for icons and Connect logic.
int signal_strength_;
- bool connectable_;
- // Cellular properties
+
+ // Cellular properties, used for icons, Connect, and Activation.
std::string network_technology_;
std::string activation_state_;
std::string roaming_;
bool activate_over_non_cellular_networks_;
bool cellular_out_of_credits_;
- // Cellular payment portal properties.
- std::string usage_url_;
- std::string payment_url_;
- std::string post_method_;
- std::string post_data_;
// Whether a deprecated CaCertNSS property of this network is set. Required
// for migration to PEM.