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_win.h" | 5 #include "chrome/browser/password_manager/password_store_win.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
| 10 #include <utility> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/profiler/scoped_tracker.h" | 17 #include "base/profiler/scoped_tracker.h" |
17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
19 #include "components/os_crypt/ie7_password_win.h" | 20 #include "components/os_crypt/ie7_password_win.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 autofill->ssl_valid = form.origin.SchemeIsCryptographic(); | 132 autofill->ssl_valid = form.origin.SchemeIsCryptographic(); |
132 autofill->date_created = info.date_created; | 133 autofill->date_created = info.date_created; |
133 | 134 |
134 matched_forms.push_back(autofill); | 135 matched_forms.push_back(autofill); |
135 // Add this PasswordForm to the saved password table. We're on the DB | 136 // Add this PasswordForm to the saved password table. We're on the DB |
136 // thread already, so we use AddLoginImpl. | 137 // thread already, so we use AddLoginImpl. |
137 password_store_->AddLoginImpl(*autofill); | 138 password_store_->AddLoginImpl(*autofill); |
138 } | 139 } |
139 } | 140 } |
140 } | 141 } |
141 return matched_forms.Pass(); | 142 return matched_forms; |
142 } | 143 } |
143 | 144 |
144 void PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone( | 145 void PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone( |
145 PasswordWebDataService::Handle handle, | 146 PasswordWebDataService::Handle handle, |
146 const WDTypedResult* result) { | 147 const WDTypedResult* result) { |
147 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 148 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
148 // fixed. | 149 // fixed. |
149 tracked_objects::ScopedTracker tracking_profile( | 150 tracked_objects::ScopedTracker tracking_profile( |
150 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 151 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
151 "422460 PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone")); | 152 "422460 PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone")); |
(...skipping 18 matching lines...) Expand all Loading... |
170 result_callback.Run(GetIE7Results(result, *form)); | 171 result_callback.Run(GetIE7Results(result, *form)); |
171 } | 172 } |
172 | 173 |
173 PasswordStoreWin::PasswordStoreWin( | 174 PasswordStoreWin::PasswordStoreWin( |
174 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, | 175 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, |
175 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, | 176 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, |
176 scoped_ptr<password_manager::LoginDatabase> login_db, | 177 scoped_ptr<password_manager::LoginDatabase> login_db, |
177 const scoped_refptr<PasswordWebDataService>& web_data_service) | 178 const scoped_refptr<PasswordWebDataService>& web_data_service) |
178 : PasswordStoreDefault(main_thread_runner, | 179 : PasswordStoreDefault(main_thread_runner, |
179 db_thread_runner, | 180 db_thread_runner, |
180 login_db.Pass()) { | 181 std::move(login_db)) { |
181 db_handler_.reset(new DBHandler(web_data_service, this)); | 182 db_handler_.reset(new DBHandler(web_data_service, this)); |
182 } | 183 } |
183 | 184 |
184 PasswordStoreWin::~PasswordStoreWin() { | 185 PasswordStoreWin::~PasswordStoreWin() { |
185 } | 186 } |
186 | 187 |
187 void PasswordStoreWin::ShutdownOnDBThread() { | 188 void PasswordStoreWin::ShutdownOnDBThread() { |
188 DCHECK_CURRENTLY_ON(BrowserThread::DB); | 189 DCHECK_CURRENTLY_ON(BrowserThread::DB); |
189 db_handler_.reset(); | 190 db_handler_.reset(); |
190 } | 191 } |
(...skipping 15 matching lines...) Expand all Loading... |
206 // TODO(engedy): Make the IE7-specific code synchronous, so FillMatchingLogins | 207 // TODO(engedy): Make the IE7-specific code synchronous, so FillMatchingLogins |
207 // can be overridden instead. See: https://crbug.com/78830. | 208 // can be overridden instead. See: https://crbug.com/78830. |
208 // TODO(engedy): Credentials should be imported into the LoginDatabase in the | 209 // TODO(engedy): Credentials should be imported into the LoginDatabase in the |
209 // first place. See: https://crbug.com/456119. | 210 // first place. See: https://crbug.com/456119. |
210 ScopedVector<autofill::PasswordForm> matched_forms(FillMatchingLogins(form)); | 211 ScopedVector<autofill::PasswordForm> matched_forms(FillMatchingLogins(form)); |
211 if (matched_forms.empty() && db_handler_) { | 212 if (matched_forms.empty() && db_handler_) { |
212 db_handler_->GetIE7Login( | 213 db_handler_->GetIE7Login( |
213 form, base::Bind(&GetLoginsRequest::NotifyConsumerWithResults, | 214 form, base::Bind(&GetLoginsRequest::NotifyConsumerWithResults, |
214 base::Owned(request.release()))); | 215 base::Owned(request.release()))); |
215 } else { | 216 } else { |
216 request->NotifyConsumerWithResults(matched_forms.Pass()); | 217 request->NotifyConsumerWithResults(std::move(matched_forms)); |
217 } | 218 } |
218 } | 219 } |
OLD | NEW |