| 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/autofill/core/browser/autofill_external_delegate.h" | 5 #include "components/autofill/core/browser/autofill_external_delegate.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 8 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 9 #include "components/autofill/core/browser/autofill_driver.h" | 9 #include "components/autofill/core/browser/autofill_driver.h" |
| 10 #include "components/autofill/core/browser/autofill_manager.h" | 10 #include "components/autofill/core/browser/autofill_manager.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, | 192 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, |
| 193 int identifier) { | 193 int identifier) { |
| 194 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 194 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 195 | 195 |
| 196 if (identifier == WebAutofillClient::MenuItemIDAutofillOptions) { | 196 if (identifier == WebAutofillClient::MenuItemIDAutofillOptions) { |
| 197 // User selected 'Autofill Options'. | 197 // User selected 'Autofill Options'. |
| 198 autofill_manager_->OnShowAutofillDialog(); | 198 autofill_manager_->OnShowAutofillDialog(); |
| 199 } else if (identifier == WebAutofillClient::MenuItemIDClearForm) { | 199 } else if (identifier == WebAutofillClient::MenuItemIDClearForm) { |
| 200 // User selected 'Clear form'. | 200 // User selected 'Clear form'. |
| 201 autofill_driver_->RendererShouldClearForm(); | 201 autofill_driver_->RendererShouldClearFilledForm(); |
| 202 } else if (identifier == WebAutofillClient::MenuItemIDPasswordEntry) { | 202 } else if (identifier == WebAutofillClient::MenuItemIDPasswordEntry) { |
| 203 bool success = password_autofill_manager_.DidAcceptAutofillSuggestion( | 203 bool success = password_autofill_manager_.DidAcceptAutofillSuggestion( |
| 204 autofill_query_field_, value); | 204 autofill_query_field_, value); |
| 205 DCHECK(success); | 205 DCHECK(success); |
| 206 } else if (identifier == WebAutofillClient::MenuItemIDDataListEntry) { | 206 } else if (identifier == WebAutofillClient::MenuItemIDDataListEntry) { |
| 207 host->Send(new AutofillMsg_AcceptDataListSuggestion(host->GetRoutingID(), | 207 host->Send(new AutofillMsg_AcceptDataListSuggestion(host->GetRoutingID(), |
| 208 value)); | 208 value)); |
| 209 } else if (identifier == WebAutofillClient::MenuItemIDAutocompleteEntry) { | 209 } else if (identifier == WebAutofillClient::MenuItemIDAutocompleteEntry) { |
| 210 // User selected an Autocomplete, so we fill directly. | 210 // User selected an Autocomplete, so we fill directly. |
| 211 host->Send(new AutofillMsg_SetNodeText(host->GetRoutingID(), value)); | 211 host->Send(new AutofillMsg_SetNodeText(host->GetRoutingID(), value)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 void AutofillExternalDelegate::DidEndTextFieldEditing() { | 229 void AutofillExternalDelegate::DidEndTextFieldEditing() { |
| 230 autofill_manager_->delegate()->HideAutofillPopup(); | 230 autofill_manager_->delegate()->HideAutofillPopup(); |
| 231 | 231 |
| 232 has_shown_autofill_popup_for_current_edit_ = false; | 232 has_shown_autofill_popup_for_current_edit_ = false; |
| 233 } | 233 } |
| 234 | 234 |
| 235 void AutofillExternalDelegate::ClearPreviewedForm() { | 235 void AutofillExternalDelegate::ClearPreviewedForm() { |
| 236 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 236 autofill_driver_->RendererShouldClearPreviewedForm(); |
| 237 if (host) | |
| 238 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); | |
| 239 } | 237 } |
| 240 | 238 |
| 241 void AutofillExternalDelegate::Reset() { | 239 void AutofillExternalDelegate::Reset() { |
| 242 autofill_manager_->delegate()->HideAutofillPopup(); | 240 autofill_manager_->delegate()->HideAutofillPopup(); |
| 243 | 241 |
| 244 password_autofill_manager_.Reset(); | 242 password_autofill_manager_.Reset(); |
| 245 } | 243 } |
| 246 | 244 |
| 247 void AutofillExternalDelegate::AddPasswordFormMapping( | 245 void AutofillExternalDelegate::AddPasswordFormMapping( |
| 248 const FormFieldData& form, | 246 const FormFieldData& form, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 data_list_labels_.end()); | 367 data_list_labels_.end()); |
| 370 autofill_icons->insert(autofill_icons->begin(), | 368 autofill_icons->insert(autofill_icons->begin(), |
| 371 data_list_icons_.begin(), | 369 data_list_icons_.begin(), |
| 372 data_list_icons_.end()); | 370 data_list_icons_.end()); |
| 373 autofill_unique_ids->insert(autofill_unique_ids->begin(), | 371 autofill_unique_ids->insert(autofill_unique_ids->begin(), |
| 374 data_list_unique_ids_.begin(), | 372 data_list_unique_ids_.begin(), |
| 375 data_list_unique_ids_.end()); | 373 data_list_unique_ids_.end()); |
| 376 } | 374 } |
| 377 | 375 |
| 378 } // namespace autofill | 376 } // namespace autofill |
| OLD | NEW |