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

Side by Side Diff: chrome/browser/chromeos/mobile/mobile_activator.cc

Issue 106433007: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/mobile/mobile_activator.h" 5 #include "chrome/browser/chromeos/mobile/mobile_activator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 base::AutoLock create(config_lock_); 115 base::AutoLock create(config_lock_);
116 error_map_.clear(); 116 error_map_.clear();
117 error_map_.insert(map.begin(), map.end()); 117 error_map_.insert(map.begin(), map.end());
118 } 118 }
119 119
120 bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) { 120 bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) {
121 std::string config; 121 std::string config;
122 if (!base::ReadFileToString(config_path, &config)) 122 if (!base::ReadFileToString(config_path, &config))
123 return false; 123 return false;
124 124
125 scoped_ptr<Value> root( 125 scoped_ptr<base::Value> root(
126 base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS)); 126 base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS));
127 DCHECK(root.get() != NULL); 127 DCHECK(root.get() != NULL);
128 if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) { 128 if (!root.get() || root->GetType() != base::Value::TYPE_DICTIONARY) {
129 LOG(WARNING) << "Bad cellular config file"; 129 LOG(WARNING) << "Bad cellular config file";
130 return false; 130 return false;
131 } 131 }
132 132
133 DictionaryValue* root_dict = static_cast<DictionaryValue*>(root.get()); 133 base::DictionaryValue* root_dict =
134 static_cast<base::DictionaryValue*>(root.get());
134 if (!root_dict->GetString(kVersionField, &version_)) { 135 if (!root_dict->GetString(kVersionField, &version_)) {
135 LOG(WARNING) << "Cellular config file missing version"; 136 LOG(WARNING) << "Cellular config file missing version";
136 return false; 137 return false;
137 } 138 }
138 ErrorMap error_map; 139 ErrorMap error_map;
139 DictionaryValue* errors = NULL; 140 base::DictionaryValue* errors = NULL;
140 if (!root_dict->GetDictionary(kErrorsField, &errors)) 141 if (!root_dict->GetDictionary(kErrorsField, &errors))
141 return false; 142 return false;
142 for (DictionaryValue::Iterator it(*errors); !it.IsAtEnd(); it.Advance()) { 143 for (base::DictionaryValue::Iterator it(*errors);
144 !it.IsAtEnd(); it.Advance()) {
143 std::string value; 145 std::string value;
144 if (!it.value().GetAsString(&value)) { 146 if (!it.value().GetAsString(&value)) {
145 LOG(WARNING) << "Bad cellular config error value"; 147 LOG(WARNING) << "Bad cellular config error value";
146 return false; 148 return false;
147 } 149 }
148 error_map.insert(ErrorMap::value_type(it.key(), value)); 150 error_map.insert(ErrorMap::value_type(it.key(), value));
149 } 151 }
150 SetErrorMap(error_map); 152 SetErrorMap(error_map);
151 return true; 153 return true;
152 } 154 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 281 }
280 282
281 void MobileActivator::GetPropertiesAndContinueActivation( 283 void MobileActivator::GetPropertiesAndContinueActivation(
282 const std::string& service_path, 284 const std::string& service_path,
283 const base::DictionaryValue& properties) { 285 const base::DictionaryValue& properties) {
284 if (service_path != service_path_) { 286 if (service_path != service_path_) {
285 NET_LOG_EVENT("MobileActivator::GetProperties received for stale network", 287 NET_LOG_EVENT("MobileActivator::GetProperties received for stale network",
286 service_path); 288 service_path);
287 return; // Edge case; abort. 289 return; // Edge case; abort.
288 } 290 }
289 const DictionaryValue* payment_dict; 291 const base::DictionaryValue* payment_dict;
290 std::string usage_url, payment_url; 292 std::string usage_url, payment_url;
291 if (!properties.GetStringWithoutPathExpansion( 293 if (!properties.GetStringWithoutPathExpansion(
292 shill::kUsageURLProperty, &usage_url) || 294 shill::kUsageURLProperty, &usage_url) ||
293 !properties.GetDictionaryWithoutPathExpansion( 295 !properties.GetDictionaryWithoutPathExpansion(
294 shill::kPaymentPortalProperty, &payment_dict) || 296 shill::kPaymentPortalProperty, &payment_dict) ||
295 !payment_dict->GetStringWithoutPathExpansion( 297 !payment_dict->GetStringWithoutPathExpansion(
296 shill::kPaymentPortalURL, &payment_url)) { 298 shill::kPaymentPortalURL, &payment_url)) {
297 NET_LOG_ERROR("MobileActivator missing properties", service_path_); 299 NET_LOG_ERROR("MobileActivator missing properties", service_path_);
298 return; 300 return;
299 } 301 }
300 302
301 if (payment_url.empty() && usage_url.empty()) 303 if (payment_url.empty() && usage_url.empty())
302 return; 304 return;
303 305
304 DisableCertRevocationChecking(); 306 DisableCertRevocationChecking();
305 307
306 // We want shill to connect us after activations, so enable autoconnect. 308 // We want shill to connect us after activations, so enable autoconnect.
307 DictionaryValue auto_connect_property; 309 base::DictionaryValue auto_connect_property;
308 auto_connect_property.SetBoolean(shill::kAutoConnectProperty, true); 310 auto_connect_property.SetBoolean(shill::kAutoConnectProperty, true);
309 NetworkHandler::Get()->network_configuration_handler()->SetProperties( 311 NetworkHandler::Get()->network_configuration_handler()->SetProperties(
310 service_path_, 312 service_path_,
311 auto_connect_property, 313 auto_connect_property,
312 base::Bind(&base::DoNothing), 314 base::Bind(&base::DoNothing),
313 network_handler::ErrorCallback()); 315 network_handler::ErrorCallback());
314 StartActivation(); 316 StartActivation();
315 } 317 }
316 318
317 void MobileActivator::GetPropertiesFailure( 319 void MobileActivator::GetPropertiesFailure(
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 cellular_plan_payment_time_ = base::Time::Now(); 1081 cellular_plan_payment_time_ = base::Time::Now();
1080 } 1082 }
1081 1083
1082 bool MobileActivator::HasRecentCellularPlanPayment() const { 1084 bool MobileActivator::HasRecentCellularPlanPayment() const {
1083 const int kRecentPlanPaymentHours = 6; 1085 const int kRecentPlanPaymentHours = 6;
1084 return (base::Time::Now() - 1086 return (base::Time::Now() -
1085 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; 1087 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours;
1086 } 1088 }
1087 1089
1088 } // namespace chromeos 1090 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.cc ('k') | chrome/browser/chromeos/mobile_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698