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

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

Issue 12378055: Make autofill stop depending on InfoBarService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 7 years, 9 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 "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
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 15 matching lines...) Expand all
72 void TabAutofillManagerDelegate::ShowAutofillSettings() { 71 void TabAutofillManagerDelegate::ShowAutofillSettings() {
73 #if defined(OS_ANDROID) 72 #if defined(OS_ANDROID)
74 NOTIMPLEMENTED(); 73 NOTIMPLEMENTED();
75 #else 74 #else
76 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); 75 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
77 if (browser) 76 if (browser)
78 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); 77 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage);
79 #endif // #if defined(OS_ANDROID) 78 #endif // #if defined(OS_ANDROID)
80 } 79 }
81 80
81 void TabAutofillManagerDelegate::ShowAutofillCCImportConfirmation(
82 scoped_ptr<AutofillCCImportConfirmationDelegate> delegate) {
83 InfoBarService* infobar_service =
84 InfoBarService::FromWebContents(web_contents_);
85 AutofillCCInfoBarDelegate::Create(infobar_service, delegate.Pass());
86 }
87
82 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble( 88 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble(
83 const gfx::Rect& bounds, 89 const gfx::Rect& bounds,
84 const content::PasswordForm& form, 90 const content::PasswordForm& form,
85 autofill::PasswordGenerator* generator) { 91 autofill::PasswordGenerator* generator) {
86 #if defined(OS_ANDROID) 92 #if defined(OS_ANDROID)
87 NOTIMPLEMENTED(); 93 NOTIMPLEMENTED();
88 #else 94 #else
89 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); 95 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
90 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); 96 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator);
91 #endif // #if defined(OS_ANDROID) 97 #endif // #if defined(OS_ANDROID)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 const content::LoadCommittedDetails& details, 171 const content::LoadCommittedDetails& details,
166 const content::FrameNavigateParams& params) { 172 const content::FrameNavigateParams& params) {
167 if (dialog_controller_ && 173 if (dialog_controller_ &&
168 dialog_controller_->dialog_type() == 174 dialog_controller_->dialog_type() ==
169 autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE) { 175 autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE) {
170 HideRequestAutocompleteDialog(); 176 HideRequestAutocompleteDialog();
171 } 177 }
172 } 178 }
173 179
174 } // namespace autofill 180 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698