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

Side by Side Diff: chrome/utility/importer/nss_decryptor.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/utility/importer/nss_decryptor.h" 5 #include "chrome/utility/importer/nss_decryptor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 base::ReadFileToString(json_file, &json_content); 297 base::ReadFileToString(json_file, &json_content);
298 std::unique_ptr<base::Value> parsed_json( 298 std::unique_ptr<base::Value> parsed_json(
299 base::JSONReader::Read(json_content)); 299 base::JSONReader::Read(json_content));
300 const base::DictionaryValue* password_dict; 300 const base::DictionaryValue* password_dict;
301 const base::ListValue* password_list; 301 const base::ListValue* password_list;
302 const base::ListValue* blacklist_domains; 302 const base::ListValue* blacklist_domains;
303 if (!parsed_json || !parsed_json->GetAsDictionary(&password_dict)) 303 if (!parsed_json || !parsed_json->GetAsDictionary(&password_dict))
304 return false; 304 return false;
305 305
306 if (password_dict->GetList("disabledHosts", &blacklist_domains)) { 306 if (password_dict->GetList("disabledHosts", &blacklist_domains)) {
307 for (const base::Value* value : *blacklist_domains) { 307 for (const auto& value : *blacklist_domains) {
308 std::string disabled_host; 308 std::string disabled_host;
309 if (!value->GetAsString(&disabled_host)) 309 if (!value->GetAsString(&disabled_host))
310 continue; 310 continue;
311 forms->push_back(CreateBlacklistPasswordForm(disabled_host)); 311 forms->push_back(CreateBlacklistPasswordForm(disabled_host));
312 } 312 }
313 } 313 }
314 314
315 if (password_dict->GetList("logins", &password_list)) { 315 if (password_dict->GetList("logins", &password_list)) {
316 for (const base::Value* value : *password_list) { 316 for (const auto& value : *password_list) {
317 const base::DictionaryValue* password_detail; 317 const base::DictionaryValue* password_detail;
318 if (!value->GetAsDictionary(&password_detail)) 318 if (!value->GetAsDictionary(&password_detail))
319 continue; 319 continue;
320 320
321 FirefoxRawPasswordInfo raw_password_info; 321 FirefoxRawPasswordInfo raw_password_info;
322 password_detail->GetString("hostname", &raw_password_info.host); 322 password_detail->GetString("hostname", &raw_password_info.host);
323 password_detail->GetString("usernameField", 323 password_detail->GetString("usernameField",
324 &raw_password_info.username_element); 324 &raw_password_info.username_element);
325 password_detail->GetString("passwordField", 325 password_detail->GetString("passwordField",
326 &raw_password_info.password_element); 326 &raw_password_info.password_element);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 373 }
374 form->ssl_valid = form->origin.SchemeIsCryptographic(); 374 form->ssl_valid = form->origin.SchemeIsCryptographic();
375 form->username_element = raw_password_info.username_element; 375 form->username_element = raw_password_info.username_element;
376 form->username_value = Decrypt(raw_password_info.encrypted_username); 376 form->username_value = Decrypt(raw_password_info.encrypted_username);
377 form->password_element = raw_password_info.password_element; 377 form->password_element = raw_password_info.password_element;
378 form->password_value = Decrypt(raw_password_info.encrypted_password); 378 form->password_value = Decrypt(raw_password_info.encrypted_password);
379 form->action = GURL(raw_password_info.form_action).ReplaceComponents(rep); 379 form->action = GURL(raw_password_info.form_action).ReplaceComponents(rep);
380 380
381 return true; 381 return true;
382 } 382 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/performance_logger.cc ('k') | chromecast/crash/linux/crash_testing_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698