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

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: Address comments 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/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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void TabAutofillManagerDelegate::ShowAutofillSettings() { 95 void TabAutofillManagerDelegate::ShowAutofillSettings() {
99 #if defined(OS_ANDROID) 96 #if defined(OS_ANDROID)
100 NOTIMPLEMENTED(); 97 NOTIMPLEMENTED();
101 #else 98 #else
102 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); 99 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
103 if (browser) 100 if (browser)
104 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); 101 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage);
105 #endif // #if defined(OS_ANDROID) 102 #endif // #if defined(OS_ANDROID)
106 } 103 }
107 104
105 void TabAutofillManagerDelegate::ConfirmSaveCreditCard(
106 const AutofillMetrics& metric_logger,
107 const CreditCard& credit_card,
108 const base::Closure& save_card_callback) {
109 InfoBarService* infobar_service =
110 InfoBarService::FromWebContents(web_contents_);
111 AutofillCCInfoBarDelegate::Create(
112 infobar_service, &metric_logger, save_card_callback);
113 }
114
108 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble( 115 void TabAutofillManagerDelegate::ShowPasswordGenerationBubble(
109 const gfx::Rect& bounds, 116 const gfx::Rect& bounds,
110 const content::PasswordForm& form, 117 const content::PasswordForm& form,
111 autofill::PasswordGenerator* generator) { 118 autofill::PasswordGenerator* generator) {
112 #if defined(OS_ANDROID) 119 #if defined(OS_ANDROID)
113 NOTIMPLEMENTED(); 120 NOTIMPLEMENTED();
114 #else 121 #else
115 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); 122 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
116 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator); 123 browser->window()->ShowPasswordGenerationBubble(bounds, form, generator);
117 #endif // #if defined(OS_ANDROID) 124 #endif // #if defined(OS_ANDROID)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 const content::LoadCommittedDetails& details, 203 const content::LoadCommittedDetails& details,
197 const content::FrameNavigateParams& params) { 204 const content::FrameNavigateParams& params) {
198 if (dialog_controller_ && 205 if (dialog_controller_ &&
199 dialog_controller_->dialog_type() == 206 dialog_controller_->dialog_type() ==
200 autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE) { 207 autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE) {
201 HideRequestAutocompleteDialog(); 208 HideRequestAutocompleteDialog();
202 } 209 }
203 } 210 }
204 211
205 } // namespace autofill 212 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698