| 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 #include "components/autofill/browser/autofill_external_delegate.h" |
| 4 | 5 |
| 5 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 6 #include "components/autofill/browser/autocomplete_history_manager.h" | 7 #include "components/autofill/browser/autocomplete_history_manager.h" |
| 7 #include "components/autofill/browser/autofill_external_delegate.h" | |
| 8 #include "components/autofill/browser/autofill_manager.h" | 8 #include "components/autofill/browser/autofill_manager.h" |
| 9 #include "components/autofill/common/autofill_messages.h" | 9 #include "components/autofill/common/autofill_messages.h" |
| 10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
| 11 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
| 12 #include "content/public/browser/notification_source.h" | 12 #include "content/public/browser/notification_source.h" |
| 13 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
| 14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "grit/chromium_strings.h" | 16 #include "grit/chromium_strings.h" |
| 17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 | 20 |
| 21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
| 22 #include "content/public/browser/android/content_view_core.h" | 22 #include "content/public/browser/android/content_view_core.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 using content::RenderViewHost; | 25 using content::RenderViewHost; |
| 26 using WebKit::WebAutofillClient; | 26 using WebKit::WebAutofillClient; |
| 27 | 27 |
| 28 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::AutofillExternalDelegate); | 28 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::AutofillExternalDelegate); |
| 29 //DEFINE_EXPORTED_WEB_CONTENTS_USER_DATA_KEY(autofill::AutofillExternalDelegate, |
| 30 // AUTOFILL_EXPORT); |
| 29 | 31 |
| 30 namespace autofill { | 32 namespace autofill { |
| 31 | 33 |
| 32 void AutofillExternalDelegate::CreateForWebContentsAndManager( | 34 void AutofillExternalDelegate::CreateForWebContentsAndManager( |
| 33 content::WebContents* web_contents, | 35 content::WebContents* web_contents, |
| 34 AutofillManager* autofill_manager) { | 36 AutofillManager* autofill_manager) { |
| 35 if (FromWebContents(web_contents)) | 37 if (FromWebContents(web_contents)) |
| 36 return; | 38 return; |
| 37 | 39 |
| 38 web_contents->SetUserData( | 40 web_contents->SetUserData( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 56 registrar_.Add(this, | 58 registrar_.Add(this, |
| 57 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, | 59 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, |
| 58 content::Source<content::WebContents>(web_contents)); | 60 content::Source<content::WebContents>(web_contents)); |
| 59 registrar_.Add( | 61 registrar_.Add( |
| 60 this, | 62 this, |
| 61 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 63 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 62 content::Source<content::NavigationController>( | 64 content::Source<content::NavigationController>( |
| 63 &(web_contents->GetController()))); | 65 &(web_contents->GetController()))); |
| 64 } | 66 } |
| 65 | 67 |
| 68 AutofillExternalDelegate::AutofillExternalDelegate( |
| 69 content::WebContents* web_contents) |
| 70 : password_autofill_manager_(web_contents) { |
| 71 NOTREACHED(); |
| 72 } |
| 73 |
| 66 AutofillExternalDelegate::~AutofillExternalDelegate() {} | 74 AutofillExternalDelegate::~AutofillExternalDelegate() {} |
| 67 | 75 |
| 68 void AutofillExternalDelegate::OnQuery(int query_id, | 76 void AutofillExternalDelegate::OnQuery(int query_id, |
| 69 const FormData& form, | 77 const FormData& form, |
| 70 const FormFieldData& field, | 78 const FormFieldData& field, |
| 71 const gfx::RectF& element_bounds, | 79 const gfx::RectF& element_bounds, |
| 72 bool display_warning_if_disabled) { | 80 bool display_warning_if_disabled) { |
| 73 autofill_query_form_ = form; | 81 autofill_query_form_ = form; |
| 74 autofill_query_field_ = field; | 82 autofill_query_field_ = field; |
| 75 display_warning_if_disabled_ = display_warning_if_disabled; | 83 display_warning_if_disabled_ = display_warning_if_disabled; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 if (!*content::Details<bool>(details).ptr()) | 388 if (!*content::Details<bool>(details).ptr()) |
| 381 autofill_manager_->delegate()->HideAutofillPopup(); | 389 autofill_manager_->delegate()->HideAutofillPopup(); |
| 382 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 390 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
| 383 autofill_manager_->delegate()->HideAutofillPopup(); | 391 autofill_manager_->delegate()->HideAutofillPopup(); |
| 384 } else { | 392 } else { |
| 385 NOTREACHED(); | 393 NOTREACHED(); |
| 386 } | 394 } |
| 387 } | 395 } |
| 388 | 396 |
| 389 } // namespace autofill | 397 } // namespace autofill |
| OLD | NEW |