| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_autofill_manager.h" | 5 #include "components/password_manager/core/browser/password_autofill_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/i18n/case_conversion.h" | 13 #include "base/i18n/case_conversion.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "components/autofill/core/browser/autofill_driver.h" | 20 #include "components/autofill/core/browser/autofill_client.h" |
| 21 #include "components/autofill/core/browser/autofill_experiments.h" | 21 #include "components/autofill/core/browser/autofill_experiments.h" |
| 22 #include "components/autofill/core/browser/popup_item_ids.h" | 22 #include "components/autofill/core/browser/popup_item_ids.h" |
| 23 #include "components/autofill/core/browser/suggestion.h" | 23 #include "components/autofill/core/browser/suggestion.h" |
| 24 #include "components/autofill/core/common/autofill_constants.h" | 24 #include "components/autofill/core/common/autofill_constants.h" |
| 25 #include "components/autofill/core/common/autofill_data_validation.h" | 25 #include "components/autofill/core/common/autofill_data_validation.h" |
| 26 #include "components/autofill/core/common/autofill_util.h" | 26 #include "components/autofill/core/common/autofill_util.h" |
| 27 #include "components/password_manager/core/browser/affiliation_utils.h" | 27 #include "components/password_manager/core/browser/affiliation_utils.h" |
| 28 #include "components/password_manager/core/browser/password_manager_driver.h" | 28 #include "components/password_manager/core/browser/password_manager_driver.h" |
| 29 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 29 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 30 #include "components/security_state/core/security_state.h" | 30 #include "components/security_state/core/security_state.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } // namespace | 131 } // namespace |
| 132 | 132 |
| 133 //////////////////////////////////////////////////////////////////////////////// | 133 //////////////////////////////////////////////////////////////////////////////// |
| 134 // PasswordAutofillManager, public: | 134 // PasswordAutofillManager, public: |
| 135 | 135 |
| 136 PasswordAutofillManager::PasswordAutofillManager( | 136 PasswordAutofillManager::PasswordAutofillManager( |
| 137 PasswordManagerDriver* password_manager_driver, | 137 PasswordManagerDriver* password_manager_driver, |
| 138 autofill::AutofillClient* autofill_client) | 138 autofill::AutofillClient* autofill_client) |
| 139 : password_manager_driver_(password_manager_driver), | 139 : password_manager_driver_(password_manager_driver), |
| 140 autofill_client_(autofill_client), | 140 autofill_client_(autofill_client), |
| 141 weak_ptr_factory_(this) { | 141 weak_ptr_factory_(this) {} |
| 142 } | |
| 143 | 142 |
| 144 PasswordAutofillManager::~PasswordAutofillManager() { | 143 PasswordAutofillManager::~PasswordAutofillManager() { |
| 145 } | 144 } |
| 146 | 145 |
| 147 bool PasswordAutofillManager::FillSuggestion(int key, | 146 bool PasswordAutofillManager::FillSuggestion(int key, |
| 148 const base::string16& username) { | 147 const base::string16& username) { |
| 149 autofill::PasswordFormFillData fill_data; | 148 autofill::PasswordFormFillData fill_data; |
| 150 autofill::PasswordAndRealm password_and_realm; | 149 autofill::PasswordAndRealm password_and_realm; |
| 151 if (FindLoginInfo(key, &fill_data) && | 150 if (FindLoginInfo(key, &fill_data) && |
| 152 GetPasswordAndRealmForUsername( | 151 GetPasswordAndRealmForUsername( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 345 } |
| 347 | 346 |
| 348 void PasswordAutofillManager::ClearPreviewedForm() { | 347 void PasswordAutofillManager::ClearPreviewedForm() { |
| 349 password_manager_driver_->ClearPreviewedForm(); | 348 password_manager_driver_->ClearPreviewedForm(); |
| 350 } | 349 } |
| 351 | 350 |
| 352 bool PasswordAutofillManager::IsCreditCardPopup() { | 351 bool PasswordAutofillManager::IsCreditCardPopup() { |
| 353 return false; | 352 return false; |
| 354 } | 353 } |
| 355 | 354 |
| 355 autofill::AutofillDriver* PasswordAutofillManager::GetAutofillDriver() { |
| 356 return password_manager_driver_->GetAutofillDriver(); |
| 357 } |
| 358 |
| 356 //////////////////////////////////////////////////////////////////////////////// | 359 //////////////////////////////////////////////////////////////////////////////// |
| 357 // PasswordAutofillManager, private: | 360 // PasswordAutofillManager, private: |
| 358 | 361 |
| 359 bool PasswordAutofillManager::GetPasswordAndRealmForUsername( | 362 bool PasswordAutofillManager::GetPasswordAndRealmForUsername( |
| 360 const base::string16& current_username, | 363 const base::string16& current_username, |
| 361 const autofill::PasswordFormFillData& fill_data, | 364 const autofill::PasswordFormFillData& fill_data, |
| 362 autofill::PasswordAndRealm* password_and_realm) { | 365 autofill::PasswordAndRealm* password_and_realm) { |
| 363 // TODO(dubroy): When password access requires some kind of authentication | 366 // TODO(dubroy): When password access requires some kind of authentication |
| 364 // (e.g. Keychain access on Mac OS), use |password_manager_client_| here to | 367 // (e.g. Keychain access on Mac OS), use |password_manager_client_| here to |
| 365 // fetch the actual password. See crbug.com/178358 for more context. | 368 // fetch the actual password. See crbug.com/178358 for more context. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 autofill::PasswordFormFillData* found_password) { | 405 autofill::PasswordFormFillData* found_password) { |
| 403 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(key); | 406 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(key); |
| 404 if (iter == login_to_password_info_.end()) | 407 if (iter == login_to_password_info_.end()) |
| 405 return false; | 408 return false; |
| 406 | 409 |
| 407 *found_password = iter->second; | 410 *found_password = iter->second; |
| 408 return true; | 411 return true; |
| 409 } | 412 } |
| 410 | 413 |
| 411 } // namespace password_manager | 414 } // namespace password_manager |
| OLD | NEW |