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

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

Issue 208453002: Add "previewing on hover" support for password field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per Ilya's comment. Created 6 years, 9 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 NOTREACHED(); 161 NOTREACHED();
162 return true; 162 return true;
163 } 163 }
164 164
165 void AutofillExternalDelegate::DidSelectSuggestion( 165 void AutofillExternalDelegate::DidSelectSuggestion(
166 const base::string16& value, 166 const base::string16& value,
167 int identifier) { 167 int identifier) {
168 ClearPreviewedForm(); 168 ClearPreviewedForm();
169 169
170 // Only preview the data if it is a profile. 170 // Only preview the data if it is a profile.
171 if (identifier > 0) 171 if (identifier > 0) {
172 FillAutofillFormData(identifier, true); 172 FillAutofillFormData(identifier, true);
173 else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) 173 } else if (identifier == POPUP_ITEM_ID_PASSWORD_ENTRY) {
174 bool success = password_manager_.DidSelectSuggestion(query_field_, value);
175 DCHECK(success);
176 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) {
174 driver_->RendererShouldPreviewFieldWithValue(value); 177 driver_->RendererShouldPreviewFieldWithValue(value);
178 }
175 } 179 }
176 180
177 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, 181 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value,
178 int identifier) { 182 int identifier) {
179 if (identifier == POPUP_ITEM_ID_AUTOFILL_OPTIONS) { 183 if (identifier == POPUP_ITEM_ID_AUTOFILL_OPTIONS) {
180 // User selected 'Autofill Options'. 184 // User selected 'Autofill Options'.
181 manager_->ShowAutofillSettings(); 185 manager_->ShowAutofillSettings();
182 } else if (identifier == POPUP_ITEM_ID_CLEAR_FORM) { 186 } else if (identifier == POPUP_ITEM_ID_CLEAR_FORM) {
183 // User selected 'Clear form'. 187 // User selected 'Clear form'.
184 driver_->RendererShouldClearFilledForm(); 188 driver_->RendererShouldClearFilledForm();
185 } else if (identifier == POPUP_ITEM_ID_PASSWORD_ENTRY) { 189 } else if (identifier == POPUP_ITEM_ID_PASSWORD_ENTRY) {
186 bool success = password_manager_.DidAcceptAutofillSuggestion( 190 bool success = password_manager_.DidAcceptSuggestion(
187 query_field_, value); 191 query_field_, value);
Ilya Sherman 2014/03/25 19:45:27 nit: Looks like this now fits on the previous line
188 DCHECK(success); 192 DCHECK(success);
189 } else if (identifier == POPUP_ITEM_ID_DATALIST_ENTRY) { 193 } else if (identifier == POPUP_ITEM_ID_DATALIST_ENTRY) {
190 driver_->RendererShouldAcceptDataListSuggestion(value); 194 driver_->RendererShouldAcceptDataListSuggestion(value);
191 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) { 195 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) {
192 // User selected an Autocomplete, so we fill directly. 196 // User selected an Autocomplete, so we fill directly.
193 driver_->RendererShouldFillFieldWithValue(value); 197 driver_->RendererShouldFillFieldWithValue(value);
194 } else { 198 } else {
195 FillAutofillFormData(identifier, false); 199 FillAutofillFormData(identifier, false);
196 } 200 }
197 201
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // Set the values that all datalist elements share. 348 // Set the values that all datalist elements share.
345 icons->insert(icons->begin(), 349 icons->insert(icons->begin(),
346 data_list_values_.size(), 350 data_list_values_.size(),
347 base::string16()); 351 base::string16());
348 unique_ids->insert(unique_ids->begin(), 352 unique_ids->insert(unique_ids->begin(),
349 data_list_values_.size(), 353 data_list_values_.size(),
350 POPUP_ITEM_ID_DATALIST_ENTRY); 354 POPUP_ITEM_ID_DATALIST_ENTRY);
351 } 355 }
352 356
353 } // namespace autofill 357 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698