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

Side by Side Diff: chrome/browser/ui/webui/settings/certificates_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, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/certificates_handler.h" 5 #include "chrome/browser/ui/webui/settings/certificates_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 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 }; 81 };
82 82
83 std::string OrgNameToId(const std::string& org) { 83 std::string OrgNameToId(const std::string& org) {
84 return "org-" + org; 84 return "org-" + org;
85 } 85 }
86 86
87 struct DictionaryIdComparator { 87 struct DictionaryIdComparator {
88 explicit DictionaryIdComparator(icu::Collator* collator) 88 explicit DictionaryIdComparator(icu::Collator* collator)
89 : collator_(collator) {} 89 : collator_(collator) {}
90 90
91 bool operator()(const base::Value* a, const base::Value* b) const { 91 bool operator()(const std::unique_ptr<base::Value>& a,
92 const std::unique_ptr<base::Value>& b) const {
92 DCHECK(a->GetType() == base::Value::TYPE_DICTIONARY); 93 DCHECK(a->GetType() == base::Value::TYPE_DICTIONARY);
93 DCHECK(b->GetType() == base::Value::TYPE_DICTIONARY); 94 DCHECK(b->GetType() == base::Value::TYPE_DICTIONARY);
94 const base::DictionaryValue* a_dict = 95 const base::DictionaryValue* a_dict;
95 reinterpret_cast<const base::DictionaryValue*>(a); 96 bool a_is_dictionary = a->GetAsDictionary(&a_dict);
96 const base::DictionaryValue* b_dict = 97 DCHECK(a_is_dictionary);
97 reinterpret_cast<const base::DictionaryValue*>(b); 98 const base::DictionaryValue* b_dict;
99 bool b_is_dictionary = b->GetAsDictionary(&b_dict);
100 DCHECK(b_is_dictionary);
98 base::string16 a_str; 101 base::string16 a_str;
99 base::string16 b_str; 102 base::string16 b_str;
100 a_dict->GetString(kNameField, &a_str); 103 a_dict->GetString(kNameField, &a_str);
101 b_dict->GetString(kNameField, &b_str); 104 b_dict->GetString(kNameField, &b_str);
102 if (collator_ == NULL) 105 if (collator_ == NULL)
103 return a_str < b_str; 106 return a_str < b_str;
104 return base::i18n::CompareString16WithCollator(*collator_, a_str, b_str) == 107 return base::i18n::CompareString16WithCollator(*collator_, a_str, b_str) ==
105 UCOL_LESS; 108 UCOL_LESS;
106 } 109 }
107 110
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 error_info->Set(kCertificateErrors, 1140 error_info->Set(kCertificateErrors,
1138 base::WrapUnique(cert_error_list.release())); 1141 base::WrapUnique(cert_error_list.release()));
1139 RejectCallback(*error_info); 1142 RejectCallback(*error_info);
1140 } 1143 }
1141 1144
1142 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { 1145 gfx::NativeWindow CertificatesHandler::GetParentWindow() const {
1143 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1146 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1144 } 1147 }
1145 1148
1146 } // namespace settings 1149 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/display_options_handler.cc ('k') | chrome/browser/ui/webui/site_settings_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698