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

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

Issue 2403773002: Remove stl_util's STLDeleteContainerPointers from autofill. (Closed)
Patch Set: rebase Created 4 years, 2 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_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 <memory> 10 #include <memory>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // Gets logins from IE7 if no others are found. Also copies them into 64 // Gets logins from IE7 if no others are found. Also copies them into
65 // Chrome's WebDatabase so we don't need to look next time. 65 // Chrome's WebDatabase so we don't need to look next time.
66 std::vector<std::unique_ptr<PasswordForm>> GetIE7Results( 66 std::vector<std::unique_ptr<PasswordForm>> GetIE7Results(
67 const WDTypedResult* result, 67 const WDTypedResult* result,
68 const PasswordStore::FormDigest& form); 68 const PasswordStore::FormDigest& form);
69 69
70 // WebDataServiceConsumer implementation. 70 // WebDataServiceConsumer implementation.
71 void OnWebDataServiceRequestDone( 71 void OnWebDataServiceRequestDone(
72 PasswordWebDataService::Handle handle, 72 PasswordWebDataService::Handle handle,
73 const WDTypedResult* result) override; 73 std::unique_ptr<WDTypedResult> result) override;
74 74
75 scoped_refptr<PasswordWebDataService> web_data_service_; 75 scoped_refptr<PasswordWebDataService> web_data_service_;
76 76
77 // This creates a cycle between us and PasswordStore. The cycle is broken 77 // This creates a cycle between us and PasswordStore. The cycle is broken
78 // from PasswordStoreWin::ShutdownOnUIThread, which deletes us. 78 // from PasswordStoreWin::ShutdownOnUIThread, which deletes us.
79 scoped_refptr<PasswordStoreWin> password_store_; 79 scoped_refptr<PasswordStoreWin> password_store_;
80 80
81 PendingRequestMap pending_requests_; 81 PendingRequestMap pending_requests_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(DBHandler); 83 DISALLOW_COPY_AND_ASSIGN(DBHandler);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 password_store_->AddLoginImpl(*matched_form); 139 password_store_->AddLoginImpl(*matched_form);
140 matched_forms.push_back(std::move(matched_form)); 140 matched_forms.push_back(std::move(matched_form));
141 } 141 }
142 } 142 }
143 } 143 }
144 return matched_forms; 144 return matched_forms;
145 } 145 }
146 146
147 void PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone( 147 void PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone(
148 PasswordWebDataService::Handle handle, 148 PasswordWebDataService::Handle handle,
149 const WDTypedResult* result) { 149 std::unique_ptr<WDTypedResult> result) {
150 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is 150 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is
151 // fixed. 151 // fixed.
152 tracked_objects::ScopedTracker tracking_profile( 152 tracked_objects::ScopedTracker tracking_profile(
153 FROM_HERE_WITH_EXPLICIT_FUNCTION( 153 FROM_HERE_WITH_EXPLICIT_FUNCTION(
154 "422460 PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone")); 154 "422460 PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone"));
155 155
156 DCHECK_CURRENTLY_ON(BrowserThread::DB); 156 DCHECK_CURRENTLY_ON(BrowserThread::DB);
157 157
158 PendingRequestMap::iterator i = pending_requests_.find(handle); 158 PendingRequestMap::iterator i = pending_requests_.find(handle);
159 DCHECK(i != pending_requests_.end()); 159 DCHECK(i != pending_requests_.end());
160 160
161 ResultCallback result_callback(i->second.result_callback); 161 ResultCallback result_callback(i->second.result_callback);
162 std::unique_ptr<PasswordStore::FormDigest> form = std::move(i->second.form); 162 std::unique_ptr<PasswordStore::FormDigest> form = std::move(i->second.form);
163 pending_requests_.erase(i); 163 pending_requests_.erase(i);
164 164
165 if (!result) { 165 if (!result) {
166 // The WDS returns NULL if it is shutting down. Run callback with empty 166 // The WDS returns NULL if it is shutting down. Run callback with empty
167 // result. 167 // result.
168 result_callback.Run(std::vector<std::unique_ptr<PasswordForm>>()); 168 result_callback.Run(std::vector<std::unique_ptr<PasswordForm>>());
169 return; 169 return;
170 } 170 }
171 171
172 DCHECK_EQ(PASSWORD_IE7_RESULT, result->GetType()); 172 DCHECK_EQ(PASSWORD_IE7_RESULT, result->GetType());
173 result_callback.Run(GetIE7Results(result, *form)); 173 result_callback.Run(GetIE7Results(result.get(), *form));
174 } 174 }
175 175
176 PasswordStoreWin::PasswordStoreWin( 176 PasswordStoreWin::PasswordStoreWin(
177 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, 177 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
178 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, 178 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
179 std::unique_ptr<password_manager::LoginDatabase> login_db, 179 std::unique_ptr<password_manager::LoginDatabase> login_db,
180 const scoped_refptr<PasswordWebDataService>& web_data_service) 180 const scoped_refptr<PasswordWebDataService>& web_data_service)
181 : PasswordStoreDefault(main_thread_runner, 181 : PasswordStoreDefault(main_thread_runner,
182 db_thread_runner, 182 db_thread_runner,
183 std::move(login_db)) { 183 std::move(login_db)) {
(...skipping 30 matching lines...) Expand all
214 std::vector<std::unique_ptr<PasswordForm>> matched_forms( 214 std::vector<std::unique_ptr<PasswordForm>> matched_forms(
215 FillMatchingLogins(form)); 215 FillMatchingLogins(form));
216 if (matched_forms.empty() && db_handler_) { 216 if (matched_forms.empty() && db_handler_) {
217 db_handler_->GetIE7Login( 217 db_handler_->GetIE7Login(
218 form, base::Bind(&GetLoginsRequest::NotifyConsumerWithResults, 218 form, base::Bind(&GetLoginsRequest::NotifyConsumerWithResults,
219 base::Owned(request.release()))); 219 base::Owned(request.release())));
220 } else { 220 } else {
221 request->NotifyConsumerWithResults(std::move(matched_forms)); 221 request->NotifyConsumerWithResults(std::move(matched_forms));
222 } 222 }
223 } 223 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/form_structure_browsertest.cc ('k') | chrome/browser/password_manager/password_store_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698