| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_(this, delegate, app_locale, enable_download_manager) { |
| 59 if (enable_native_ui) { | 59 if (enable_native_ui) { |
| 60 // TODO(blundell): Eliminate AutofillExternalDelegate being a WCUD and | 60 SetAutofillExternalDelegate(scoped_ptr<AutofillExternalDelegate>( |
| 61 // transfer ownership of it to this class. | 61 new AutofillExternalDelegate(web_contents, &autofill_manager_))); |
| 62 AutofillExternalDelegate::CreateForWebContentsAndManager( | |
| 63 web_contents, &autofill_manager_); | |
| 64 autofill_manager_.SetExternalDelegate( | |
| 65 AutofillExternalDelegate::FromWebContents(web_contents)); | |
| 66 } | 62 } |
| 67 } | 63 } |
| 68 | 64 |
| 69 AutofillDriverImpl::~AutofillDriverImpl() {} | 65 AutofillDriverImpl::~AutofillDriverImpl() {} |
| 70 | 66 |
| 71 content::WebContents* AutofillDriverImpl::GetWebContents() { | 67 content::WebContents* AutofillDriverImpl::GetWebContents() { |
| 72 return web_contents(); | 68 return web_contents(); |
| 73 } | 69 } |
| 74 | 70 |
| 75 bool AutofillDriverImpl::OnMessageReceived(const IPC::Message& message) { | 71 bool AutofillDriverImpl::OnMessageReceived(const IPC::Message& message) { |
| 76 // TODO(blundell): Move IPC handling into this class. | 72 // TODO(blundell): Move IPC handling into this class. |
| 77 return autofill_manager_.OnMessageReceived(message); | 73 return autofill_manager_.OnMessageReceived(message); |
| 78 } | 74 } |
| 79 | 75 |
| 80 void AutofillDriverImpl::DidNavigateMainFrame( | 76 void AutofillDriverImpl::DidNavigateMainFrame( |
| 81 const content::LoadCommittedDetails& details, | 77 const content::LoadCommittedDetails& details, |
| 82 const content::FrameNavigateParams& params) { | 78 const content::FrameNavigateParams& params) { |
| 83 // TODO(blundell): Move the logic of this method into this class. | 79 // TODO(blundell): Move the logic of this method into this class. |
| 84 autofill_manager_.DidNavigateMainFrame(details, params); | 80 autofill_manager_.DidNavigateMainFrame(details, params); |
| 85 } | 81 } |
| 86 | 82 |
| 83 void AutofillDriverImpl::SetAutofillExternalDelegate( |
| 84 scoped_ptr<AutofillExternalDelegate> delegate) { |
| 85 autofill_external_delegate_.reset(delegate.release()); |
| 86 autofill_manager_.SetExternalDelegate(autofill_external_delegate_.get()); |
| 87 } |
| 88 |
| 87 } // namespace autofill | 89 } // namespace autofill |
| OLD | NEW |