| 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 "chrome/browser/autofill/password_generator.h" | 8 #include "chrome/browser/autofill/password_generator.h" |
| 9 #include "chrome/browser/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 10 #include "chrome/browser/password_manager/password_manager.h" | 10 #include "chrome/browser/password_manager/password_manager.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/sync/profile_sync_service.h" |
| 14 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 13 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/chrome_pages.h" | 18 #include "chrome/browser/ui/chrome_pages.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 18 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 19 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| 20 #include "webkit/forms/password_form.h" | 22 #include "webkit/forms/password_form.h" |
| 21 | 23 |
| 22 TabAutofillManagerDelegate::TabAutofillManagerDelegate(TabContents* tab) | 24 TabAutofillManagerDelegate::TabAutofillManagerDelegate(TabContents* tab) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 } | 36 } |
| 35 | 37 |
| 36 InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() { | 38 InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() { |
| 37 return tab_->infobar_tab_helper(); | 39 return tab_->infobar_tab_helper(); |
| 38 } | 40 } |
| 39 | 41 |
| 40 PrefServiceBase* TabAutofillManagerDelegate::GetPrefs() { | 42 PrefServiceBase* TabAutofillManagerDelegate::GetPrefs() { |
| 41 return tab_->profile()->GetPrefs(); | 43 return tab_->profile()->GetPrefs(); |
| 42 } | 44 } |
| 43 | 45 |
| 46 ProfileSyncServiceBase* TabAutofillManagerDelegate::GetProfileSyncService() { |
| 47 return ProfileSyncServiceFactory::GetForProfile(tab_->profile()); |
| 48 } |
| 49 |
| 44 bool TabAutofillManagerDelegate::IsSavingPasswordsEnabled() const { | 50 bool TabAutofillManagerDelegate::IsSavingPasswordsEnabled() const { |
| 45 return tab_->password_manager()->IsSavingEnabled(); | 51 return tab_->password_manager()->IsSavingEnabled(); |
| 46 } | 52 } |
| 47 | 53 |
| 48 void TabAutofillManagerDelegate::ShowAutofillSettings() { | 54 void TabAutofillManagerDelegate::ShowAutofillSettings() { |
| 49 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) |
| 50 NOTIMPLEMENTED(); | 56 NOTIMPLEMENTED(); |
| 51 #else | 57 #else |
| 52 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); | 58 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); |
| 53 if (browser) | 59 if (browser) |
| 54 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); | 60 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); |
| 55 #endif // #if defined(OS_ANDROID) | 61 #endif // #if defined(OS_ANDROID) |
| 56 } | 62 } |
| 57 | 63 |
| 58 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble( | 64 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble( |
| 59 const gfx::Rect& bounds, | 65 const gfx::Rect& bounds, |
| 60 const webkit::forms::PasswordForm& form, | 66 const webkit::forms::PasswordForm& form, |
| 61 autofill::PasswordGenerator* generator) { | 67 autofill::PasswordGenerator* generator) { |
| 62 #if defined(OS_ANDROID) | 68 #if defined(OS_ANDROID) |
| 63 NOTIMPLEMENTED(); | 69 NOTIMPLEMENTED(); |
| 64 #else | 70 #else |
| 65 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); | 71 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); |
| 66 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); | 72 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); |
| 67 #endif // #if defined(OS_ANDROID) | 73 #endif // #if defined(OS_ANDROID) |
| 68 } | 74 } |
| OLD | NEW |