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

Side by Side Diff: chrome/utility/importer/nss_decryptor.cc

Issue 1899083002: Convert //chrome from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/base64.h" 13 #include "base/base64.h"
13 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
14 #include "base/json/json_reader.h" 15 #include "base/json/json_reader.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "components/autofill/core/common/password_form.h" 20 #include "components/autofill/core/common/password_form.h"
21 #include "sql/connection.h" 21 #include "sql/connection.h"
22 #include "sql/statement.h" 22 #include "sql/statement.h"
23 23
24 #if defined(USE_NSS_CERTS) 24 #if defined(USE_NSS_CERTS)
25 #include <pk11pub.h> 25 #include <pk11pub.h>
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 forms->push_back(form); 288 forms->push_back(form);
289 } 289 }
290 return true; 290 return true;
291 } 291 }
292 292
293 bool NSSDecryptor::ReadAndParseLogins( 293 bool NSSDecryptor::ReadAndParseLogins(
294 const base::FilePath& json_file, 294 const base::FilePath& json_file,
295 std::vector<autofill::PasswordForm>* forms) { 295 std::vector<autofill::PasswordForm>* forms) {
296 std::string json_content; 296 std::string json_content;
297 base::ReadFileToString(json_file, &json_content); 297 base::ReadFileToString(json_file, &json_content);
298 scoped_ptr<base::Value> parsed_json(base::JSONReader::Read(json_content)); 298 std::unique_ptr<base::Value> parsed_json(
299 base::JSONReader::Read(json_content));
299 const base::DictionaryValue* password_dict; 300 const base::DictionaryValue* password_dict;
300 const base::ListValue* password_list; 301 const base::ListValue* password_list;
301 const base::ListValue* blacklist_domains; 302 const base::ListValue* blacklist_domains;
302 if (!parsed_json || !parsed_json->GetAsDictionary(&password_dict)) 303 if (!parsed_json || !parsed_json->GetAsDictionary(&password_dict))
303 return false; 304 return false;
304 305
305 if (password_dict->GetList("disabledHosts", &blacklist_domains)) { 306 if (password_dict->GetList("disabledHosts", &blacklist_domains)) {
306 for (const base::Value* value : *blacklist_domains) { 307 for (const base::Value* value : *blacklist_domains) {
307 std::string disabled_host; 308 std::string disabled_host;
308 if (!value->GetAsString(&disabled_host)) 309 if (!value->GetAsString(&disabled_host))
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 373 }
373 form->ssl_valid = form->origin.SchemeIsCryptographic(); 374 form->ssl_valid = form->origin.SchemeIsCryptographic();
374 form->username_element = raw_password_info.username_element; 375 form->username_element = raw_password_info.username_element;
375 form->username_value = Decrypt(raw_password_info.encrypted_username); 376 form->username_value = Decrypt(raw_password_info.encrypted_username);
376 form->password_element = raw_password_info.password_element; 377 form->password_element = raw_password_info.password_element;
377 form->password_value = Decrypt(raw_password_info.encrypted_password); 378 form->password_value = Decrypt(raw_password_info.encrypted_password);
378 form->action = GURL(raw_password_info.form_action).ReplaceComponents(rep); 379 form->action = GURL(raw_password_info.form_action).ReplaceComponents(rep);
379 380
380 return true; 381 return true;
381 } 382 }
OLDNEW
« no previous file with comments | « chrome/utility/importer/firefox_importer_unittest_utils_mac.cc ('k') | chrome/utility/media_galleries/media_metadata_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698