| Index: components/password_manager/core/browser/password_autofill_manager.cc
|
| diff --git a/components/password_manager/core/browser/password_autofill_manager.cc b/components/password_manager/core/browser/password_autofill_manager.cc
|
| index ab03c02396b9bcf586ac314a375ef4501d1d9ee2..ea049f448939f72e5775f29f7f4ad83c674ec46f 100644
|
| --- a/components/password_manager/core/browser/password_autofill_manager.cc
|
| +++ b/components/password_manager/core/browser/password_autofill_manager.cc
|
| @@ -69,12 +69,11 @@ PasswordAutofillManager::PasswordAutofillManager(
|
| PasswordAutofillManager::~PasswordAutofillManager() {
|
| }
|
|
|
| -bool PasswordAutofillManager::FillSuggestion(
|
| - const autofill::FormFieldData& field,
|
| - const base::string16& username) {
|
| +bool PasswordAutofillManager::FillSuggestion(int key,
|
| + const base::string16& username) {
|
| autofill::PasswordFormFillData fill_data;
|
| base::string16 password;
|
| - if (FindLoginInfo(field, &fill_data) &&
|
| + if (FindLoginInfo(key, &fill_data) &&
|
| GetPasswordForUsername(username, fill_data, &password)) {
|
| PasswordManagerDriver* driver = password_manager_client_->GetDriver();
|
| driver->FillSuggestion(username, password);
|
| @@ -84,11 +83,11 @@ bool PasswordAutofillManager::FillSuggestion(
|
| }
|
|
|
| bool PasswordAutofillManager::PreviewSuggestion(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| const base::string16& username) {
|
| autofill::PasswordFormFillData fill_data;
|
| base::string16 password;
|
| - if (FindLoginInfo(field, &fill_data) &&
|
| + if (FindLoginInfo(key, &fill_data) &&
|
| GetPasswordForUsername(username, fill_data, &password)) {
|
| PasswordManagerDriver* driver = password_manager_client_->GetDriver();
|
| driver->PreviewSuggestion(username, password);
|
| @@ -98,24 +97,24 @@ bool PasswordAutofillManager::PreviewSuggestion(
|
| }
|
|
|
| void PasswordAutofillManager::OnAddPasswordFormMapping(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| const autofill::PasswordFormFillData& fill_data) {
|
| - if (!autofill::IsValidFormFieldData(field) ||
|
| - !autofill::IsValidPasswordFormFillData(fill_data))
|
| + if (!autofill::IsValidPasswordFormFillData(fill_data))
|
| return;
|
|
|
| - login_to_password_info_[field] = fill_data;
|
| + login_to_password_info_[key] = fill_data;
|
| }
|
|
|
| void PasswordAutofillManager::OnShowPasswordSuggestions(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| + base::i18n::TextDirection text_direction,
|
| const base::string16& typed_username,
|
| bool show_all,
|
| const gfx::RectF& bounds) {
|
| std::vector<base::string16> suggestions;
|
| std::vector<base::string16> realms;
|
| LoginToPasswordInfoMap::const_iterator fill_data_it =
|
| - login_to_password_info_.find(field);
|
| + login_to_password_info_.find(key);
|
| DCHECK(fill_data_it != login_to_password_info_.end());
|
| GetSuggestions(fill_data_it->second, typed_username, &suggestions, &realms,
|
| show_all);
|
| @@ -126,7 +125,7 @@ void PasswordAutofillManager::OnShowPasswordSuggestions(
|
| suggestions.size() != realms.size())
|
| return;
|
|
|
| - form_field_ = field;
|
| + form_data_key_ = key;
|
|
|
| if (suggestions.empty()) {
|
| autofill_client_->HideAutofillPopup();
|
| @@ -137,7 +136,7 @@ void PasswordAutofillManager::OnShowPasswordSuggestions(
|
| std::vector<int> password_ids(suggestions.size(),
|
| autofill::POPUP_ITEM_ID_PASSWORD_ENTRY);
|
| autofill_client_->ShowAutofillPopup(bounds,
|
| - field.text_direction,
|
| + text_direction,
|
| suggestions,
|
| realms,
|
| empty,
|
| @@ -150,15 +149,15 @@ void PasswordAutofillManager::Reset() {
|
| }
|
|
|
| bool PasswordAutofillManager::FillSuggestionForTest(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| const base::string16& username) {
|
| - return FillSuggestion(field, username);
|
| + return FillSuggestion(key, username);
|
| }
|
|
|
| bool PasswordAutofillManager::PreviewSuggestionForTest(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| const base::string16& username) {
|
| - return PreviewSuggestion(field, username);
|
| + return PreviewSuggestion(key, username);
|
| }
|
|
|
| void PasswordAutofillManager::OnPopupShown() {
|
| @@ -170,13 +169,13 @@ void PasswordAutofillManager::OnPopupHidden() {
|
| void PasswordAutofillManager::DidSelectSuggestion(const base::string16& value,
|
| int identifier) {
|
| ClearPreviewedForm();
|
| - bool success = PreviewSuggestion(form_field_, value);
|
| + bool success = PreviewSuggestion(form_data_key_, value);
|
| DCHECK(success);
|
| }
|
|
|
| void PasswordAutofillManager::DidAcceptSuggestion(const base::string16& value,
|
| int identifier) {
|
| - bool success = FillSuggestion(form_field_, value);
|
| + bool success = FillSuggestion(form_data_key_, value);
|
| DCHECK(success);
|
| autofill_client_->HideAutofillPopup();
|
| }
|
| @@ -235,9 +234,9 @@ bool PasswordAutofillManager::GetPasswordForUsername(
|
| }
|
|
|
| bool PasswordAutofillManager::FindLoginInfo(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| autofill::PasswordFormFillData* found_password) {
|
| - LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field);
|
| + LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(key);
|
| if (iter == login_to_password_info_.end())
|
| return false;
|
|
|
|
|