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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 has_suggestion_ && !has_shown_popup_for_current_edit_, | 179 has_suggestion_ && !has_shown_popup_for_current_edit_, |
180 query_form_, | 180 query_form_, |
181 query_field_); | 181 query_field_); |
182 has_shown_popup_for_current_edit_ |= has_suggestion_; | 182 has_shown_popup_for_current_edit_ |= has_suggestion_; |
183 } | 183 } |
184 | 184 |
185 void AutofillExternalDelegate::OnPopupHidden() { | 185 void AutofillExternalDelegate::OnPopupHidden() { |
186 driver_->PopupHidden(); | 186 driver_->PopupHidden(); |
187 } | 187 } |
188 | 188 |
189 void AutofillExternalDelegate::DidSelectSuggestion( | 189 void AutofillExternalDelegate::DidSelectSuggestion(const base::string16& value, |
190 const base::string16& value, | 190 int identifier, |
191 int identifier) { | 191 size_t match_start) { |
192 ClearPreviewedForm(); | 192 ClearPreviewedForm(); |
193 | 193 |
194 // Only preview the data if it is a profile. | 194 // Only preview the data if it is a profile. |
195 if (identifier > 0) | 195 if (identifier > 0) |
196 FillAutofillFormData(identifier, true); | 196 FillAutofillFormData(identifier, true); |
197 else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) | 197 else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) |
198 driver_->RendererShouldPreviewFieldWithValue(value); | 198 driver_->RendererShouldPreviewFieldWithValue(value, match_start); |
199 } | 199 } |
200 | 200 |
201 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, | 201 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, |
202 int identifier, | 202 int identifier, |
203 int position) { | 203 int position) { |
204 if (identifier == POPUP_ITEM_ID_AUTOFILL_OPTIONS) { | 204 if (identifier == POPUP_ITEM_ID_AUTOFILL_OPTIONS) { |
205 // User selected 'Autofill Options'. | 205 // User selected 'Autofill Options'. |
206 manager_->ShowAutofillSettings(); | 206 manager_->ShowAutofillSettings(); |
207 } else if (identifier == POPUP_ITEM_ID_CLEAR_FORM) { | 207 } else if (identifier == POPUP_ITEM_ID_CLEAR_FORM) { |
208 // User selected 'Clear form'. | 208 // User selected 'Clear form'. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 #if defined(OS_MACOSX) && !defined(OS_IOS) | 397 #if defined(OS_MACOSX) && !defined(OS_IOS) |
398 void AutofillExternalDelegate::PingRenderer() { | 398 void AutofillExternalDelegate::PingRenderer() { |
399 driver_->PingRenderer(); | 399 driver_->PingRenderer(); |
400 } | 400 } |
401 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 401 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
402 | 402 |
403 } // namespace autofill | 403 } // namespace autofill |
OLD | NEW |