| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/browser/autofill/autocomplete_history_manager.h" | 6 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
| 7 #include "chrome/browser/autofill/autofill_external_delegate.h" | 7 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 8 #include "chrome/browser/autofill/autofill_manager.h" | 8 #include "chrome/browser/autofill/autofill_manager.h" |
| 9 #include "chrome/common/autofill_messages.h" | 9 #include "chrome/common/autofill_messages.h" |
| 10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 void AutofillExternalDelegate::SelectAutofillSuggestionAtIndex(int unique_id) { | 36 void AutofillExternalDelegate::SelectAutofillSuggestionAtIndex(int unique_id) { |
| 37 ClearPreviewedForm(); | 37 ClearPreviewedForm(); |
| 38 | 38 |
| 39 // Only preview the data if it is a profile. | 39 // Only preview the data if it is a profile. |
| 40 if (unique_id > 0) | 40 if (unique_id > 0) |
| 41 FillAutofillFormData(unique_id, true); | 41 FillAutofillFormData(unique_id, true); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void AutofillExternalDelegate::OnQuery(int query_id, | 44 void AutofillExternalDelegate::OnQuery(int query_id, |
| 45 const webkit::forms::FormData& form, | 45 const FormData& form, |
| 46 const webkit::forms::FormField& field, | 46 const FormFieldData& field, |
| 47 const gfx::Rect& bounds, | 47 const gfx::Rect& bounds, |
| 48 bool display_warning_if_disabled) { | 48 bool display_warning_if_disabled) { |
| 49 autofill_query_form_ = form; | 49 autofill_query_form_ = form; |
| 50 autofill_query_field_ = field; | 50 autofill_query_field_ = field; |
| 51 display_warning_if_disabled_ = display_warning_if_disabled; | 51 display_warning_if_disabled_ = display_warning_if_disabled; |
| 52 autofill_query_id_ = query_id; | 52 autofill_query_id_ = query_id; |
| 53 | 53 |
| 54 OnQueryPlatformSpecific(query_id, form, field, bounds); | 54 OnQueryPlatformSpecific(query_id, form, field, bounds); |
| 55 } | 55 } |
| 56 | 56 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 ApplyAutofillSuggestions(values, labels, icons, ids); | 111 ApplyAutofillSuggestions(values, labels, icons, ids); |
| 112 | 112 |
| 113 tab_contents_->autofill_manager()->OnDidShowAutofillSuggestions( | 113 tab_contents_->autofill_manager()->OnDidShowAutofillSuggestions( |
| 114 has_autofill_item && !has_shown_autofill_popup_for_current_edit_); | 114 has_autofill_item && !has_shown_autofill_popup_for_current_edit_); |
| 115 has_shown_autofill_popup_for_current_edit_ |= has_autofill_item; | 115 has_shown_autofill_popup_for_current_edit_ |= has_autofill_item; |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 void AutofillExternalDelegate::OnShowPasswordSuggestions( | 119 void AutofillExternalDelegate::OnShowPasswordSuggestions( |
| 120 const std::vector<string16>& suggestions, | 120 const std::vector<string16>& suggestions, |
| 121 const webkit::forms::FormField& field, | 121 const FormFieldData& field, |
| 122 const gfx::Rect& bounds) { | 122 const gfx::Rect& bounds) { |
| 123 autofill_query_field_ = field; | 123 autofill_query_field_ = field; |
| 124 | 124 |
| 125 if (suggestions.empty()) { | 125 if (suggestions.empty()) { |
| 126 HideAutofillPopup(); | 126 HideAutofillPopup(); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 | 129 |
| 130 SetBounds(bounds); | 130 SetBounds(bounds); |
| 131 | 131 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 HideAutofillPopupInternal(); | 224 HideAutofillPopupInternal(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void AutofillExternalDelegate::Reset() { | 227 void AutofillExternalDelegate::Reset() { |
| 228 HideAutofillPopup(); | 228 HideAutofillPopup(); |
| 229 | 229 |
| 230 password_autofill_manager_.Reset(); | 230 password_autofill_manager_.Reset(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void AutofillExternalDelegate::AddPasswordFormMapping( | 233 void AutofillExternalDelegate::AddPasswordFormMapping( |
| 234 const webkit::forms::FormField& form, | 234 const FormFieldData& form, |
| 235 const webkit::forms::PasswordFormFillData& fill_data) { | 235 const PasswordFormFillData& fill_data) { |
| 236 password_autofill_manager_.AddPasswordFormMapping(form, fill_data); | 236 password_autofill_manager_.AddPasswordFormMapping(form, fill_data); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void AutofillExternalDelegate::FillAutofillFormData(int unique_id, | 239 void AutofillExternalDelegate::FillAutofillFormData(int unique_id, |
| 240 bool is_preview) { | 240 bool is_preview) { |
| 241 RenderViewHost* host = tab_contents_->web_contents()->GetRenderViewHost(); | 241 RenderViewHost* host = tab_contents_->web_contents()->GetRenderViewHost(); |
| 242 | 242 |
| 243 if (is_preview) { | 243 if (is_preview) { |
| 244 host->Send(new AutofillMsg_SetAutofillActionPreview( | 244 host->Send(new AutofillMsg_SetAutofillActionPreview( |
| 245 host->GetRoutingID())); | 245 host->GetRoutingID())); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 | 349 |
| 350 #if defined(OS_MACOSX) | 350 #if defined(OS_MACOSX) |
| 351 | 351 |
| 352 AutofillExternalDelegate* AutofillExternalDelegate::Create( | 352 AutofillExternalDelegate* AutofillExternalDelegate::Create( |
| 353 TabContents*, AutofillManager*) { | 353 TabContents*, AutofillManager*) { |
| 354 return NULL; | 354 return NULL; |
| 355 } | 355 } |
| 356 | 356 |
| 357 #endif | 357 #endif |
| OLD | NEW |