Chromium Code Reviews| Index: components/autofill/browser/autofill_manager.cc |
| diff --git a/components/autofill/browser/autofill_manager.cc b/components/autofill/browser/autofill_manager.cc |
| index 35b703c59e24d9735bef6341499e06ab1d54e0a4..f1a350fb849cf5b56a5e5f2094e2dfc0c8986e2f 100644 |
| --- a/components/autofill/browser/autofill_manager.cc |
| +++ b/components/autofill/browser/autofill_manager.cc |
| @@ -50,6 +50,7 @@ |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_view.h" |
| +#include "content/public/common/frame_navigate_params.h" |
| #include "content/public/common/url_constants.h" |
| #include "googleurl/src/gurl.h" |
| #include "grit/component_resources.h" |
| @@ -205,7 +206,7 @@ AutofillManager::AutofillManager( |
| autofill::AutofillManagerDelegate* delegate, |
| const std::string& app_locale, |
| AutofillDownloadManagerState enable_download_manager) |
| - : content::WebContentsObserver(web_contents), |
| + : web_contents_(web_contents), |
|
Ilya Sherman
2013/06/05 10:50:02
This doesn't seem safe, as the WebContentsObserver
blundell
2013/06/11 15:35:47
Yes, you're right. Made AutofillDriver an interfac
|
| manager_delegate_(delegate), |
| app_locale_(app_locale), |
| personal_data_(delegate->GetPersonalDataManager()), |
| @@ -311,6 +312,8 @@ bool AutofillManager::OnMessageReceived(const IPC::Message& message) { |
| OnClickFailed) |
| IPC_MESSAGE_HANDLER(AutofillHostMsg_MaybeShowAutocheckoutBubble, |
| OnMaybeShowAutocheckoutBubble) |
| + IPC_MESSAGE_HANDLER(AutofillHostMsg_RemoveAutocompleteEntry, |
| + RemoveAutocompleteEntry) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| @@ -325,7 +328,7 @@ bool AutofillManager::OnFormSubmitted(const FormData& form, |
| if (!IsAutofillEnabled()) |
| return false; |
| - if (web_contents()->GetBrowserContext()->IsOffTheRecord()) |
| + if (web_contents_->GetBrowserContext()->IsOffTheRecord()) |
| return false; |
| // Don't save data that was submitted through JavaScript. |
| @@ -404,7 +407,7 @@ void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, |
| if (is_post_document_load) |
| Reset(); |
| - RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| + RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| if (!host) |
| return; |
| @@ -712,7 +715,7 @@ void AutofillManager::RemoveAutocompleteEntry(const base::string16& name, |
| } |
| content::WebContents* AutofillManager::GetWebContents() const { |
| - return web_contents(); |
| + return web_contents_; |
| } |
| const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { |
| @@ -784,12 +787,12 @@ void AutofillManager::OnRequestAutocomplete( |
| void AutofillManager::ReturnAutocompleteResult( |
| WebFormElement::AutocompleteResult result, const FormData& form_data) { |
| - // web_contents() will be NULL when the interactive autocomplete is closed due |
| + // web_contents_ will be NULL when the interactive autocomplete is closed due |
| // to a tab or browser window closing. |
| - if (!web_contents()) |
| + if (!web_contents_) |
| return; |
| - RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| + RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| if (!host) |
| return; |
| @@ -822,7 +825,7 @@ void AutofillManager::OnLoadedServerPredictions( |
| *metric_logger_); |
| if (page_meta_data->IsInAutofillableFlow()) { |
| - RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| + RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| if (host) |
| host->Send(new AutofillMsg_AutocheckoutSupported(host->GetRoutingID())); |
| } |
| @@ -861,13 +864,13 @@ void AutofillManager::OnMaybeShowAutocheckoutBubble( |
| } |
| std::string AutofillManager::GetAutocheckoutURLPrefix() const { |
| - if (!web_contents()) |
| + if (!web_contents_) |
| return std::string(); |
| autofill::autocheckout::WhitelistManager* whitelist_manager = |
| manager_delegate_->GetAutocheckoutWhitelistManager(); |
| - return whitelist_manager->GetMatchedURLPrefix(web_contents()->GetURL()); |
| + return whitelist_manager->GetMatchedURLPrefix(web_contents_->GetURL()); |
| } |
| bool AutofillManager::IsAutofillEnabled() const { |
| @@ -880,7 +883,7 @@ void AutofillManager::SendAutofillTypePredictions( |
| switches::kShowAutofillTypePredictions)) |
| return; |
| - RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| + RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| if (!host) |
| return; |
| @@ -965,7 +968,7 @@ void AutofillManager::Reset() { |
| AutofillManager::AutofillManager(content::WebContents* web_contents, |
| autofill::AutofillManagerDelegate* delegate, |
| PersonalDataManager* personal_data) |
| - : content::WebContentsObserver(web_contents), |
| + : web_contents_(web_contents), |
| manager_delegate_(delegate), |
| app_locale_("en-US"), |
| personal_data_(personal_data), |
| @@ -999,7 +1002,7 @@ bool AutofillManager::GetHost(RenderViewHost** host) const { |
| return false; |
| } |
| - *host = web_contents()->GetRenderViewHost(); |
| + *host = web_contents_->GetRenderViewHost(); |
| if (!*host) |
| return false; |