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

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

Issue 153943002: Eliminate BrowserThread usage from PasswordStoreDefault. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 10 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 | Annotate | Revision Log
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_default.h" 5 #include "chrome/browser/password_manager/password_store_default.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/password_manager/password_store_change.h" 13 #include "chrome/browser/password_manager/password_store_change.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
19 18
20 using autofill::PasswordForm; 19 using autofill::PasswordForm;
21 using content::BrowserThread;
22 20
23 PasswordStoreDefault::PasswordStoreDefault( 21 PasswordStoreDefault::PasswordStoreDefault(
24 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, 22 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
25 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, 23 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
26 LoginDatabase* login_db, 24 LoginDatabase* login_db,
27 Profile* profile) 25 Profile* profile)
28 : PasswordStore(main_thread_runner, db_thread_runner), 26 : PasswordStore(main_thread_runner, db_thread_runner),
29 login_db_(login_db), 27 login_db_(login_db),
30 profile_(profile) { 28 profile_(profile) {
31 DCHECK(login_db); 29 DCHECK(login_db);
32 DCHECK(profile); 30 DCHECK(profile);
33 } 31 }
34 32
35 PasswordStoreDefault::~PasswordStoreDefault() { 33 PasswordStoreDefault::~PasswordStoreDefault() {
36 } 34 }
37 35
38 void PasswordStoreDefault::ShutdownOnUIThread() { 36 void PasswordStoreDefault::ShutdownOnUIThread() {
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 37 DCHECK(main_thread_runner_->BelongsToCurrentThread());
40 profile_ = NULL; 38 profile_ = NULL;
41 } 39 }
42 40
43 void PasswordStoreDefault::ReportMetricsImpl() { 41 void PasswordStoreDefault::ReportMetricsImpl() {
44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 42 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
45 login_db_->ReportMetrics(); 43 login_db_->ReportMetrics();
46 } 44 }
47 45
48 void PasswordStoreDefault::AddLoginImpl(const PasswordForm& form) { 46 void PasswordStoreDefault::AddLoginImpl(const PasswordForm& form) {
49 if (login_db_->AddLogin(form)) { 47 if (login_db_->AddLogin(form)) {
50 PasswordStoreChangeList changes; 48 PasswordStoreChangeList changes;
51 changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); 49 changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form));
52 content::NotificationService::current()->Notify( 50 content::NotificationService::current()->Notify(
53 chrome::NOTIFICATION_LOGINS_CHANGED, 51 chrome::NOTIFICATION_LOGINS_CHANGED,
54 content::Source<PasswordStore>(this), 52 content::Source<PasswordStore>(this),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 113 }
116 114
117 void PasswordStoreDefault::GetBlacklistLoginsImpl( 115 void PasswordStoreDefault::GetBlacklistLoginsImpl(
118 GetLoginsRequest* request) { 116 GetLoginsRequest* request) {
119 FillBlacklistLogins(request->result()); 117 FillBlacklistLogins(request->result());
120 ForwardLoginsResult(request); 118 ForwardLoginsResult(request);
121 } 119 }
122 120
123 bool PasswordStoreDefault::FillAutofillableLogins( 121 bool PasswordStoreDefault::FillAutofillableLogins(
124 std::vector<PasswordForm*>* forms) { 122 std::vector<PasswordForm*>* forms) {
125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 123 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
126 return login_db_->GetAutofillableLogins(forms); 124 return login_db_->GetAutofillableLogins(forms);
127 } 125 }
128 126
129 bool PasswordStoreDefault::FillBlacklistLogins( 127 bool PasswordStoreDefault::FillBlacklistLogins(
130 std::vector<PasswordForm*>* forms) { 128 std::vector<PasswordForm*>* forms) {
131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 129 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
132 return login_db_->GetBlacklistLogins(forms); 130 return login_db_->GetBlacklistLogins(forms);
133 } 131 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store.cc ('k') | chrome/browser/password_manager/password_store_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698