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

Side by Side Diff: components/autofill/core/browser/autofill_external_delegate.cc

Issue 148413002: Add "previewing on hover" support for single-field autocomplete input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Stated that no-op for new Autocomplete functions in autofill dialog file. Created 6 years, 10 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
OLDNEW
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"
11 #include "grit/component_strings.h" 11 #include "grit/component_strings.h"
12 #include "third_party/WebKit/public/web/WebAutofillClient.h" 12 #include "third_party/WebKit/public/web/WebAutofillClient.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 14
15 using blink::WebAutofillClient; 15 using blink::WebAutofillClient;
16 using base::ASCIIToUTF16;
16 17
17 namespace autofill { 18 namespace autofill {
18 19
19 AutofillExternalDelegate::AutofillExternalDelegate( 20 AutofillExternalDelegate::AutofillExternalDelegate(
20 AutofillManager* autofill_manager, 21 AutofillManager* autofill_manager,
21 AutofillDriver* autofill_driver) 22 AutofillDriver* autofill_driver)
22 : autofill_manager_(autofill_manager), 23 : autofill_manager_(autofill_manager),
23 autofill_driver_(autofill_driver), 24 autofill_driver_(autofill_driver),
24 password_autofill_manager_(autofill_driver), 25 password_autofill_manager_(autofill_driver),
25 autofill_query_id_(0), 26 autofill_query_id_(0),
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 166 }
166 167
167 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { 168 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) {
168 ClearPreviewedForm(); 169 ClearPreviewedForm();
169 170
170 // Only preview the data if it is a profile. 171 // Only preview the data if it is a profile.
171 if (identifier > 0) 172 if (identifier > 0)
172 FillAutofillFormData(identifier, true); 173 FillAutofillFormData(identifier, true);
173 } 174 }
174 175
176 void AutofillExternalDelegate::DidSelectAutocompleteSuggestion(
177 const base::string16& value) {
178 ClearPreviewedForm();
179 ClearAutocompletePreviewedField();
180
181 // Preview the data if it is in an AutoComplete field.
182 autofill_driver_->RendererShouldSetNodeText(value);
Ilya Sherman 2014/02/14 02:22:28 This is incorrect. The renderer should preview th
183 }
184
175 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, 185 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value,
176 int identifier) { 186 int identifier) {
177 if (identifier == WebAutofillClient::MenuItemIDAutofillOptions) { 187 if (identifier == WebAutofillClient::MenuItemIDAutofillOptions) {
178 // User selected 'Autofill Options'. 188 // User selected 'Autofill Options'.
179 autofill_manager_->ShowAutofillSettings(); 189 autofill_manager_->ShowAutofillSettings();
180 } else if (identifier == WebAutofillClient::MenuItemIDClearForm) { 190 } else if (identifier == WebAutofillClient::MenuItemIDClearForm) {
181 // User selected 'Clear form'. 191 // User selected 'Clear form'.
182 autofill_driver_->RendererShouldClearFilledForm(); 192 autofill_driver_->RendererShouldClearFilledForm();
183 } else if (identifier == WebAutofillClient::MenuItemIDPasswordEntry) { 193 } else if (identifier == WebAutofillClient::MenuItemIDPasswordEntry) {
184 bool success = password_autofill_manager_.DidAcceptAutofillSuggestion( 194 bool success = password_autofill_manager_.DidAcceptAutofillSuggestion(
(...skipping 24 matching lines...) Expand all
209 void AutofillExternalDelegate::DidEndTextFieldEditing() { 219 void AutofillExternalDelegate::DidEndTextFieldEditing() {
210 autofill_manager_->delegate()->HideAutofillPopup(); 220 autofill_manager_->delegate()->HideAutofillPopup();
211 221
212 has_shown_autofill_popup_for_current_edit_ = false; 222 has_shown_autofill_popup_for_current_edit_ = false;
213 } 223 }
214 224
215 void AutofillExternalDelegate::ClearPreviewedForm() { 225 void AutofillExternalDelegate::ClearPreviewedForm() {
216 autofill_driver_->RendererShouldClearPreviewedForm(); 226 autofill_driver_->RendererShouldClearPreviewedForm();
217 } 227 }
218 228
229 void AutofillExternalDelegate::ClearAutocompletePreviewedField() {
230 autofill_driver_->RendererShouldSetNodeText(ASCIIToUTF16(""));
Ilya Sherman 2014/02/14 02:22:28 This is incorrect. The field value shouldn't be c
231 }
232
219 void AutofillExternalDelegate::Reset() { 233 void AutofillExternalDelegate::Reset() {
220 autofill_manager_->delegate()->HideAutofillPopup(); 234 autofill_manager_->delegate()->HideAutofillPopup();
221 235
222 password_autofill_manager_.Reset(); 236 password_autofill_manager_.Reset();
223 } 237 }
224 238
225 void AutofillExternalDelegate::AddPasswordFormMapping( 239 void AutofillExternalDelegate::AddPasswordFormMapping(
226 const FormFieldData& username_field, 240 const FormFieldData& username_field,
227 const PasswordFormFillData& fill_data) { 241 const PasswordFormFillData& fill_data) {
228 password_autofill_manager_.AddPasswordFormMapping(username_field, fill_data); 242 password_autofill_manager_.AddPasswordFormMapping(username_field, fill_data);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Set the values that all datalist elements share. 363 // Set the values that all datalist elements share.
350 autofill_icons->insert(autofill_icons->begin(), 364 autofill_icons->insert(autofill_icons->begin(),
351 data_list_values_.size(), 365 data_list_values_.size(),
352 base::string16()); 366 base::string16());
353 autofill_unique_ids->insert(autofill_unique_ids->begin(), 367 autofill_unique_ids->insert(autofill_unique_ids->begin(),
354 data_list_values_.size(), 368 data_list_values_.size(),
355 WebAutofillClient::MenuItemIDDataListEntry); 369 WebAutofillClient::MenuItemIDDataListEntry);
356 } 370 }
357 371
358 } // namespace autofill 372 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698