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

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

Issue 2672243002: Convert ContentAutofillDriverFactory to use the new navigation callbacks. (Closed)
Patch Set: review comment Created 3 years, 10 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"
11 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 11 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
12 #include "components/autofill/core/browser/autofill_client.h" 12 #include "components/autofill/core/browser/autofill_client.h"
13 #include "components/autofill/core/browser/autofill_external_delegate.h" 13 #include "components/autofill/core/browser/autofill_external_delegate.h"
14 #include "components/autofill/core/browser/autofill_manager.h" 14 #include "components/autofill/core/browser/autofill_manager.h"
15 #include "components/autofill/core/browser/form_structure.h" 15 #include "components/autofill/core/browser/form_structure.h"
16 #include "components/autofill/core/common/autofill_switches.h" 16 #include "components/autofill/core/common/autofill_switches.h"
17 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/navigation_controller.h" 19 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/navigation_details.h" 20 #include "content/public/browser/navigation_handle.h"
21 #include "content/public/browser/render_frame_host.h" 21 #include "content/public/browser/render_frame_host.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/render_widget_host_view.h" 23 #include "content/public/browser/render_widget_host_view.h"
24 #include "content/public/browser/site_instance.h" 24 #include "content/public/browser/site_instance.h"
25 #include "content/public/browser/storage_partition.h" 25 #include "content/public/browser/storage_partition.h"
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 #include "services/service_manager/public/cpp/interface_provider.h" 27 #include "services/service_manager/public/cpp/interface_provider.h"
28 #include "ui/gfx/geometry/size_f.h" 28 #include "ui/gfx/geometry/size_f.h"
29 29
30 namespace autofill { 30 namespace autofill {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 autofill_manager_->OnDidEndTextFieldEditing(); 233 autofill_manager_->OnDidEndTextFieldEditing();
234 } 234 }
235 235
236 void ContentAutofillDriver::SetDataList( 236 void ContentAutofillDriver::SetDataList(
237 const std::vector<base::string16>& values, 237 const std::vector<base::string16>& values,
238 const std::vector<base::string16>& labels) { 238 const std::vector<base::string16>& labels) {
239 autofill_manager_->OnSetDataList(values, labels); 239 autofill_manager_->OnSetDataList(values, labels);
240 } 240 }
241 241
242 void ContentAutofillDriver::DidNavigateFrame( 242 void ContentAutofillDriver::DidNavigateFrame(
243 const content::LoadCommittedDetails& details, 243 content::NavigationHandle* navigation_handle) {
244 const content::FrameNavigateParams& params) { 244 if (navigation_handle->IsInMainFrame() && !navigation_handle->IsSamePage())
245 if (details.is_navigation_to_different_page())
246 autofill_manager_->Reset(); 245 autofill_manager_->Reset();
247 } 246 }
248 247
249 void ContentAutofillDriver::SetAutofillManager( 248 void ContentAutofillDriver::SetAutofillManager(
250 std::unique_ptr<AutofillManager> manager) { 249 std::unique_ptr<AutofillManager> manager) {
251 autofill_manager_ = std::move(manager); 250 autofill_manager_ = std::move(manager);
252 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); 251 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_);
253 } 252 }
254 253
255 void ContentAutofillDriver::NotifyFirstUserGestureObservedInTab() { 254 void ContentAutofillDriver::NotifyFirstUserGestureObservedInTab() {
256 GetAutofillAgent()->FirstUserGestureObservedInTab(); 255 GetAutofillAgent()->FirstUserGestureObservedInTab();
257 } 256 }
258 257
259 const mojom::AutofillAgentPtr& ContentAutofillDriver::GetAutofillAgent() { 258 const mojom::AutofillAgentPtr& ContentAutofillDriver::GetAutofillAgent() {
260 // Here is a lazy binding, and will not reconnect after connection error. 259 // Here is a lazy binding, and will not reconnect after connection error.
261 if (!autofill_agent_) { 260 if (!autofill_agent_) {
262 render_frame_host_->GetRemoteInterfaces()->GetInterface( 261 render_frame_host_->GetRemoteInterfaces()->GetInterface(
263 mojo::MakeRequest(&autofill_agent_)); 262 mojo::MakeRequest(&autofill_agent_));
264 } 263 }
265 264
266 return autofill_agent_; 265 return autofill_agent_;
267 } 266 }
268 267
269 } // namespace autofill 268 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698