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

Side by Side Diff: chrome/browser/chromeos/cros/native_network_parser.cc

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 years, 5 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
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/cros/native_network_parser.h" 5 #include "chrome/browser/chromeos/cros/native_network_parser.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 544 }
545 545
546 bool NativeNetworkDeviceParser::ParseSimLockStateFromDictionary( 546 bool NativeNetworkDeviceParser::ParseSimLockStateFromDictionary(
547 const DictionaryValue& info, 547 const DictionaryValue& info,
548 SimLockState* out_state, 548 SimLockState* out_state,
549 int* out_retries, 549 int* out_retries,
550 bool* out_enabled) { 550 bool* out_enabled) {
551 std::string state_string; 551 std::string state_string;
552 // Since RetriesLeft is sent as a uint32, which may overflow int32 range, from 552 // Since RetriesLeft is sent as a uint32, which may overflow int32 range, from
553 // Flimflam, it may be stored as an integer or a double in DictionaryValue. 553 // Flimflam, it may be stored as an integer or a double in DictionaryValue.
554 base::Value* retries_value = NULL; 554 const base::Value* retries_value = NULL;
555 if (!info.GetString(flimflam::kSIMLockTypeProperty, &state_string) || 555 if (!info.GetString(flimflam::kSIMLockTypeProperty, &state_string) ||
556 !info.GetBoolean(flimflam::kSIMLockEnabledProperty, out_enabled) || 556 !info.GetBoolean(flimflam::kSIMLockEnabledProperty, out_enabled) ||
557 !info.Get(flimflam::kSIMLockRetriesLeftProperty, &retries_value) || 557 !info.Get(flimflam::kSIMLockRetriesLeftProperty, &retries_value) ||
558 (retries_value->GetType() != base::Value::TYPE_INTEGER && 558 (retries_value->GetType() != base::Value::TYPE_INTEGER &&
559 retries_value->GetType() != base::Value::TYPE_DOUBLE)) { 559 retries_value->GetType() != base::Value::TYPE_DOUBLE)) {
560 LOG(ERROR) << "Error parsing SIMLock state"; 560 LOG(ERROR) << "Error parsing SIMLock state";
561 return false; 561 return false;
562 } 562 }
563 *out_state = ParseSimLockState(state_string); 563 *out_state = ParseSimLockState(state_string);
564 if (retries_value->GetType() == base::Value::TYPE_INTEGER) { 564 if (retries_value->GetType() == base::Value::TYPE_INTEGER) {
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 // TODO(rkc): Figure out why is this ever not true and fix the root 1282 // TODO(rkc): Figure out why is this ever not true and fix the root
1283 // cause. 'value' comes to us all the way from the cros dbus call, the 1283 // cause. 'value' comes to us all the way from the cros dbus call, the
1284 // issue is likely on the cros side of things. 1284 // issue is likely on the cros side of things.
1285 if (value.GetType() != Value::TYPE_DICTIONARY) 1285 if (value.GetType() != Value::TYPE_DICTIONARY)
1286 return false; 1286 return false;
1287 1287
1288 const DictionaryValue& dict = static_cast<const DictionaryValue&>(value); 1288 const DictionaryValue& dict = static_cast<const DictionaryValue&>(value);
1289 for (DictionaryValue::key_iterator iter = dict.begin_keys(); 1289 for (DictionaryValue::key_iterator iter = dict.begin_keys();
1290 iter != dict.end_keys(); ++iter) { 1290 iter != dict.end_keys(); ++iter) {
1291 const std::string& key = *iter; 1291 const std::string& key = *iter;
1292 base::Value* provider_value; 1292 const base::Value* provider_value;
1293 bool res = dict.GetWithoutPathExpansion(key, &provider_value); 1293 bool res = dict.GetWithoutPathExpansion(key, &provider_value);
1294 DCHECK(res); 1294 DCHECK(res);
1295 if (res) { 1295 if (res) {
1296 PropertyIndex index = mapper().Get(key); 1296 PropertyIndex index = mapper().Get(key);
1297 if (!ParseProviderValue(index, *provider_value, virtual_network)) 1297 if (!ParseProviderValue(index, *provider_value, virtual_network))
1298 VLOG(1) << network->name() << ": Provider unhandled key: " << key 1298 VLOG(1) << network->name() << ": Provider unhandled key: " << key
1299 << " Type: " << provider_value->GetType(); 1299 << " Type: " << provider_value->GetType();
1300 } 1300 }
1301 } 1301 }
1302 return true; 1302 return true;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 PROVIDER_TYPE_MAX)); 1407 PROVIDER_TYPE_MAX));
1408 return &parser; 1408 return &parser;
1409 } 1409 }
1410 1410
1411 ProviderType NativeVirtualNetworkParser::ParseProviderType( 1411 ProviderType NativeVirtualNetworkParser::ParseProviderType(
1412 const std::string& type) { 1412 const std::string& type) {
1413 return provider_type_mapper()->Get(type); 1413 return provider_type_mapper()->Get(type);
1414 } 1414 }
1415 1415
1416 } // namespace chromeos 1416 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/certificate_pattern.cc ('k') | chrome/browser/chromeos/cros/network_library_impl_cros.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698