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

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

Issue 2007473004: [Autofill] Migrate ContentAutofillDriver<-->AutofillAgent IPCs to mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 bool ContentAutofillDriver::RendererIsAvailable() { 76 bool ContentAutofillDriver::RendererIsAvailable() {
77 return render_frame_host_->GetRenderViewHost() != NULL; 77 return render_frame_host_->GetRenderViewHost() != NULL;
78 } 78 }
79 79
80 void ContentAutofillDriver::SendFormDataToRenderer( 80 void ContentAutofillDriver::SendFormDataToRenderer(
81 int query_id, 81 int query_id,
82 RendererFormDataAction action, 82 RendererFormDataAction action,
83 const FormData& data) { 83 const FormData& data) {
84 if (!RendererIsAvailable()) 84 if (!RendererIsAvailable())
85 return; 85 return;
86
87 ConnectToMojoAutofillAgentIfNeeded();
86 switch (action) { 88 switch (action) {
87 case FORM_DATA_ACTION_FILL: 89 case FORM_DATA_ACTION_FILL:
88 render_frame_host_->Send(new AutofillMsg_FillForm( 90 mojo_autofill_agent_->FillForm(
89 render_frame_host_->GetRoutingID(), query_id, data)); 91 query_id, data,
92 base::Bind(&ContentAutofillDriver::DidFillAutofillFormData,
93 base::Unretained(this)));
90 break; 94 break;
91 case FORM_DATA_ACTION_PREVIEW: 95 case FORM_DATA_ACTION_PREVIEW:
92 render_frame_host_->Send(new AutofillMsg_PreviewForm( 96 render_frame_host_->Send(new AutofillMsg_PreviewForm(
93 render_frame_host_->GetRoutingID(), query_id, data)); 97 render_frame_host_->GetRoutingID(), query_id, data));
94 break; 98 break;
95 } 99 }
96 } 100 }
97 101
98 void ContentAutofillDriver::PropagateAutofillPredictions( 102 void ContentAutofillDriver::PropagateAutofillPredictions(
99 const std::vector<FormStructure*>& forms) { 103 const std::vector<FormStructure*>& forms) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 AutofillManager::OnFocusNoLongerOnForm) 202 AutofillManager::OnFocusNoLongerOnForm)
199 IPC_MESSAGE_FORWARD(AutofillHostMsg_QueryFormFieldAutofill, 203 IPC_MESSAGE_FORWARD(AutofillHostMsg_QueryFormFieldAutofill,
200 autofill_manager_.get(), 204 autofill_manager_.get(),
201 AutofillManager::OnQueryFormFieldAutofill) 205 AutofillManager::OnQueryFormFieldAutofill)
202 IPC_MESSAGE_FORWARD(AutofillHostMsg_DidPreviewAutofillFormData, 206 IPC_MESSAGE_FORWARD(AutofillHostMsg_DidPreviewAutofillFormData,
203 autofill_manager_.get(), 207 autofill_manager_.get(),
204 AutofillManager::OnDidPreviewAutofillFormData) 208 AutofillManager::OnDidPreviewAutofillFormData)
205 IPC_MESSAGE_FORWARD(AutofillHostMsg_PingAck, 209 IPC_MESSAGE_FORWARD(AutofillHostMsg_PingAck,
206 &autofill_external_delegate_, 210 &autofill_external_delegate_,
207 AutofillExternalDelegate::OnPingAck) 211 AutofillExternalDelegate::OnPingAck)
208 IPC_MESSAGE_FORWARD(AutofillHostMsg_DidFillAutofillFormData,
209 autofill_manager_.get(),
210 AutofillManager::OnDidFillAutofillFormData)
211 IPC_MESSAGE_FORWARD(AutofillHostMsg_DidEndTextFieldEditing, 212 IPC_MESSAGE_FORWARD(AutofillHostMsg_DidEndTextFieldEditing,
212 autofill_manager_.get(), 213 autofill_manager_.get(),
213 AutofillManager::OnDidEndTextFieldEditing) 214 AutofillManager::OnDidEndTextFieldEditing)
214 IPC_MESSAGE_FORWARD(AutofillHostMsg_HidePopup, 215 IPC_MESSAGE_FORWARD(AutofillHostMsg_HidePopup,
215 autofill_manager_.get(), 216 autofill_manager_.get(),
216 AutofillManager::OnHidePopup) 217 AutofillManager::OnHidePopup)
217 IPC_MESSAGE_FORWARD(AutofillHostMsg_SetDataList, 218 IPC_MESSAGE_FORWARD(AutofillHostMsg_SetDataList,
218 autofill_manager_.get(), 219 autofill_manager_.get(),
219 AutofillManager::OnSetDataList) 220 AutofillManager::OnSetDataList)
220 IPC_MESSAGE_UNHANDLED(handled = false) 221 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 12 matching lines...) Expand all
233 std::unique_ptr<AutofillManager> manager) { 234 std::unique_ptr<AutofillManager> manager) {
234 autofill_manager_ = std::move(manager); 235 autofill_manager_ = std::move(manager);
235 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); 236 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_);
236 } 237 }
237 238
238 void ContentAutofillDriver::NotifyFirstUserGestureObservedInTab() { 239 void ContentAutofillDriver::NotifyFirstUserGestureObservedInTab() {
239 ConnectToMojoAutofillAgentIfNeeded(); 240 ConnectToMojoAutofillAgentIfNeeded();
240 mojo_autofill_agent_->FirstUserGestureObservedInTab(); 241 mojo_autofill_agent_->FirstUserGestureObservedInTab();
241 } 242 }
242 243
244 void ContentAutofillDriver::DidFillAutofillFormData(const FormData& filled,
245 int64_t timestamp) {
246 autofill_manager_->OnDidFillAutofillFormData(
247 filled, base::TimeTicks::FromInternalValue(timestamp));
248 }
249
243 void ContentAutofillDriver::ConnectToMojoAutofillAgentIfNeeded() { 250 void ContentAutofillDriver::ConnectToMojoAutofillAgentIfNeeded() {
244 if (mojo_autofill_agent_) 251 if (mojo_autofill_agent_)
245 return; 252 return;
246 253
247 render_frame_host_->GetServiceRegistry()->ConnectToRemoteService( 254 render_frame_host_->GetServiceRegistry()->ConnectToRemoteService(
248 mojo::GetProxy(&mojo_autofill_agent_)); 255 mojo::GetProxy(&mojo_autofill_agent_));
249 } 256 }
250 257
251 } // namespace autofill 258 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698