OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/content_autofill_driver.h" | 5 #include "components/autofill/content/browser/content_autofill_driver.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
9 #include "components/autofill/content/common/autofill_messages.h" | 9 #include "components/autofill/content/common/autofill_messages.h" |
10 #include "components/autofill/core/browser/autofill_client.h" | 10 #include "components/autofill/core/browser/autofill_client.h" |
11 #include "components/autofill/core/browser/autofill_external_delegate.h" | 11 #include "components/autofill/core/browser/autofill_external_delegate.h" |
12 #include "components/autofill/core/browser/autofill_manager.h" | 12 #include "components/autofill/core/browser/autofill_manager.h" |
13 #include "components/autofill/core/browser/form_structure.h" | 13 #include "components/autofill/core/browser/form_structure.h" |
14 #include "components/autofill/core/common/autofill_switches.h" | 14 #include "components/autofill/core/common/autofill_switches.h" |
15 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/navigation_controller.h" | 17 #include "content/public/browser/navigation_controller.h" |
18 #include "content/public/browser/navigation_details.h" | 18 #include "content/public/browser/navigation_details.h" |
19 #include "content/public/browser/render_frame_host.h" | 19 #include "content/public/browser/render_frame_host.h" |
20 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
21 #include "content/public/browser/site_instance.h" | 21 #include "content/public/browser/site_instance.h" |
22 #include "content/public/browser/web_contents.h" | |
22 #include "ipc/ipc_message_macros.h" | 23 #include "ipc/ipc_message_macros.h" |
23 | 24 |
24 namespace autofill { | 25 namespace autofill { |
25 | 26 |
26 ContentAutofillDriver::ContentAutofillDriver( | 27 ContentAutofillDriver::ContentAutofillDriver( |
27 content::RenderFrameHost* render_frame_host, | 28 content::RenderFrameHost* render_frame_host, |
28 AutofillClient* client, | 29 AutofillClient* client, |
29 const std::string& app_locale, | 30 const std::string& app_locale, |
30 AutofillManager::AutofillDownloadManagerState enable_download_manager) | 31 AutofillManager::AutofillDownloadManagerState enable_download_manager) |
31 : render_frame_host_(render_frame_host), | 32 : render_frame_host_(render_frame_host), |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 } | 139 } |
139 | 140 |
140 void ContentAutofillDriver::RendererShouldPreviewFieldWithValue( | 141 void ContentAutofillDriver::RendererShouldPreviewFieldWithValue( |
141 const base::string16& value) { | 142 const base::string16& value) { |
142 if (!RendererIsAvailable()) | 143 if (!RendererIsAvailable()) |
143 return; | 144 return; |
144 render_frame_host_->Send(new AutofillMsg_PreviewFieldWithValue( | 145 render_frame_host_->Send(new AutofillMsg_PreviewFieldWithValue( |
145 render_frame_host_->GetRoutingID(), value)); | 146 render_frame_host_->GetRoutingID(), value)); |
146 } | 147 } |
147 | 148 |
149 void ContentAutofillDriver::LinkClicked(const GURL& url, | |
150 WindowOpenDisposition disposition) { | |
151 content::WebContents* web_contents = | |
152 content::WebContents::FromRenderFrameHost(render_frame_host_); | |
153 web_contents->OpenURL(content::OpenURLParams( | |
154 url, content::Referrer(), disposition, ui::PAGE_TRANSITION_LINK, false)); | |
155 } | |
Ilya Sherman
2015/01/06 02:54:59
When you started working on this CL, there was one
Pritam Nikam
2015/01/06 12:47:42
Done.
Abstracting the call to LinkClicked throuh
| |
156 | |
148 bool ContentAutofillDriver::HandleMessage(const IPC::Message& message) { | 157 bool ContentAutofillDriver::HandleMessage(const IPC::Message& message) { |
149 bool handled = true; | 158 bool handled = true; |
150 IPC_BEGIN_MESSAGE_MAP(ContentAutofillDriver, message) | 159 IPC_BEGIN_MESSAGE_MAP(ContentAutofillDriver, message) |
151 IPC_MESSAGE_FORWARD(AutofillHostMsg_FirstUserGestureObserved, client_, | 160 IPC_MESSAGE_FORWARD(AutofillHostMsg_FirstUserGestureObserved, client_, |
152 AutofillClient::OnFirstUserGestureObserved) | 161 AutofillClient::OnFirstUserGestureObserved) |
153 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormsSeen, | 162 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormsSeen, |
154 autofill_manager_.get(), | 163 autofill_manager_.get(), |
155 AutofillManager::OnFormsSeen) | 164 AutofillManager::OnFormsSeen) |
156 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormSubmitted, | 165 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormSubmitted, |
157 autofill_manager_.get(), | 166 autofill_manager_.get(), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 autofill_manager_->Reset(); | 207 autofill_manager_->Reset(); |
199 } | 208 } |
200 | 209 |
201 void ContentAutofillDriver::SetAutofillManager( | 210 void ContentAutofillDriver::SetAutofillManager( |
202 scoped_ptr<AutofillManager> manager) { | 211 scoped_ptr<AutofillManager> manager) { |
203 autofill_manager_ = manager.Pass(); | 212 autofill_manager_ = manager.Pass(); |
204 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); | 213 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); |
205 } | 214 } |
206 | 215 |
207 } // namespace autofill | 216 } // namespace autofill |
OLD | NEW |