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/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "chrome/browser/password_manager/password_store_change.h" | 11 #include "chrome/browser/password_manager/password_store_change.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.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 content::BrowserThread; | 20 using content::BrowserThread; |
21 using webkit::forms::PasswordForm; | 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 GetLoginsRequest* request, const webkit::forms::PasswordForm& form) { | 97 GetLoginsRequest* request, const content::PasswordForm& form) { |
98 login_db_->GetLogins(form, &request->value); | 98 login_db_->GetLogins(form, &request->value); |
99 ForwardLoginsResult(request); | 99 ForwardLoginsResult(request); |
100 } | 100 } |
101 | 101 |
102 void PasswordStoreDefault::GetAutofillableLoginsImpl( | 102 void PasswordStoreDefault::GetAutofillableLoginsImpl( |
103 GetLoginsRequest* request) { | 103 GetLoginsRequest* request) { |
104 FillAutofillableLogins(&request->value); | 104 FillAutofillableLogins(&request->value); |
105 ForwardLoginsResult(request); | 105 ForwardLoginsResult(request); |
106 } | 106 } |
107 | 107 |
108 void PasswordStoreDefault::GetBlacklistLoginsImpl( | 108 void PasswordStoreDefault::GetBlacklistLoginsImpl( |
109 GetLoginsRequest* request) { | 109 GetLoginsRequest* request) { |
110 FillBlacklistLogins(&request->value); | 110 FillBlacklistLogins(&request->value); |
111 ForwardLoginsResult(request); | 111 ForwardLoginsResult(request); |
112 } | 112 } |
113 | 113 |
114 bool PasswordStoreDefault::FillAutofillableLogins( | 114 bool PasswordStoreDefault::FillAutofillableLogins( |
115 std::vector<PasswordForm*>* forms) { | 115 std::vector<PasswordForm*>* forms) { |
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
117 return login_db_->GetAutofillableLogins(forms); | 117 return login_db_->GetAutofillableLogins(forms); |
118 } | 118 } |
119 | 119 |
120 bool PasswordStoreDefault::FillBlacklistLogins( | 120 bool PasswordStoreDefault::FillBlacklistLogins( |
121 std::vector<PasswordForm*>* forms) { | 121 std::vector<PasswordForm*>* forms) { |
122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
123 return login_db_->GetBlacklistLogins(forms); | 123 return login_db_->GetBlacklistLogins(forms); |
124 } | 124 } |
OLD | NEW |