| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_form_manager.h" | 5 #include "chrome/browser/password_manager/password_form_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 DCHECK(!best_matches_.empty()); | 286 DCHECK(!best_matches_.empty()); |
| 287 if (!preferred_match_) | 287 if (!preferred_match_) |
| 288 preferred_match_ = best_matches_.begin()->second; | 288 preferred_match_ = best_matches_.begin()->second; |
| 289 | 289 |
| 290 // Check to see if the user told us to ignore this site in the past. | 290 // Check to see if the user told us to ignore this site in the past. |
| 291 if (preferred_match_->blacklisted_by_user) { | 291 if (preferred_match_->blacklisted_by_user) { |
| 292 manager_action_ = kManagerActionBlacklisted; | 292 manager_action_ = kManagerActionBlacklisted; |
| 293 return; | 293 return; |
| 294 } | 294 } |
| 295 | 295 |
| 296 // Proceed to autofill (note that we provide the choices but don't | 296 // Proceed to autofill. |
| 297 // actually prefill a value if the ACTION paths don't match). | 297 // Note that we provide the choices but don't actually prefill a value if |
| 298 bool wait_for_username = observed_form_.action.GetWithEmptyPath() != | 298 // either: (1) we are in Incognito mode, or (2) the ACTION paths don't match. |
| 299 preferred_match_->action.GetWithEmptyPath(); | 299 bool wait_for_username = |
| 300 profile_->IsOffTheRecord() || |
| 301 observed_form_.action.GetWithEmptyPath() != |
| 302 preferred_match_->action.GetWithEmptyPath(); |
| 300 if (wait_for_username) | 303 if (wait_for_username) |
| 301 manager_action_ = kManagerActionNone; | 304 manager_action_ = kManagerActionNone; |
| 302 else | 305 else |
| 303 manager_action_ = kManagerActionAutofilled; | 306 manager_action_ = kManagerActionAutofilled; |
| 304 password_manager_->Autofill(observed_form_, best_matches_, | 307 password_manager_->Autofill(observed_form_, best_matches_, |
| 305 preferred_match_, wait_for_username); | 308 preferred_match_, wait_for_username); |
| 306 } | 309 } |
| 307 | 310 |
| 308 void PasswordFormManager::OnPasswordStoreRequestDone( | 311 void PasswordFormManager::OnPasswordStoreRequestDone( |
| 309 CancelableRequestProvider::Handle handle, | 312 CancelableRequestProvider::Handle handle, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 return score; | 474 return score; |
| 472 } | 475 } |
| 473 | 476 |
| 474 void PasswordFormManager::SubmitPassed() { | 477 void PasswordFormManager::SubmitPassed() { |
| 475 submit_result_ = kSubmitResultPassed; | 478 submit_result_ = kSubmitResultPassed; |
| 476 } | 479 } |
| 477 | 480 |
| 478 void PasswordFormManager::SubmitFailed() { | 481 void PasswordFormManager::SubmitFailed() { |
| 479 submit_result_ = kSubmitResultFailed; | 482 submit_result_ = kSubmitResultFailed; |
| 480 } | 483 } |
| OLD | NEW |