OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "ui/gfx/geometry/rect.h" | 46 #include "ui/gfx/geometry/rect.h" |
47 | 47 |
48 #if BUILDFLAG(ANDROID_JAVA_UI) | 48 #if BUILDFLAG(ANDROID_JAVA_UI) |
49 #include "chrome/browser/android/chrome_application.h" | 49 #include "chrome/browser/android/chrome_application.h" |
50 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 50 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
51 #else | 51 #else |
52 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 52 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
53 #include "components/ui/zoom/zoom_controller.h" | 53 #include "components/ui/zoom/zoom_controller.h" |
54 #endif | 54 #endif |
55 | 55 |
| 56 #if BUILDFLAG(ANDROID_JAVA_UI) || defined(OS_IOS) |
| 57 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" |
| 58 #endif |
| 59 |
56 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 60 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
57 | 61 |
58 namespace autofill { | 62 namespace autofill { |
59 | 63 |
60 namespace { | 64 namespace { |
61 | 65 |
62 #if !defined(OS_ANDROID) | 66 #if !defined(OS_ANDROID) |
63 bool IsSaveCardBubbleEnabled() { | 67 bool IsSaveCardBubbleEnabled() { |
64 #if defined(OS_MACOSX) | 68 #if defined(OS_MACOSX) |
65 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 69 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 CreateCardUnmaskPromptView(&unmask_controller_, web_contents()), | 171 CreateCardUnmaskPromptView(&unmask_controller_, web_contents()), |
168 card, delegate); | 172 card, delegate); |
169 } | 173 } |
170 | 174 |
171 void ChromeAutofillClient::OnUnmaskVerificationResult( | 175 void ChromeAutofillClient::OnUnmaskVerificationResult( |
172 PaymentsRpcResult result) { | 176 PaymentsRpcResult result) { |
173 unmask_controller_.OnVerificationResult(result); | 177 unmask_controller_.OnVerificationResult(result); |
174 } | 178 } |
175 | 179 |
176 void ChromeAutofillClient::ConfirmSaveCreditCardLocally( | 180 void ChromeAutofillClient::ConfirmSaveCreditCardLocally( |
| 181 const CreditCard& card, |
177 const base::Closure& callback) { | 182 const base::Closure& callback) { |
178 #if !defined(OS_ANDROID) | 183 #if BUILDFLAG(ANDROID_JAVA_UI) || defined(OS_IOS) |
| 184 AutofillSaveCardInfoBarDelegateMobile::CreateForLocalSave( |
| 185 InfoBarService::FromWebContents(web_contents()), card, callback); |
| 186 #else |
179 if (IsSaveCardBubbleEnabled()) { | 187 if (IsSaveCardBubbleEnabled()) { |
180 // Do lazy initialization of SaveCardBubbleControllerImpl. | 188 // Do lazy initialization of SaveCardBubbleControllerImpl. |
181 autofill::SaveCardBubbleControllerImpl::CreateForWebContents( | 189 autofill::SaveCardBubbleControllerImpl::CreateForWebContents( |
182 web_contents()); | 190 web_contents()); |
183 autofill::SaveCardBubbleControllerImpl* controller = | 191 autofill::SaveCardBubbleControllerImpl* controller = |
184 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); | 192 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); |
185 controller->ShowBubbleForLocalSave(callback); | 193 controller->ShowBubbleForLocalSave(callback); |
186 return; | 194 return; |
187 } | 195 } |
188 #endif | 196 |
189 AutofillCCInfoBarDelegate::CreateForLocalSave( | 197 AutofillCCInfoBarDelegate::CreateForLocalSave( |
190 InfoBarService::FromWebContents(web_contents()), callback); | 198 InfoBarService::FromWebContents(web_contents()), callback); |
| 199 #endif // BUILDFLAG(ANDROID_JAVA_UI) || defined(OS_IOS) |
191 } | 200 } |
192 | 201 |
193 void ChromeAutofillClient::ConfirmSaveCreditCardToCloud( | 202 void ChromeAutofillClient::ConfirmSaveCreditCardToCloud( |
194 const base::Closure& callback, | 203 const CreditCard& card, |
195 scoped_ptr<base::DictionaryValue> legal_message) { | 204 scoped_ptr<base::DictionaryValue> legal_message, |
196 // TODO(jdonnelly): Implement save card prompt for OS_IOS. | 205 const base::Closure& callback) { |
197 #if defined(OS_ANDROID) | 206 #if BUILDFLAG(ANDROID_JAVA_UI) || defined(OS_IOS) |
198 AutofillCCInfoBarDelegate::CreateForUpload( | 207 AutofillSaveCardInfoBarDelegateMobile::CreateForUpload( |
199 InfoBarService::FromWebContents(web_contents()), callback); | 208 InfoBarService::FromWebContents(web_contents()), card, |
| 209 std::move(legal_message), callback); |
200 #else | 210 #else |
201 // Do lazy initialization of SaveCardBubbleControllerImpl. | 211 // Do lazy initialization of SaveCardBubbleControllerImpl. |
202 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents()); | 212 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents()); |
203 autofill::SaveCardBubbleControllerImpl* controller = | 213 autofill::SaveCardBubbleControllerImpl* controller = |
204 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); | 214 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); |
205 controller->ShowBubbleForUpload(callback, std::move(legal_message)); | 215 controller->ShowBubbleForUpload(callback, std::move(legal_message)); |
206 #endif | 216 #endif // BUILDFLAG(ANDROID_JAVA_UI) || defined(OS_IOS) |
207 } | 217 } |
208 | 218 |
209 void ChromeAutofillClient::LoadRiskData( | 219 void ChromeAutofillClient::LoadRiskData( |
210 const base::Callback<void(const std::string&)>& callback) { | 220 const base::Callback<void(const std::string&)>& callback) { |
211 ::autofill::LoadRiskData(0, web_contents(), callback); | 221 ::autofill::LoadRiskData(0, web_contents(), callback); |
212 } | 222 } |
213 | 223 |
214 bool ChromeAutofillClient::HasCreditCardScanFeature() { | 224 bool ChromeAutofillClient::HasCreditCardScanFeature() { |
215 return CreditCardScannerController::HasCreditCardScanFeature(); | 225 return CreditCardScannerController::HasCreditCardScanFeature(); |
216 } | 226 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 369 |
360 ssl_status = navigation_entry->GetSSL(); | 370 ssl_status = navigation_entry->GetSSL(); |
361 // Note: If changing the implementation below, also change | 371 // Note: If changing the implementation below, also change |
362 // AwAutofillClient::IsContextSecure. See crbug.com/505388 | 372 // AwAutofillClient::IsContextSecure. See crbug.com/505388 |
363 return ssl_status.security_style == | 373 return ssl_status.security_style == |
364 content::SECURITY_STYLE_AUTHENTICATED && | 374 content::SECURITY_STYLE_AUTHENTICATED && |
365 ssl_status.content_status == content::SSLStatus::NORMAL_CONTENT; | 375 ssl_status.content_status == content::SSLStatus::NORMAL_CONTENT; |
366 } | 376 } |
367 | 377 |
368 } // namespace autofill | 378 } // namespace autofill |
OLD | NEW |