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