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

Unified Diff: chrome/browser/chromeos/mobile/mobile_activator.cc

Issue 23441025: Clean up NetworkState members (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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/mobile/mobile_activator.cc
diff --git a/chrome/browser/chromeos/mobile/mobile_activator.cc b/chrome/browser/chromeos/mobile/mobile_activator.cc
index 9475e6e8e06d78d5ee02cd41e6a80263e58f771a..c0781b94e16e0bb5bca801c6dfdfb655c4203c25 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,

Powered by Google App Engine
This is Rietveld 408576698