OLD | NEW |
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" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
19 | 19 |
| 20 using autofill::PasswordForm; |
20 using content::BrowserThread; | 21 using content::BrowserThread; |
21 using content::PasswordForm; | |
22 | 22 |
23 PasswordStoreDefault::PasswordStoreDefault(LoginDatabase* login_db, | 23 PasswordStoreDefault::PasswordStoreDefault(LoginDatabase* login_db, |
24 Profile* profile) | 24 Profile* profile) |
25 : login_db_(login_db), profile_(profile) { | 25 : login_db_(login_db), profile_(profile) { |
26 DCHECK(login_db); | 26 DCHECK(login_db); |
27 DCHECK(profile); | 27 DCHECK(profile); |
28 } | 28 } |
29 | 29 |
30 PasswordStoreDefault::~PasswordStoreDefault() { | 30 PasswordStoreDefault::~PasswordStoreDefault() { |
31 } | 31 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 content::NotificationService::current()->Notify( | 87 content::NotificationService::current()->Notify( |
88 chrome::NOTIFICATION_LOGINS_CHANGED, | 88 chrome::NOTIFICATION_LOGINS_CHANGED, |
89 content::Source<PasswordStore>(this), | 89 content::Source<PasswordStore>(this), |
90 content::Details<PasswordStoreChangeList>(&changes)); | 90 content::Details<PasswordStoreChangeList>(&changes)); |
91 } | 91 } |
92 } | 92 } |
93 STLDeleteElements(&forms); | 93 STLDeleteElements(&forms); |
94 } | 94 } |
95 | 95 |
96 void PasswordStoreDefault::GetLoginsImpl( | 96 void PasswordStoreDefault::GetLoginsImpl( |
97 const content::PasswordForm& form, | 97 const autofill::PasswordForm& form, |
98 const ConsumerCallbackRunner& callback_runner) { | 98 const ConsumerCallbackRunner& callback_runner) { |
99 std::vector<PasswordForm*> matched_forms; | 99 std::vector<PasswordForm*> matched_forms; |
100 login_db_->GetLogins(form, &matched_forms); | 100 login_db_->GetLogins(form, &matched_forms); |
101 callback_runner.Run(matched_forms); | 101 callback_runner.Run(matched_forms); |
102 } | 102 } |
103 | 103 |
104 void PasswordStoreDefault::GetAutofillableLoginsImpl( | 104 void PasswordStoreDefault::GetAutofillableLoginsImpl( |
105 GetLoginsRequest* request) { | 105 GetLoginsRequest* request) { |
106 FillAutofillableLogins(&request->value); | 106 FillAutofillableLogins(&request->value); |
107 ForwardLoginsResult(request); | 107 ForwardLoginsResult(request); |
108 } | 108 } |
109 | 109 |
110 void PasswordStoreDefault::GetBlacklistLoginsImpl( | 110 void PasswordStoreDefault::GetBlacklistLoginsImpl( |
111 GetLoginsRequest* request) { | 111 GetLoginsRequest* request) { |
112 FillBlacklistLogins(&request->value); | 112 FillBlacklistLogins(&request->value); |
113 ForwardLoginsResult(request); | 113 ForwardLoginsResult(request); |
114 } | 114 } |
115 | 115 |
116 bool PasswordStoreDefault::FillAutofillableLogins( | 116 bool PasswordStoreDefault::FillAutofillableLogins( |
117 std::vector<PasswordForm*>* forms) { | 117 std::vector<PasswordForm*>* forms) { |
118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
119 return login_db_->GetAutofillableLogins(forms); | 119 return login_db_->GetAutofillableLogins(forms); |
120 } | 120 } |
121 | 121 |
122 bool PasswordStoreDefault::FillBlacklistLogins( | 122 bool PasswordStoreDefault::FillBlacklistLogins( |
123 std::vector<PasswordForm*>* forms) { | 123 std::vector<PasswordForm*>* forms) { |
124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
125 return login_db_->GetBlacklistLogins(forms); | 125 return login_db_->GetBlacklistLogins(forms); |
126 } | 126 } |
OLD | NEW |