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

Side by Side Diff: chrome/browser/password_manager/password_store_x.cc

Issue 1858513002: chrome/browser/password_manager: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows -- revert unwanted change 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/browser/password_manager/password_store_x.h" 5 #include "chrome/browser/password_manager/password_store_x.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 10 matching lines...) Expand all
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 22
23 using autofill::PasswordForm; 23 using autofill::PasswordForm;
24 using content::BrowserThread; 24 using content::BrowserThread;
25 using password_manager::PasswordStoreChange; 25 using password_manager::PasswordStoreChange;
26 using password_manager::PasswordStoreChangeList; 26 using password_manager::PasswordStoreChangeList;
27 using password_manager::PasswordStoreDefault; 27 using password_manager::PasswordStoreDefault;
28 28
29 namespace { 29 namespace {
30 30
31 bool AddLoginToBackend(const scoped_ptr<PasswordStoreX::NativeBackend>& backend, 31 bool AddLoginToBackend(
32 const PasswordForm& form, 32 const std::unique_ptr<PasswordStoreX::NativeBackend>& backend,
33 PasswordStoreChangeList* changes) { 33 const PasswordForm& form,
34 PasswordStoreChangeList* changes) {
34 *changes = backend->AddLogin(form); 35 *changes = backend->AddLogin(form);
35 return (!changes->empty() && 36 return (!changes->empty() &&
36 changes->back().type() == PasswordStoreChange::ADD); 37 changes->back().type() == PasswordStoreChange::ADD);
37 } 38 }
38 39
39 bool RemoveLoginsByURLAndTimeFromBackend( 40 bool RemoveLoginsByURLAndTimeFromBackend(
40 PasswordStoreX::NativeBackend* backend, 41 PasswordStoreX::NativeBackend* backend,
41 const base::Callback<bool(const GURL&)>& url_filter, 42 const base::Callback<bool(const GURL&)>& url_filter,
42 base::Time delete_begin, 43 base::Time delete_begin,
43 base::Time delete_end, 44 base::Time delete_end,
(...skipping 10 matching lines...) Expand all
54 } 55 }
55 56
56 return true; 57 return true;
57 } 58 }
58 59
59 } // namespace 60 } // namespace
60 61
61 PasswordStoreX::PasswordStoreX( 62 PasswordStoreX::PasswordStoreX(
62 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, 63 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
63 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, 64 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
64 scoped_ptr<password_manager::LoginDatabase> login_db, 65 std::unique_ptr<password_manager::LoginDatabase> login_db,
65 NativeBackend* backend) 66 NativeBackend* backend)
66 : PasswordStoreDefault(main_thread_runner, 67 : PasswordStoreDefault(main_thread_runner,
67 db_thread_runner, 68 db_thread_runner,
68 std::move(login_db)), 69 std::move(login_db)),
69 backend_(backend), 70 backend_(backend),
70 migration_checked_(!backend), 71 migration_checked_(!backend),
71 allow_fallback_(false) {} 72 allow_fallback_(false) {}
72 73
73 PasswordStoreX::~PasswordStoreX() {} 74 PasswordStoreX::~PasswordStoreX() {}
74 75
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // Finally, delete the database file itself. We remove the passwords from 303 // Finally, delete the database file itself. We remove the passwords from
303 // it before deleting the file just in case there is some problem deleting 304 // it before deleting the file just in case there is some problem deleting
304 // the file (e.g. directory is not writable, but file is), which would 305 // the file (e.g. directory is not writable, but file is), which would
305 // otherwise cause passwords to re-migrate next (or maybe every) time. 306 // otherwise cause passwords to re-migrate next (or maybe every) time.
306 DeleteAndRecreateDatabaseFile(); 307 DeleteAndRecreateDatabaseFile();
307 } 308 }
308 } 309 }
309 ssize_t result = ok ? forms.size() : -1; 310 ssize_t result = ok ? forms.size() : -1;
310 return result; 311 return result;
311 } 312 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_x.h ('k') | chrome/browser/password_manager/password_store_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698