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

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: Update code as per review comments 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"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 158
159 void AutofillExternalDelegate::OnPopupHidden() { 159 void AutofillExternalDelegate::OnPopupHidden() {
160 } 160 }
161 161
162 bool AutofillExternalDelegate::ShouldRepostEvent(const ui::MouseEvent& event) { 162 bool AutofillExternalDelegate::ShouldRepostEvent(const ui::MouseEvent& event) {
163 NOTREACHED(); 163 NOTREACHED();
164 return true; 164 return true;
165 } 165 }
166 166
167 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { 167 void AutofillExternalDelegate::DidSelectSuggestion(int identifier,
168 const base::string16& value)
169 {
Ilya Sherman 2014/02/22 05:59:51 nit: The curly brace should be on the previous lin
ziran.sun 2014/02/27 15:38:11 Done.
168 ClearPreviewedForm(); 170 ClearPreviewedForm();
169 171
170 // Only preview the data if it is a profile. 172 // Only preview the data if it is a profile.
171 if (identifier > 0) 173 if (identifier > 0)
172 FillAutofillFormData(identifier, true); 174 FillAutofillFormData(identifier, true);
175 // Preview Autocomplete field
Ilya Sherman 2014/02/22 05:59:51 nit: This comment is redundant with the code; plea
176 else if (identifier == WebAutofillClient::MenuItemIDAutocompleteEntry) {
177 autofill_driver_->RendererShouldPreviewAutoCompleteNode(value);
178 }
Ilya Sherman 2014/02/22 05:59:51 nit: No need for curly braces.
ziran.sun 2014/02/27 15:38:11 Done.
173 } 179 }
174 180
175 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, 181 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value,
176 int identifier) { 182 int identifier) {
177 if (identifier == WebAutofillClient::MenuItemIDAutofillOptions) { 183 if (identifier == WebAutofillClient::MenuItemIDAutofillOptions) {
178 // User selected 'Autofill Options'. 184 // User selected 'Autofill Options'.
179 autofill_manager_->ShowAutofillSettings(); 185 autofill_manager_->ShowAutofillSettings();
180 } else if (identifier == WebAutofillClient::MenuItemIDClearForm) { 186 } else if (identifier == WebAutofillClient::MenuItemIDClearForm) {
181 // User selected 'Clear form'. 187 // User selected 'Clear form'.
182 autofill_driver_->RendererShouldClearFilledForm(); 188 autofill_driver_->RendererShouldClearFilledForm();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Set the values that all datalist elements share. 355 // Set the values that all datalist elements share.
350 autofill_icons->insert(autofill_icons->begin(), 356 autofill_icons->insert(autofill_icons->begin(),
351 data_list_values_.size(), 357 data_list_values_.size(),
352 base::string16()); 358 base::string16());
353 autofill_unique_ids->insert(autofill_unique_ids->begin(), 359 autofill_unique_ids->insert(autofill_unique_ids->begin(),
354 data_list_values_.size(), 360 data_list_values_.size(),
355 WebAutofillClient::MenuItemIDDataListEntry); 361 WebAutofillClient::MenuItemIDDataListEntry);
356 } 362 }
357 363
358 } // namespace autofill 364 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698