| 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/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/chrome_pages.h" | 16 #include "chrome/browser/ui/chrome_pages.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 20 #include "webkit/forms/password_form.h" | 20 #include "webkit/forms/password_form.h" |
| 21 | 21 |
| 22 TabAutofillManagerDelegate::TabAutofillManagerDelegate(TabContents* tab) | 22 TabAutofillManagerDelegate::TabAutofillManagerDelegate(TabContents* tab) |
| 23 : tab_(tab) { | 23 : tab_(tab) { |
| 24 DCHECK(tab_); | 24 DCHECK(tab_); |
| 25 } | 25 } |
| 26 | 26 |
| 27 content::BrowserContext* TabAutofillManagerDelegate::GetBrowserContext() const { |
| 28 return tab_->profile(); |
| 29 } |
| 30 |
| 31 content::BrowserContext* |
| 32 TabAutofillManagerDelegate::GetOriginalBrowserContext() const { |
| 33 return tab_->profile()->GetOriginalProfile(); |
| 34 } |
| 35 |
| 27 InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() { | 36 InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() { |
| 28 return tab_->infobar_tab_helper(); | 37 return tab_->infobar_tab_helper(); |
| 29 } | 38 } |
| 30 | 39 |
| 31 PrefServiceBase* TabAutofillManagerDelegate::GetPrefs() { | 40 PrefServiceBase* TabAutofillManagerDelegate::GetPrefs() { |
| 32 return tab_->profile()->GetPrefs(); | 41 return tab_->profile()->GetPrefs(); |
| 33 } | 42 } |
| 34 | 43 |
| 35 bool TabAutofillManagerDelegate::IsSavingPasswordsEnabled() const { | 44 bool TabAutofillManagerDelegate::IsSavingPasswordsEnabled() const { |
| 36 return tab_->password_manager()->IsSavingEnabled(); | 45 return tab_->password_manager()->IsSavingEnabled(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 const gfx::Rect& bounds, | 59 const gfx::Rect& bounds, |
| 51 const webkit::forms::PasswordForm& form, | 60 const webkit::forms::PasswordForm& form, |
| 52 autofill::PasswordGenerator* generator) { | 61 autofill::PasswordGenerator* generator) { |
| 53 #if defined(OS_ANDROID) | 62 #if defined(OS_ANDROID) |
| 54 NOTIMPLEMENTED(); | 63 NOTIMPLEMENTED(); |
| 55 #else | 64 #else |
| 56 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); | 65 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); |
| 57 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); | 66 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); |
| 58 #endif // #if defined(OS_ANDROID) | 67 #endif // #if defined(OS_ANDROID) |
| 59 } | 68 } |
| OLD | NEW |