| 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" |
| 11 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 11 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 12 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
| 13 #include "chrome/browser/password_manager/password_manager.h" | 13 #include "chrome/browser/password_manager/password_manager.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
| 16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 16 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 17 #include "chrome/browser/ui/autofill/autocheckout_bubble.h" | 17 #include "chrome/browser/ui/autofill/autocheckout_bubble.h" |
| 18 #include "chrome/browser/ui/autofill/autocheckout_bubble_controller.h" | 18 #include "chrome/browser/ui/autofill/autocheckout_bubble_controller.h" |
| 19 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 19 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 20 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 20 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_finder.h" | 22 #include "chrome/browser/ui/browser_finder.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/browser/ui/chrome_pages.h" | 24 #include "chrome/browser/ui/chrome_pages.h" |
| 25 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 25 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 26 #include "components/autofill/browser/password_generator.h" | 27 #include "components/autofill/browser/password_generator.h" |
| 28 #include "components/autofill/browser/webdata/autofill_webdata_service.h" |
| 27 #include "content/public/browser/web_contents_view.h" | 29 #include "content/public/browser/web_contents_view.h" |
| 28 #include "content/public/common/password_form.h" | 30 #include "content/public/common/password_form.h" |
| 29 #include "ui/gfx/rect.h" | 31 #include "ui/gfx/rect.h" |
| 30 | 32 |
| 31 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::TabAutofillManagerDelegate); | 33 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::TabAutofillManagerDelegate); |
| 32 | 34 |
| 33 namespace autofill { | 35 namespace autofill { |
| 34 | 36 |
| 35 TabAutofillManagerDelegate::TabAutofillManagerDelegate( | 37 TabAutofillManagerDelegate::TabAutofillManagerDelegate( |
| 36 content::WebContents* web_contents) | 38 content::WebContents* web_contents) |
| 37 : content::WebContentsObserver(web_contents), | 39 : content::WebContentsObserver(web_contents), |
| 38 web_contents_(web_contents) { | 40 web_contents_(web_contents) { |
| 39 DCHECK(web_contents); | 41 DCHECK(web_contents); |
| 40 } | 42 } |
| 41 | 43 |
| 42 TabAutofillManagerDelegate::~TabAutofillManagerDelegate() { | 44 TabAutofillManagerDelegate::~TabAutofillManagerDelegate() { |
| 43 HideAutofillPopup(); | 45 HideAutofillPopup(); |
| 44 } | 46 } |
| 45 | 47 |
| 48 scoped_refptr<AutofillWebDataService> |
| 49 TabAutofillManagerDelegate::GetAutofillWebDataService() { |
| 50 Profile* profile = |
| 51 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 52 return WebDataServiceFactory::GetAutofillWebDataServiceForProfile(profile); |
| 53 } |
| 54 |
| 46 PersonalDataManager* TabAutofillManagerDelegate::GetPersonalDataManager() { | 55 PersonalDataManager* TabAutofillManagerDelegate::GetPersonalDataManager() { |
| 47 Profile* profile = | 56 Profile* profile = |
| 48 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 57 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 49 return PersonalDataManagerFactory::GetForProfile( | 58 return PersonalDataManagerFactory::GetForProfile( |
| 50 profile->GetOriginalProfile()); | 59 profile->GetOriginalProfile()); |
| 51 } | 60 } |
| 52 | 61 |
| 53 PrefService* TabAutofillManagerDelegate::GetPrefs() { | 62 PrefService* TabAutofillManagerDelegate::GetPrefs() { |
| 54 return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> | 63 return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> |
| 55 GetPrefs(); | 64 GetPrefs(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 if (dialog_controller_ && | 240 if (dialog_controller_ && |
| 232 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || | 241 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || |
| 233 !dialog_controller_->AutocheckoutIsRunning())) { | 242 !dialog_controller_->AutocheckoutIsRunning())) { |
| 234 HideRequestAutocompleteDialog(); | 243 HideRequestAutocompleteDialog(); |
| 235 } | 244 } |
| 236 | 245 |
| 237 HideAutocheckoutBubble(); | 246 HideAutocheckoutBubble(); |
| 238 } | 247 } |
| 239 | 248 |
| 240 } // namespace autofill | 249 } // namespace autofill |
| OLD | NEW |