| 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/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/api/infobars/infobar_service.h" | 10 #include "chrome/browser/api/infobars/infobar_service.h" |
| 11 #include "chrome/browser/autofill/autofill_cc_import_confirmation_delegate.h" |
| 12 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| 10 #include "chrome/browser/autofill/password_generator.h" | 13 #include "chrome/browser/autofill/password_generator.h" |
| 11 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 14 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 12 #include "chrome/browser/password_manager/password_manager.h" | 15 #include "chrome/browser/password_manager/password_manager.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sync/profile_sync_service.h" | 17 #include "chrome/browser/sync/profile_sync_service.h" |
| 15 #include "chrome/browser/sync/profile_sync_service_factory.h" | 18 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 16 #include "chrome/browser/ui/autofill/autocheckout_bubble.h" | 19 #include "chrome/browser/ui/autofill/autocheckout_bubble.h" |
| 17 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 20 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 18 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_finder.h" | 22 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 : content::WebContentsObserver(web_contents), | 36 : content::WebContentsObserver(web_contents), |
| 34 web_contents_(web_contents), | 37 web_contents_(web_contents), |
| 35 dialog_controller_(NULL) { | 38 dialog_controller_(NULL) { |
| 36 DCHECK(web_contents); | 39 DCHECK(web_contents); |
| 37 } | 40 } |
| 38 | 41 |
| 39 TabAutofillManagerDelegate::~TabAutofillManagerDelegate() { | 42 TabAutofillManagerDelegate::~TabAutofillManagerDelegate() { |
| 40 HideAutofillPopup(); | 43 HideAutofillPopup(); |
| 41 } | 44 } |
| 42 | 45 |
| 43 InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() { | |
| 44 return InfoBarService::FromWebContents(web_contents_); | |
| 45 } | |
| 46 | |
| 47 PersonalDataManager* TabAutofillManagerDelegate::GetPersonalDataManager() { | 46 PersonalDataManager* TabAutofillManagerDelegate::GetPersonalDataManager() { |
| 48 Profile* profile = | 47 Profile* profile = |
| 49 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 48 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 50 return PersonalDataManagerFactory::GetForProfile( | 49 return PersonalDataManagerFactory::GetForProfile( |
| 51 profile->GetOriginalProfile()); | 50 profile->GetOriginalProfile()); |
| 52 } | 51 } |
| 53 | 52 |
| 54 PrefService* TabAutofillManagerDelegate::GetPrefs() { | 53 PrefService* TabAutofillManagerDelegate::GetPrefs() { |
| 55 return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> | 54 return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> |
| 56 GetPrefs(); | 55 GetPrefs(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 73 void TabAutofillManagerDelegate::ShowAutofillSettings() { | 72 void TabAutofillManagerDelegate::ShowAutofillSettings() { |
| 74 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
| 75 NOTIMPLEMENTED(); | 74 NOTIMPLEMENTED(); |
| 76 #else | 75 #else |
| 77 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 76 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
| 78 if (browser) | 77 if (browser) |
| 79 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); | 78 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); |
| 80 #endif // #if defined(OS_ANDROID) | 79 #endif // #if defined(OS_ANDROID) |
| 81 } | 80 } |
| 82 | 81 |
| 82 void TabAutofillManagerDelegate::ShowAutofillCCImportConfirmation( |
| 83 scoped_ptr<AutofillCCImportConfirmationDelegate> delegate) { |
| 84 InfoBarService* infobar_service = |
| 85 InfoBarService::FromWebContents(web_contents_); |
| 86 AutofillCCInfoBarDelegate::Create(infobar_service, delegate.Pass()); |
| 87 } |
| 88 |
| 83 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble( | 89 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble( |
| 84 const gfx::Rect& bounds, | 90 const gfx::Rect& bounds, |
| 85 const content::PasswordForm& form, | 91 const content::PasswordForm& form, |
| 86 autofill::PasswordGenerator* generator) { | 92 autofill::PasswordGenerator* generator) { |
| 87 #if defined(OS_ANDROID) | 93 #if defined(OS_ANDROID) |
| 88 NOTIMPLEMENTED(); | 94 NOTIMPLEMENTED(); |
| 89 #else | 95 #else |
| 90 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 96 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
| 91 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); | 97 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); |
| 92 #endif // #if defined(OS_ANDROID) | 98 #endif // #if defined(OS_ANDROID) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const content::LoadCommittedDetails& details, | 173 const content::LoadCommittedDetails& details, |
| 168 const content::FrameNavigateParams& params) { | 174 const content::FrameNavigateParams& params) { |
| 169 if (dialog_controller_ && | 175 if (dialog_controller_ && |
| 170 dialog_controller_->dialog_type() == | 176 dialog_controller_->dialog_type() == |
| 171 autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE) { | 177 autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE) { |
| 172 HideRequestAutocompleteDialog(); | 178 HideRequestAutocompleteDialog(); |
| 173 } | 179 } |
| 174 } | 180 } |
| 175 | 181 |
| 176 } // namespace autofill | 182 } // namespace autofill |
| OLD | NEW |