| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 namespace autofill { | 51 namespace autofill { |
| 52 | 52 |
| 53 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) | 53 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) |
| 54 : content::WebContentsObserver(web_contents), | 54 : content::WebContentsObserver(web_contents), |
| 55 unmask_controller_( | 55 unmask_controller_( |
| 56 base::Bind(&LoadRiskData, 0, web_contents), | 56 base::Bind(&LoadRiskData, 0, web_contents), |
| 57 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), | 57 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), |
| 58 Profile::FromBrowserContext(web_contents->GetBrowserContext()) | 58 Profile::FromBrowserContext(web_contents->GetBrowserContext()) |
| 59 ->IsOffTheRecord()), | 59 ->IsOffTheRecord()), |
| 60 save_card_bubble_controller_(web_contents), |
| 60 last_rfh_to_rac_(nullptr) { | 61 last_rfh_to_rac_(nullptr) { |
| 61 DCHECK(web_contents); | 62 DCHECK(web_contents); |
| 62 | 63 |
| 63 #if !defined(OS_ANDROID) | 64 #if !defined(OS_ANDROID) |
| 64 // Since ZoomController is also a WebContentsObserver, we need to be careful | 65 // Since ZoomController is also a WebContentsObserver, we need to be careful |
| 65 // about disconnecting from it since the relative order of destruction of | 66 // about disconnecting from it since the relative order of destruction of |
| 66 // WebContentsObservers is not guaranteed. ZoomController silently clears | 67 // WebContentsObservers is not guaranteed. ZoomController silently clears |
| 67 // its ZoomObserver list during WebContentsDestroyed() so there's no need | 68 // its ZoomObserver list during WebContentsDestroyed() so there's no need |
| 68 // to explicitly remove ourselves on destruction. | 69 // to explicitly remove ourselves on destruction. |
| 69 ui_zoom::ZoomController* zoom_controller = | 70 ui_zoom::ZoomController* zoom_controller = |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 CreateCardUnmaskPromptView(&unmask_controller_, web_contents()), | 147 CreateCardUnmaskPromptView(&unmask_controller_, web_contents()), |
| 147 card, delegate); | 148 card, delegate); |
| 148 } | 149 } |
| 149 | 150 |
| 150 void ChromeAutofillClient::OnUnmaskVerificationResult(GetRealPanResult result) { | 151 void ChromeAutofillClient::OnUnmaskVerificationResult(GetRealPanResult result) { |
| 151 unmask_controller_.OnVerificationResult(result); | 152 unmask_controller_.OnVerificationResult(result); |
| 152 } | 153 } |
| 153 | 154 |
| 154 void ChromeAutofillClient::ConfirmSaveCreditCard( | 155 void ChromeAutofillClient::ConfirmSaveCreditCard( |
| 155 const base::Closure& save_card_callback) { | 156 const base::Closure& save_card_callback) { |
| 157 // TODO(bondd): Implement save card bubble for OS_MACOSX. |
| 158 #if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_WIN) |
| 159 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| 160 if (browser) |
| 161 save_card_bubble_controller_.ShowBubble(save_card_callback); |
| 162 #else |
| 156 AutofillCCInfoBarDelegate::Create( | 163 AutofillCCInfoBarDelegate::Create( |
| 157 InfoBarService::FromWebContents(web_contents()), this, | 164 InfoBarService::FromWebContents(web_contents()), this, |
| 158 save_card_callback); | 165 save_card_callback); |
| 166 #endif |
| 167 } |
| 168 |
| 169 void ChromeAutofillClient::ShowSaveCreditCardBubble() { |
| 170 save_card_bubble_controller_.ReshowBubble(); |
| 171 } |
| 172 |
| 173 bool ChromeAutofillClient::WantSaveCreditCardIconVisible() { |
| 174 return save_card_bubble_controller_.WantIconVisible(); |
| 175 } |
| 176 |
| 177 bool ChromeAutofillClient::WantSaveCreditCardIconToggled() { |
| 178 return save_card_bubble_controller_.WantIconToggled(); |
| 159 } | 179 } |
| 160 | 180 |
| 161 bool ChromeAutofillClient::HasCreditCardScanFeature() { | 181 bool ChromeAutofillClient::HasCreditCardScanFeature() { |
| 162 return CreditCardScannerController::HasCreditCardScanFeature(); | 182 return CreditCardScannerController::HasCreditCardScanFeature(); |
| 163 } | 183 } |
| 164 | 184 |
| 165 void ChromeAutofillClient::ScanCreditCard( | 185 void ChromeAutofillClient::ScanCreditCard( |
| 166 const CreditCardScanCallback& callback) { | 186 const CreditCardScanCallback& callback) { |
| 167 CreditCardScannerController::ScanCreditCard(web_contents(), callback); | 187 CreditCardScannerController::ScanCreditCard(web_contents(), callback); |
| 168 } | 188 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 325 |
| 306 ssl_status = navigation_entry->GetSSL(); | 326 ssl_status = navigation_entry->GetSSL(); |
| 307 // Note: If changing the implementation below, also change | 327 // Note: If changing the implementation below, also change |
| 308 // AwAutofillClient::IsContextSecure. See crbug.com/505388 | 328 // AwAutofillClient::IsContextSecure. See crbug.com/505388 |
| 309 return ssl_status.security_style == | 329 return ssl_status.security_style == |
| 310 content::SECURITY_STYLE_AUTHENTICATED && | 330 content::SECURITY_STYLE_AUTHENTICATED && |
| 311 ssl_status.content_status == content::SSLStatus::NORMAL_CONTENT; | 331 ssl_status.content_status == content::SSLStatus::NORMAL_CONTENT; |
| 312 } | 332 } |
| 313 | 333 |
| 314 } // namespace autofill | 334 } // namespace autofill |
| OLD | NEW |