| 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/autofill_cc_infobar_delegate.h" | 9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
| 12 #include "chrome/browser/password_manager/password_generation_manager.h" | 12 #include "chrome/browser/password_manager/password_generation_manager.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 14 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| 15 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 15 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/chrome_pages.h" | 19 #include "chrome/browser/ui/chrome_pages.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 21 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 21 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 22 #include "components/autofill/content/browser/autofill_driver_impl.h" | 23 #include "components/autofill/content/browser/autofill_driver_impl.h" |
| 23 #include "components/autofill/core/common/autofill_messages.h" | 24 #include "components/autofill/core/common/autofill_messages.h" |
| 24 #include "components/autofill/core/common/autofill_pref_names.h" | 25 #include "components/autofill/core/common/autofill_pref_names.h" |
| 25 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
| 26 #include "content/public/browser/web_contents_view.h" | 27 #include "content/public/browser/web_contents_view.h" |
| 27 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
| 28 | 29 |
| 29 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::TabAutofillManagerDelegate); | 30 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::TabAutofillManagerDelegate); |
| 30 | 31 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 55 | 56 |
| 56 PersonalDataManager* TabAutofillManagerDelegate::GetPersonalDataManager() { | 57 PersonalDataManager* TabAutofillManagerDelegate::GetPersonalDataManager() { |
| 57 Profile* profile = | 58 Profile* profile = |
| 58 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 59 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 59 return PersonalDataManagerFactory::GetForProfile( | 60 return PersonalDataManagerFactory::GetForProfile( |
| 60 profile->GetOriginalProfile()); | 61 profile->GetOriginalProfile()); |
| 61 } | 62 } |
| 62 | 63 |
| 63 scoped_refptr<AutofillWebDataService> | 64 scoped_refptr<AutofillWebDataService> |
| 64 TabAutofillManagerDelegate::GetDatabase() { | 65 TabAutofillManagerDelegate::GetDatabase() { |
| 65 return AutofillWebDataService::FromBrowserContext( | 66 Profile* profile = |
| 66 web_contents_->GetBrowserContext()); | 67 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 68 return WebDataServiceFactory::GetAutofillWebDataForProfile( |
| 69 profile, Profile::EXPLICIT_ACCESS); |
| 67 } | 70 } |
| 68 | 71 |
| 69 PrefService* TabAutofillManagerDelegate::GetPrefs() { | 72 PrefService* TabAutofillManagerDelegate::GetPrefs() { |
| 70 return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> | 73 return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> |
| 71 GetPrefs(); | 74 GetPrefs(); |
| 72 } | 75 } |
| 73 | 76 |
| 74 void TabAutofillManagerDelegate::ShowAutofillSettings() { | 77 void TabAutofillManagerDelegate::ShowAutofillSettings() { |
| 75 #if defined(OS_ANDROID) | 78 #if defined(OS_ANDROID) |
| 76 NOTIMPLEMENTED(); | 79 NOTIMPLEMENTED(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 182 |
| 180 void TabAutofillManagerDelegate::DetectAccountCreationForms( | 183 void TabAutofillManagerDelegate::DetectAccountCreationForms( |
| 181 const std::vector<autofill::FormStructure*>& forms) { | 184 const std::vector<autofill::FormStructure*>& forms) { |
| 182 PasswordGenerationManager* manager = | 185 PasswordGenerationManager* manager = |
| 183 PasswordGenerationManager::FromWebContents(web_contents_); | 186 PasswordGenerationManager::FromWebContents(web_contents_); |
| 184 if (manager) | 187 if (manager) |
| 185 manager->DetectAccountCreationForms(forms); | 188 manager->DetectAccountCreationForms(forms); |
| 186 } | 189 } |
| 187 | 190 |
| 188 } // namespace autofill | 191 } // namespace autofill |
| OLD | NEW |