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

Side by Side Diff: chrome/browser/ui/webui/options/certificate_manager_handler.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 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/ui/webui/options/certificate_manager_handler.h" 5 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <algorithm> 10 #include <algorithm>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 *result = string_value[0] == 't'; 81 *result = string_value[0] == 't';
82 return true; 82 return true;
83 } 83 }
84 84
85 struct DictionaryIdComparator { 85 struct DictionaryIdComparator {
86 explicit DictionaryIdComparator(icu::Collator* collator) 86 explicit DictionaryIdComparator(icu::Collator* collator)
87 : collator_(collator) { 87 : collator_(collator) {
88 } 88 }
89 89
90 bool operator()(const base::Value* a, 90 bool operator()(const std::unique_ptr<base::Value>& a,
91 const base::Value* b) const { 91 const std::unique_ptr<base::Value>& b) const {
92 DCHECK(a->GetType() == base::Value::TYPE_DICTIONARY); 92 const base::DictionaryValue* a_dict;
93 DCHECK(b->GetType() == base::Value::TYPE_DICTIONARY); 93 bool a_is_dictionary = a->GetAsDictionary(&a_dict);
94 const base::DictionaryValue* a_dict = 94 DCHECK(a_is_dictionary);
95 reinterpret_cast<const base::DictionaryValue*>(a); 95 const base::DictionaryValue* b_dict;
96 const base::DictionaryValue* b_dict = 96 bool b_is_dictionary = b->GetAsDictionary(&b_dict);
97 reinterpret_cast<const base::DictionaryValue*>(b); 97 DCHECK(b_is_dictionary);
98 base::string16 a_str; 98 base::string16 a_str;
99 base::string16 b_str; 99 base::string16 b_str;
100 a_dict->GetString(kNameId, &a_str); 100 a_dict->GetString(kNameId, &a_str);
101 b_dict->GetString(kNameId, &b_str); 101 b_dict->GetString(kNameId, &b_str);
102 if (collator_ == NULL) 102 if (collator_ == NULL)
103 return a_str < b_str; 103 return a_str < b_str;
104 return base::i18n::CompareString16WithCollator(*collator_, a_str, b_str) == 104 return base::i18n::CompareString16WithCollator(*collator_, a_str, b_str) ==
105 UCOL_LESS; 105 UCOL_LESS;
106 } 106 }
107 107
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 title_value, 1226 title_value,
1227 error_value, 1227 error_value,
1228 cert_error_list); 1228 cert_error_list);
1229 } 1229 }
1230 1230
1231 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1231 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1232 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1232 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1233 } 1233 }
1234 1234
1235 } // namespace options 1235 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698