Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: components/autofill/content/browser/content_autofill_driver.cc

Issue 710453002: [Autofill] Componentize AutofillCCInfoBarDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Peter's input over use of WeakPtr<>. Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 GetWebContents()->OpenURL(content::OpenURLParams(
Peter Kasting 2014/12/29 22:24:30 If this is the only use of GetWebContents(), then
Pritam Nikam 2014/12/30 13:22:13 Done.
152 url, content::Referrer(), disposition, ui::PAGE_TRANSITION_LINK, false));
153 }
154
148 bool ContentAutofillDriver::HandleMessage(const IPC::Message& message) { 155 bool ContentAutofillDriver::HandleMessage(const IPC::Message& message) {
149 bool handled = true; 156 bool handled = true;
150 IPC_BEGIN_MESSAGE_MAP(ContentAutofillDriver, message) 157 IPC_BEGIN_MESSAGE_MAP(ContentAutofillDriver, message)
151 IPC_MESSAGE_FORWARD(AutofillHostMsg_FirstUserGestureObserved, client_, 158 IPC_MESSAGE_FORWARD(AutofillHostMsg_FirstUserGestureObserved, client_,
152 AutofillClient::OnFirstUserGestureObserved) 159 AutofillClient::OnFirstUserGestureObserved)
153 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormsSeen, 160 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormsSeen,
154 autofill_manager_.get(), 161 autofill_manager_.get(),
155 AutofillManager::OnFormsSeen) 162 AutofillManager::OnFormsSeen)
156 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormSubmitted, 163 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormSubmitted,
157 autofill_manager_.get(), 164 autofill_manager_.get(),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (details.is_navigation_to_different_page()) 204 if (details.is_navigation_to_different_page())
198 autofill_manager_->Reset(); 205 autofill_manager_->Reset();
199 } 206 }
200 207
201 void ContentAutofillDriver::SetAutofillManager( 208 void ContentAutofillDriver::SetAutofillManager(
202 scoped_ptr<AutofillManager> manager) { 209 scoped_ptr<AutofillManager> manager) {
203 autofill_manager_ = manager.Pass(); 210 autofill_manager_ = manager.Pass();
204 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); 211 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_);
205 } 212 }
206 213
214 content::WebContents* ContentAutofillDriver::GetWebContents() {
215 return content::WebContents::FromRenderFrameHost(render_frame_host_);
216 }
217
207 } // namespace autofill 218 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698