Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc

Issue 10910071: Extract abstract base to API directory for ProfileSyncService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More unit test fixes. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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)
23 : tab_(tab) { 25 : tab_(tab) {
24 DCHECK(tab_); 26 DCHECK(tab_);
25 } 27 }
26 28
27 content::BrowserContext* TabAutofillManagerDelegate::GetBrowserContext() const { 29 content::BrowserContext* TabAutofillManagerDelegate::GetBrowserContext() const {
28 return tab_->profile(); 30 return tab_->profile();
29 } 31 }
30 32
31 content::BrowserContext* 33 content::BrowserContext*
32 TabAutofillManagerDelegate::GetOriginalBrowserContext() const { 34 TabAutofillManagerDelegate::GetOriginalBrowserContext() const {
33 return tab_->profile()->GetOriginalProfile(); 35 return tab_->profile()->GetOriginalProfile();
34 } 36 }
35 37
38 Profile* TabAutofillManagerDelegate::GetOriginalProfile() const {
39 return tab_->profile()->GetOriginalProfile();
40 }
41
36 InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() { 42 InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() {
37 return tab_->infobar_tab_helper(); 43 return tab_->infobar_tab_helper();
38 } 44 }
39 45
40 PrefServiceBase* TabAutofillManagerDelegate::GetPrefs() { 46 PrefServiceBase* TabAutofillManagerDelegate::GetPrefs() {
41 return tab_->profile()->GetPrefs(); 47 return tab_->profile()->GetPrefs();
42 } 48 }
43 49
50 ProfileSyncServiceBase* TabAutofillManagerDelegate::GetProfileSyncService() {
51 return ProfileSyncServiceFactory::GetForProfile(tab_->profile());
52 }
53
44 bool TabAutofillManagerDelegate::IsSavingPasswordsEnabled() const { 54 bool TabAutofillManagerDelegate::IsSavingPasswordsEnabled() const {
45 return tab_->password_manager()->IsSavingEnabled(); 55 return tab_->password_manager()->IsSavingEnabled();
46 } 56 }
47 57
48 void TabAutofillManagerDelegate::ShowAutofillSettings() { 58 void TabAutofillManagerDelegate::ShowAutofillSettings() {
49 #if defined(OS_ANDROID) 59 #if defined(OS_ANDROID)
50 NOTIMPLEMENTED(); 60 NOTIMPLEMENTED();
51 #else 61 #else
52 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); 62 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents());
53 if (browser) 63 if (browser)
54 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); 64 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage);
55 #endif // #if defined(OS_ANDROID) 65 #endif // #if defined(OS_ANDROID)
56 } 66 }
57 67
58 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble( 68 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble(
59 const gfx::Rect& bounds, 69 const gfx::Rect& bounds,
60 const webkit::forms::PasswordForm& form, 70 const webkit::forms::PasswordForm& form,
61 autofill::PasswordGenerator* generator) { 71 autofill::PasswordGenerator* generator) {
62 #if defined(OS_ANDROID) 72 #if defined(OS_ANDROID)
63 NOTIMPLEMENTED(); 73 NOTIMPLEMENTED();
64 #else 74 #else
65 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents()); 75 Browser* browser = browser::FindBrowserWithWebContents(tab_->web_contents());
66 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); 76 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator);
67 #endif // #if defined(OS_ANDROID) 77 #endif // #if defined(OS_ANDROID)
68 } 78 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/tab_autofill_manager_delegate.h ('k') | chrome/browser/ui/browser_command_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698