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

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

Issue 2024603002: [Autofill] Register AutofillDriver mojo interface earlier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybot failure Created 4 years, 6 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 24 matching lines...) Expand all
35 const std::string& app_locale, 35 const std::string& app_locale,
36 AutofillManager::AutofillDownloadManagerState enable_download_manager) 36 AutofillManager::AutofillDownloadManagerState enable_download_manager)
37 : render_frame_host_(render_frame_host), 37 : render_frame_host_(render_frame_host),
38 client_(client), 38 client_(client),
39 autofill_manager_(new AutofillManager(this, 39 autofill_manager_(new AutofillManager(this,
40 client, 40 client,
41 app_locale, 41 app_locale,
42 enable_download_manager)), 42 enable_download_manager)),
43 autofill_external_delegate_(autofill_manager_.get(), this) { 43 autofill_external_delegate_(autofill_manager_.get(), this) {
44 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); 44 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_);
45
46 // ContentAutofillDriver is guaranteed to outlive |render_frame_host|,
47 // as the ContentAutofillDriver instance will be destroyed in
48 // ContentAutofillDriverFactory::RenderFrameDeleted, which is a notification
49 // of |render_frame_host| destruction.
50 render_frame_host->GetServiceRegistry()->AddService(
51 base::Bind(&ContentAutofillDriver::BindRequest, base::Unretained(this)));
52 } 45 }
53 46
54 ContentAutofillDriver::~ContentAutofillDriver() {} 47 ContentAutofillDriver::~ContentAutofillDriver() {}
55 48
56 void ContentAutofillDriver::BindRequest(mojom::AutofillDriverRequest request) { 49 void ContentAutofillDriver::BindRequest(mojom::AutofillDriverRequest request) {
57 bindings_.AddBinding(this, std::move(request)); 50 bindings_.AddBinding(this, std::move(request));
58 } 51 }
59 52
60 bool ContentAutofillDriver::IsOffTheRecord() const { 53 bool ContentAutofillDriver::IsOffTheRecord() const {
61 return render_frame_host_->GetSiteInstance() 54 return render_frame_host_->GetSiteInstance()
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 235
243 void ContentAutofillDriver::ConnectToMojoAutofillAgentIfNeeded() { 236 void ContentAutofillDriver::ConnectToMojoAutofillAgentIfNeeded() {
244 if (mojo_autofill_agent_) 237 if (mojo_autofill_agent_)
245 return; 238 return;
246 239
247 render_frame_host_->GetServiceRegistry()->ConnectToRemoteService( 240 render_frame_host_->GetServiceRegistry()->ConnectToRemoteService(
248 mojo::GetProxy(&mojo_autofill_agent_)); 241 mojo::GetProxy(&mojo_autofill_agent_));
249 } 242 }
250 243
251 } // namespace autofill 244 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | components/autofill/content/browser/content_autofill_driver_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698