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

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

Issue 1761073005: Enable the save card bubble on Mac without a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | components/autofill/core/common/autofill_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chrome_autofill_client.h" 5 #include "chrome/browser/ui/autofill/chrome_autofill_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #if defined(OS_ANDROID) 58 #if defined(OS_ANDROID)
59 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m obile.h" 59 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m obile.h"
60 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" 60 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h"
61 #include "components/infobars/core/infobar.h" 61 #include "components/infobars/core/infobar.h"
62 #endif 62 #endif
63 63
64 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); 64 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient);
65 65
66 namespace autofill { 66 namespace autofill {
67 67
68 namespace {
69
70 #if !defined(OS_ANDROID)
71 bool IsSaveCardBubbleEnabled() {
72 #if defined(OS_MACOSX)
73 return base::CommandLine::ForCurrentProcess()->HasSwitch(
74 switches::kEnableSaveCardBubble);
75 #else
76 return true;
77 #endif
78 }
79 #endif // !defined(OS_ANDROID)
80
81 } // namespace
82
83 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) 68 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents)
84 : content::WebContentsObserver(web_contents), 69 : content::WebContentsObserver(web_contents),
85 unmask_controller_( 70 unmask_controller_(
86 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), 71 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()),
87 Profile::FromBrowserContext(web_contents->GetBrowserContext()) 72 Profile::FromBrowserContext(web_contents->GetBrowserContext())
88 ->IsOffTheRecord()), 73 ->IsOffTheRecord()),
89 last_rfh_to_rac_(nullptr) { 74 last_rfh_to_rac_(nullptr) {
90 DCHECK(web_contents); 75 DCHECK(web_contents);
91 76
92 #if !BUILDFLAG(ANDROID_JAVA_UI) 77 #if !BUILDFLAG(ANDROID_JAVA_UI)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void ChromeAutofillClient::ConfirmSaveCreditCardLocally( 175 void ChromeAutofillClient::ConfirmSaveCreditCardLocally(
191 const CreditCard& card, 176 const CreditCard& card,
192 const base::Closure& callback) { 177 const base::Closure& callback) {
193 #if defined(OS_ANDROID) 178 #if defined(OS_ANDROID)
194 InfoBarService::FromWebContents(web_contents())->AddInfoBar( 179 InfoBarService::FromWebContents(web_contents())->AddInfoBar(
195 CreateSaveCardInfoBarMobile( 180 CreateSaveCardInfoBarMobile(
196 make_scoped_ptr(new AutofillSaveCardInfoBarDelegateMobile( 181 make_scoped_ptr(new AutofillSaveCardInfoBarDelegateMobile(
197 false, card, scoped_ptr<base::DictionaryValue>(nullptr), 182 false, card, scoped_ptr<base::DictionaryValue>(nullptr),
198 callback)))); 183 callback))));
199 #else 184 #else
200 if (IsSaveCardBubbleEnabled()) { 185 // Do lazy initialization of SaveCardBubbleControllerImpl.
201 // Do lazy initialization of SaveCardBubbleControllerImpl. 186 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(
202 autofill::SaveCardBubbleControllerImpl::CreateForWebContents( 187 web_contents());
203 web_contents()); 188 autofill::SaveCardBubbleControllerImpl* controller =
204 autofill::SaveCardBubbleControllerImpl* controller = 189 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents());
205 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); 190 controller->ShowBubbleForLocalSave(card, callback);
206 controller->ShowBubbleForLocalSave(card, callback);
207 return;
208 }
209
210 AutofillCCInfoBarDelegate::CreateForLocalSave(
Evan Stade 2016/03/07 22:42:03 do you still need this fn for something? Do you ne
Justin Donnelly 2016/03/07 23:14:41 Hmm, good point. we don't need CreateForLocalSave
211 InfoBarService::FromWebContents(web_contents()), callback);
212 #endif 191 #endif
213 } 192 }
214 193
215 void ChromeAutofillClient::ConfirmSaveCreditCardToCloud( 194 void ChromeAutofillClient::ConfirmSaveCreditCardToCloud(
216 const CreditCard& card, 195 const CreditCard& card,
217 scoped_ptr<base::DictionaryValue> legal_message, 196 scoped_ptr<base::DictionaryValue> legal_message,
218 const base::Closure& callback) { 197 const base::Closure& callback) {
219 #if defined(OS_ANDROID) 198 #if defined(OS_ANDROID)
220 InfoBarService::FromWebContents(web_contents())->AddInfoBar( 199 InfoBarService::FromWebContents(web_contents())->AddInfoBar(
221 CreateSaveCardInfoBarMobile( 200 CreateSaveCardInfoBarMobile(
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 362
384 ssl_status = navigation_entry->GetSSL(); 363 ssl_status = navigation_entry->GetSSL();
385 // Note: If changing the implementation below, also change 364 // Note: If changing the implementation below, also change
386 // AwAutofillClient::IsContextSecure. See crbug.com/505388 365 // AwAutofillClient::IsContextSecure. See crbug.com/505388
387 return ssl_status.security_style == content::SECURITY_STYLE_AUTHENTICATED && 366 return ssl_status.security_style == content::SECURITY_STYLE_AUTHENTICATED &&
388 !(ssl_status.content_status & 367 !(ssl_status.content_status &
389 content::SSLStatus::RAN_INSECURE_CONTENT); 368 content::SSLStatus::RAN_INSECURE_CONTENT);
390 } 369 }
391 370
392 } // namespace autofill 371 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/core/common/autofill_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698