Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" | 5 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h" | 9 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h" |
| 10 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 10 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 namespace autofill { | 31 namespace autofill { |
| 32 | 32 |
| 33 TabAutofillManagerDelegate::TabAutofillManagerDelegate( | 33 TabAutofillManagerDelegate::TabAutofillManagerDelegate( |
| 34 content::WebContents* web_contents) | 34 content::WebContents* web_contents) |
| 35 : content::WebContentsObserver(web_contents), | 35 : content::WebContentsObserver(web_contents), |
| 36 web_contents_(web_contents) { | 36 web_contents_(web_contents) { |
| 37 DCHECK(web_contents); | 37 DCHECK(web_contents); |
| 38 } | 38 } |
| 39 | 39 |
| 40 TabAutofillManagerDelegate::~TabAutofillManagerDelegate() { | 40 TabAutofillManagerDelegate::~TabAutofillManagerDelegate() { |
| 41 HideAutofillPopup(); | 41 // NOTE: It is too late to clean up the autofill popup; that cleanup process |
| 42 // requires that the WebContents instance still be valid and it is not at | |
| 43 // this point (in particular, the WebContentsImpl destructor has already | |
| 44 // finished running and we are now in the base class destructor). | |
| 45 DCHECK(!popup_controller_.get()); | |
|
Ilya Sherman
2013/07/03 19:56:49
nit: I don't think the ".get()" is needed here.
blundell
2013/07/04 08:32:45
Done.
| |
| 42 } | 46 } |
| 43 | 47 |
| 44 PersonalDataManager* TabAutofillManagerDelegate::GetPersonalDataManager() { | 48 PersonalDataManager* TabAutofillManagerDelegate::GetPersonalDataManager() { |
| 45 Profile* profile = | 49 Profile* profile = |
| 46 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 50 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 47 return PersonalDataManagerFactory::GetForProfile( | 51 return PersonalDataManagerFactory::GetForProfile( |
| 48 profile->GetOriginalProfile()); | 52 profile->GetOriginalProfile()); |
| 49 } | 53 } |
| 50 | 54 |
| 51 PrefService* TabAutofillManagerDelegate::GetPrefs() { | 55 PrefService* TabAutofillManagerDelegate::GetPrefs() { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 content::PageTransitionIsRedirect(details.entry->GetTransitionType()); | 202 content::PageTransitionIsRedirect(details.entry->GetTransitionType()); |
| 199 if (dialog_controller_.get() && | 203 if (dialog_controller_.get() && |
| 200 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || | 204 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || |
| 201 (!dialog_controller_->AutocheckoutIsRunning() && !was_redirect))) { | 205 (!dialog_controller_->AutocheckoutIsRunning() && !was_redirect))) { |
| 202 HideRequestAutocompleteDialog(); | 206 HideRequestAutocompleteDialog(); |
| 203 } | 207 } |
| 204 | 208 |
| 205 HideAutocheckoutBubble(); | 209 HideAutocheckoutBubble(); |
| 206 } | 210 } |
| 207 | 211 |
| 212 void TabAutofillManagerDelegate::WebContentsDestroyed( | |
| 213 content::WebContents* web_contents) { | |
| 214 HideAutofillPopup(); | |
| 215 } | |
| 216 | |
| 208 } // namespace autofill | 217 } // namespace autofill |
| OLD | NEW |