| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill_driver_impl.h" | 5 #include "components/autofill/content/browser/autofill_driver_impl.h" |
| 6 | 6 |
| 7 #include "components/autofill/browser/autofill_external_delegate.h" | 7 #include "components/autofill/browser/autofill_external_delegate.h" |
| 8 #include "components/autofill/browser/autofill_manager.h" | 8 #include "components/autofill/browser/autofill_manager.h" |
| 9 #include "components/autofill/browser/autofill_manager_delegate.h" | 9 #include "components/autofill/browser/autofill_manager_delegate.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 contents->GetUserData(kAutofillDriverImplWebContentsUserDataKey)); | 48 contents->GetUserData(kAutofillDriverImplWebContentsUserDataKey)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 AutofillDriverImpl::AutofillDriverImpl( | 51 AutofillDriverImpl::AutofillDriverImpl( |
| 52 content::WebContents* web_contents, | 52 content::WebContents* web_contents, |
| 53 autofill::AutofillManagerDelegate* delegate, | 53 autofill::AutofillManagerDelegate* delegate, |
| 54 const std::string& app_locale, | 54 const std::string& app_locale, |
| 55 AutofillManager::AutofillDownloadManagerState enable_download_manager, | 55 AutofillManager::AutofillDownloadManagerState enable_download_manager, |
| 56 bool enable_native_ui) | 56 bool enable_native_ui) |
| 57 : content::WebContentsObserver(web_contents), | 57 : content::WebContentsObserver(web_contents), |
| 58 autofill_manager_(this, delegate, app_locale, enable_download_manager) { | 58 autofill_manager_(new AutofillManager( |
| 59 this, delegate, app_locale, enable_download_manager)) { |
| 59 if (enable_native_ui) { | 60 if (enable_native_ui) { |
| 60 SetAutofillExternalDelegate(scoped_ptr<AutofillExternalDelegate>( | 61 SetAutofillExternalDelegate(scoped_ptr<AutofillExternalDelegate>( |
| 61 new AutofillExternalDelegate(web_contents, &autofill_manager_))); | 62 new AutofillExternalDelegate(web_contents, autofill_manager_.get()))); |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| 65 AutofillDriverImpl::~AutofillDriverImpl() {} | 66 AutofillDriverImpl::~AutofillDriverImpl() {} |
| 66 | 67 |
| 67 content::WebContents* AutofillDriverImpl::GetWebContents() { | 68 content::WebContents* AutofillDriverImpl::GetWebContents() { |
| 68 return web_contents(); | 69 return web_contents(); |
| 69 } | 70 } |
| 70 | 71 |
| 71 bool AutofillDriverImpl::OnMessageReceived(const IPC::Message& message) { | 72 bool AutofillDriverImpl::OnMessageReceived(const IPC::Message& message) { |
| 72 // TODO(blundell): Move IPC handling into this class. | 73 // TODO(blundell): Move IPC handling into this class. |
| 73 return autofill_manager_.OnMessageReceived(message); | 74 return autofill_manager_->OnMessageReceived(message); |
| 74 } | 75 } |
| 75 | 76 |
| 76 void AutofillDriverImpl::DidNavigateMainFrame( | 77 void AutofillDriverImpl::DidNavigateMainFrame( |
| 77 const content::LoadCommittedDetails& details, | 78 const content::LoadCommittedDetails& details, |
| 78 const content::FrameNavigateParams& params) { | 79 const content::FrameNavigateParams& params) { |
| 79 // TODO(blundell): Move the logic of this method into this class. | 80 // TODO(blundell): Move the logic of this method into this class. |
| 80 autofill_manager_.DidNavigateMainFrame(details, params); | 81 autofill_manager_->DidNavigateMainFrame(details, params); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void AutofillDriverImpl::SetAutofillExternalDelegate( | 84 void AutofillDriverImpl::SetAutofillExternalDelegate( |
| 84 scoped_ptr<AutofillExternalDelegate> delegate) { | 85 scoped_ptr<AutofillExternalDelegate> delegate) { |
| 85 autofill_external_delegate_.reset(delegate.release()); | 86 autofill_external_delegate_.reset(delegate.release()); |
| 86 autofill_manager_.SetExternalDelegate(autofill_external_delegate_.get()); | 87 autofill_manager_->SetExternalDelegate(autofill_external_delegate_.get()); |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace autofill | 90 } // namespace autofill |
| OLD | NEW |