| 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/content/browser/autofill_driver_impl.h" | 5 #include "components/autofill/content/browser/autofill_driver_impl.h" |
| 6 | 6 |
| 7 #include "components/autofill/core/browser/autofill_external_delegate.h" | 7 #include "components/autofill/core/browser/autofill_external_delegate.h" |
| 8 #include "components/autofill/core/browser/autofill_manager.h" | 8 #include "components/autofill/core/browser/autofill_manager.h" |
| 9 #include "components/autofill/core/browser/autofill_manager_delegate.h" | 9 #include "components/autofill/core/browser/autofill_manager_delegate.h" |
| 10 #include "components/autofill/core/common/autofill_messages.h" | 10 #include "components/autofill/core/common/autofill_messages.h" |
| 11 #include "content/public/browser/navigation_controller.h" | 11 #include "content/public/browser/navigation_controller.h" |
| 12 #include "content/public/browser/navigation_details.h" | 12 #include "content/public/browser/navigation_details.h" |
| 13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
| 14 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
| 15 #include "content/public/browser/notification_types.h" | 15 #include "content/public/browser/notification_types.h" |
| 16 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/frame_navigate_params.h" | 18 #include "content/public/common/frame_navigate_params.h" |
| 18 #include "ipc/ipc_message_macros.h" | 19 #include "ipc/ipc_message_macros.h" |
| 19 | 20 |
| 20 namespace autofill { | 21 namespace autofill { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 const char kAutofillDriverImplWebContentsUserDataKey[] = | 25 const char kAutofillDriverImplWebContentsUserDataKey[] = |
| 25 "web_contents_autofill_driver_impl"; | 26 "web_contents_autofill_driver_impl"; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 content::Source<content::NavigationController>( | 75 content::Source<content::NavigationController>( |
| 75 &(web_contents->GetController()))); | 76 &(web_contents->GetController()))); |
| 76 } | 77 } |
| 77 | 78 |
| 78 AutofillDriverImpl::~AutofillDriverImpl() {} | 79 AutofillDriverImpl::~AutofillDriverImpl() {} |
| 79 | 80 |
| 80 content::WebContents* AutofillDriverImpl::GetWebContents() { | 81 content::WebContents* AutofillDriverImpl::GetWebContents() { |
| 81 return web_contents(); | 82 return web_contents(); |
| 82 } | 83 } |
| 83 | 84 |
| 85 bool AutofillDriverImpl::RendererIsAvailable() { |
| 86 return (web_contents()->GetRenderViewHost() != NULL); |
| 87 } |
| 88 |
| 89 void AutofillDriverImpl::SendFormDataToRenderer(int query_id, |
| 90 const FormData& data) { |
| 91 if (!RendererIsAvailable()) |
| 92 return; |
| 93 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| 94 host->Send( |
| 95 new AutofillMsg_FormDataFilled(host->GetRoutingID(), query_id, data)); |
| 96 } |
| 97 |
| 84 bool AutofillDriverImpl::OnMessageReceived(const IPC::Message& message) { | 98 bool AutofillDriverImpl::OnMessageReceived(const IPC::Message& message) { |
| 85 bool handled = true; | 99 bool handled = true; |
| 86 IPC_BEGIN_MESSAGE_MAP(AutofillDriverImpl, message) | 100 IPC_BEGIN_MESSAGE_MAP(AutofillDriverImpl, message) |
| 87 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormsSeen, autofill_manager_.get(), | 101 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormsSeen, autofill_manager_.get(), |
| 88 AutofillManager::OnFormsSeen) | 102 AutofillManager::OnFormsSeen) |
| 89 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormSubmitted, autofill_manager_.get(), | 103 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormSubmitted, autofill_manager_.get(), |
| 90 AutofillManager::OnFormSubmitted) | 104 AutofillManager::OnFormSubmitted) |
| 91 IPC_MESSAGE_FORWARD(AutofillHostMsg_TextFieldDidChange, | 105 IPC_MESSAGE_FORWARD(AutofillHostMsg_TextFieldDidChange, |
| 92 autofill_manager_.get(), | 106 autofill_manager_.get(), |
| 93 AutofillManager::OnTextFieldDidChange) | 107 AutofillManager::OnTextFieldDidChange) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (!*content::Details<bool>(details).ptr()) | 179 if (!*content::Details<bool>(details).ptr()) |
| 166 autofill_manager_->delegate()->HideAutofillPopup(); | 180 autofill_manager_->delegate()->HideAutofillPopup(); |
| 167 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 181 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
| 168 autofill_manager_->delegate()->HideAutofillPopup(); | 182 autofill_manager_->delegate()->HideAutofillPopup(); |
| 169 } else { | 183 } else { |
| 170 NOTREACHED(); | 184 NOTREACHED(); |
| 171 } | 185 } |
| 172 } | 186 } |
| 173 | 187 |
| 174 } // namespace autofill | 188 } // namespace autofill |
| OLD | NEW |