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

Side by Side Diff: components/password_manager/core/browser/password_manager.cc

Issue 184103016: Autofill: Refactoring to support fetching password after a username is selected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address gcasto's comments. Created 6 years, 9 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 "components/password_manager/core/browser/password_manager.h" 5 #include "components/password_manager/core/browser/password_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/threading/platform_thread.h" 13 #include "base/threading/platform_thread.h"
14 #include "components/autofill/core/common/password_autofill_util.h" 14 #include "components/autofill/core/common/password_autofill_util.h"
15 #include "components/password_manager/core/browser/password_autofill_manager.h"
15 #include "components/password_manager/core/browser/password_form_manager.h" 16 #include "components/password_manager/core/browser/password_form_manager.h"
16 #include "components/password_manager/core/browser/password_manager_client.h" 17 #include "components/password_manager/core/browser/password_manager_client.h"
17 #include "components/password_manager/core/browser/password_manager_driver.h" 18 #include "components/password_manager/core/browser/password_manager_driver.h"
18 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 19 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
19 #include "components/password_manager/core/common/password_manager_pref_names.h" 20 #include "components/password_manager/core/common/password_manager_pref_names.h"
20 #include "components/user_prefs/pref_registry_syncable.h" 21 #include "components/user_prefs/pref_registry_syncable.h"
21 22
22 using autofill::PasswordForm; 23 using autofill::PasswordForm;
23 using autofill::PasswordFormMap; 24 using autofill::PasswordFormMap;
24 25
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 observers_.AddObserver(observer); 220 observers_.AddObserver(observer);
220 } 221 }
221 222
222 void PasswordManager::RemoveObserver(LoginModelObserver* observer) { 223 void PasswordManager::RemoveObserver(LoginModelObserver* observer) {
223 observers_.RemoveObserver(observer); 224 observers_.RemoveObserver(observer);
224 } 225 }
225 226
226 void PasswordManager::DidNavigateMainFrame(bool is_in_page) { 227 void PasswordManager::DidNavigateMainFrame(bool is_in_page) {
227 // Clear data after main frame navigation if the navigation was to a 228 // Clear data after main frame navigation if the navigation was to a
228 // different page. 229 // different page.
229 if (!is_in_page) 230 if (!is_in_page) {
230 pending_login_managers_.clear(); 231 pending_login_managers_.clear();
232 driver_->GetPasswordAutofillManager()->Reset();
233 }
231 } 234 }
232 235
233 void PasswordManager::OnPasswordFormSubmitted( 236 void PasswordManager::OnPasswordFormSubmitted(
234 const PasswordForm& password_form) { 237 const PasswordForm& password_form) {
235 ProvisionallySavePassword(password_form); 238 ProvisionallySavePassword(password_form);
236 for (size_t i = 0; i < submission_callbacks_.size(); ++i) { 239 for (size_t i = 0; i < submission_callbacks_.size(); ++i) {
237 submission_callbacks_[i].Run(password_form); 240 submission_callbacks_[i].Run(password_form);
238 } 241 }
239 242
240 pending_login_managers_.clear(); 243 pending_login_managers_.clear();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 FOR_EACH_OBSERVER( 388 FOR_EACH_OBSERVER(
386 LoginModelObserver, 389 LoginModelObserver,
387 observers_, 390 observers_,
388 OnAutofillDataAvailable(preferred_match.username_value, 391 OnAutofillDataAvailable(preferred_match.username_value,
389 preferred_match.password_value)); 392 preferred_match.password_value));
390 break; 393 break;
391 } 394 }
392 395
393 client_->PasswordWasAutofilled(best_matches); 396 client_->PasswordWasAutofilled(best_matches);
394 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698