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/certificate_pattern.h" | 5 #include "chrome/browser/chromeos/cros/certificate_pattern.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 if (!subject_.Empty()) | 310 if (!subject_.Empty()) |
311 dict->Set(kSubjectKey, subject_.CreateAsDictionary()); | 311 dict->Set(kSubjectKey, subject_.CreateAsDictionary()); |
312 | 312 |
313 if (!enrollment_uri_list_.empty()) | 313 if (!enrollment_uri_list_.empty()) |
314 dict->Set(kEnrollmentUriKey, CreateListFromStrings(enrollment_uri_list_)); | 314 dict->Set(kEnrollmentUriKey, CreateListFromStrings(enrollment_uri_list_)); |
315 return dict; | 315 return dict; |
316 } | 316 } |
317 | 317 |
318 bool CertificatePattern::CopyFromDictionary(const DictionaryValue &dict) { | 318 bool CertificatePattern::CopyFromDictionary(const DictionaryValue &dict) { |
319 DictionaryValue* child_dict = NULL; | 319 const DictionaryValue* child_dict = NULL; |
320 ListValue* child_list = NULL; | 320 const ListValue* child_list = NULL; |
321 Clear(); | 321 Clear(); |
322 | 322 |
323 // All of these are optional. | 323 // All of these are optional. |
324 if (dict.GetList(kIssuerCaRefKey, &child_list) && child_list) { | 324 if (dict.GetList(kIssuerCaRefKey, &child_list) && child_list) { |
325 if (!GetAsListOfStrings(*child_list, &issuer_ca_ref_list_)) | 325 if (!GetAsListOfStrings(*child_list, &issuer_ca_ref_list_)) |
326 return false; | 326 return false; |
327 } | 327 } |
328 if (dict.GetDictionary(kIssuerKey, &child_dict) && child_dict) { | 328 if (dict.GetDictionary(kIssuerKey, &child_dict) && child_dict) { |
329 if (!issuer_.CopyFromDictionary(*child_dict)) | 329 if (!issuer_.CopyFromDictionary(*child_dict)) |
330 return false; | 330 return false; |
(...skipping 12 matching lines...) Expand all Loading... |
343 // If we didn't copy anything from the dictionary, then it had better be | 343 // If we didn't copy anything from the dictionary, then it had better be |
344 // empty. | 344 // empty. |
345 DCHECK(dict.empty() == Empty()); | 345 DCHECK(dict.empty() == Empty()); |
346 if (dict.empty() != Empty()) | 346 if (dict.empty() != Empty()) |
347 return false; | 347 return false; |
348 | 348 |
349 return true; | 349 return true; |
350 } | 350 } |
351 | 351 |
352 } // namespace chromeos | 352 } // namespace chromeos |
OLD | NEW |