| OLD | NEW |
| 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 return parsed_state; | 543 return parsed_state; |
| 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 // Shill, it may be stored as an integer or a double in DictionaryValue. |
| 554 const 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); |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |