| 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/network_ui_data.h" | 5 #include "chrome/browser/chromeos/cros/network_ui_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/chromeos/cros/network_library.h" | 8 #include "chrome/browser/chromeos/cros/network_library.h" |
| 9 | 9 |
| 10 namespace chromeos { | 10 namespace chromeos { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 certificate_type_(CLIENT_CERT_TYPE_NONE) { | 39 certificate_type_(CLIENT_CERT_TYPE_NONE) { |
| 40 } | 40 } |
| 41 | 41 |
| 42 NetworkUIData::NetworkUIData(const DictionaryValue& dict) { | 42 NetworkUIData::NetworkUIData(const DictionaryValue& dict) { |
| 43 std::string source; | 43 std::string source; |
| 44 if (dict.GetString(kKeyONCSource, &source)) { | 44 if (dict.GetString(kKeyONCSource, &source)) { |
| 45 onc_source_ = GetONCSourceMapper().Get(source); | 45 onc_source_ = GetONCSourceMapper().Get(source); |
| 46 } else { | 46 } else { |
| 47 onc_source_ = ONC_SOURCE_NONE; | 47 onc_source_ = ONC_SOURCE_NONE; |
| 48 } | 48 } |
| 49 DictionaryValue* cert_dict = NULL; | 49 const DictionaryValue* cert_dict = NULL; |
| 50 if (dict.GetDictionary(kKeyCertificatePattern, &cert_dict) && cert_dict) | 50 if (dict.GetDictionary(kKeyCertificatePattern, &cert_dict) && cert_dict) |
| 51 certificate_pattern_.CopyFromDictionary(*cert_dict); | 51 certificate_pattern_.CopyFromDictionary(*cert_dict); |
| 52 std::string type_string; | 52 std::string type_string; |
| 53 if (dict.GetString(kKeyCertificateType, &type_string)) { | 53 if (dict.GetString(kKeyCertificateType, &type_string)) { |
| 54 certificate_type_ = GetClientCertMapper().Get(type_string); | 54 certificate_type_ = GetClientCertMapper().Get(type_string); |
| 55 } else { | 55 } else { |
| 56 certificate_type_ = CLIENT_CERT_TYPE_NONE; | 56 certificate_type_ = CLIENT_CERT_TYPE_NONE; |
| 57 } | 57 } |
| 58 DCHECK(certificate_type_ != CLIENT_CERT_TYPE_PATTERN || | 58 DCHECK(certificate_type_ != CLIENT_CERT_TYPE_PATTERN || |
| 59 (certificate_type_ == CLIENT_CERT_TYPE_PATTERN && | 59 (certificate_type_ == CLIENT_CERT_TYPE_PATTERN && |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 size_t pos = property_key.find_last_of('.'); | 136 size_t pos = property_key.find_last_of('.'); |
| 137 std::string recommended_property_key; | 137 std::string recommended_property_key; |
| 138 std::string property_basename(property_key); | 138 std::string property_basename(property_key); |
| 139 if (pos != std::string::npos) { | 139 if (pos != std::string::npos) { |
| 140 recommended_property_key = property_key.substr(0, pos + 1); | 140 recommended_property_key = property_key.substr(0, pos + 1); |
| 141 property_basename = property_key.substr(pos + 1); | 141 property_basename = property_key.substr(pos + 1); |
| 142 } | 142 } |
| 143 recommended_property_key += "Recommended"; | 143 recommended_property_key += "Recommended"; |
| 144 | 144 |
| 145 base::ListValue* recommended_keys = NULL; | 145 const base::ListValue* recommended_keys = NULL; |
| 146 if (onc->GetList(recommended_property_key, &recommended_keys)) { | 146 if (onc->GetList(recommended_property_key, &recommended_keys)) { |
| 147 base::StringValue basename_value(property_basename); | 147 base::StringValue basename_value(property_basename); |
| 148 if (recommended_keys->Find(basename_value) != recommended_keys->end()) { | 148 if (recommended_keys->Find(basename_value) != recommended_keys->end()) { |
| 149 controller_ = CONTROLLER_USER; | 149 controller_ = CONTROLLER_USER; |
| 150 base::Value* default_value = NULL; | 150 const base::Value* default_value = NULL; |
| 151 if (onc->Get(property_key, &default_value)) | 151 if (onc->Get(property_key, &default_value)) |
| 152 default_value_.reset(default_value->DeepCopy()); | 152 default_value_.reset(default_value->DeepCopy()); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace chromeos | 157 } // namespace chromeos |
| OLD | NEW |