| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "chrome/browser/infobars/infobar_service.h" | 54 #include "chrome/browser/infobars/infobar_service.h" |
| 55 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 55 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
| 56 #include "chrome/browser/ui/android/infobars/autofill_credit_card_filling_infoba
r.h" | 56 #include "chrome/browser/ui/android/infobars/autofill_credit_card_filling_infoba
r.h" |
| 57 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_
delegate_mobile.h" | 57 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_
delegate_mobile.h" |
| 58 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" | 58 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" |
| 59 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" | 59 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" |
| 60 #include "components/infobars/core/infobar.h" | 60 #include "components/infobars/core/infobar.h" |
| 61 #include "content/public/browser/android/content_view_core.h" | 61 #include "content/public/browser/android/content_view_core.h" |
| 62 #else // !OS_ANDROID | 62 #else // !OS_ANDROID |
| 63 #include "chrome/browser/ui/browser.h" | 63 #include "chrome/browser/ui/browser.h" |
| 64 #include "chrome/browser/ui/browser_commands.h" |
| 64 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 65 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 65 #include "components/zoom/zoom_controller.h" | 66 #include "components/zoom/zoom_controller.h" |
| 66 #endif | 67 #endif |
| 67 | 68 |
| 68 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 69 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
| 69 | 70 |
| 70 namespace autofill { | 71 namespace autofill { |
| 71 | 72 |
| 72 namespace { | |
| 73 | |
| 74 const char kSecurityIndicatorHelpCenterUrl[] = | |
| 75 "https://support.google.com/chrome/answer/95617"; | |
| 76 | |
| 77 } // anonymous namespace | |
| 78 | |
| 79 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) | 73 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) |
| 80 : content::WebContentsObserver(web_contents), | 74 : content::WebContentsObserver(web_contents), |
| 81 unmask_controller_( | 75 unmask_controller_( |
| 82 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), | 76 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), |
| 83 Profile::FromBrowserContext(web_contents->GetBrowserContext()) | 77 Profile::FromBrowserContext(web_contents->GetBrowserContext()) |
| 84 ->IsOffTheRecord()) { | 78 ->IsOffTheRecord()) { |
| 85 DCHECK(web_contents); | 79 DCHECK(web_contents); |
| 86 | 80 |
| 87 #if !defined(OS_ANDROID) | 81 #if !defined(OS_ANDROID) |
| 88 // Since ZoomController is also a WebContentsObserver, we need to be careful | 82 // Since ZoomController is also a WebContentsObserver, we need to be careful |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 371 |
| 378 void ChromeAutofillClient::StartSigninFlow() { | 372 void ChromeAutofillClient::StartSigninFlow() { |
| 379 #if defined(OS_ANDROID) | 373 #if defined(OS_ANDROID) |
| 380 chrome::android::SigninPromoUtilAndroid::StartAccountSigninActivityForPromo( | 374 chrome::android::SigninPromoUtilAndroid::StartAccountSigninActivityForPromo( |
| 381 content::ContentViewCore::FromWebContents(web_contents()), | 375 content::ContentViewCore::FromWebContents(web_contents()), |
| 382 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); | 376 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); |
| 383 #endif | 377 #endif |
| 384 } | 378 } |
| 385 | 379 |
| 386 void ChromeAutofillClient::ShowHttpNotSecureExplanation() { | 380 void ChromeAutofillClient::ShowHttpNotSecureExplanation() { |
| 381 #if !defined(OS_ANDROID) |
| 382 // On desktop platforms, open Page Info, which briefly explains the HTTP |
| 383 // warning message and provides a link to the Help Center for more details. |
| 384 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| 385 if (browser && chrome::ShowWebsiteSettings(browser, web_contents())) |
| 386 return; |
| 387 // Otherwise fall through to the section below that opens the URL directly. |
| 388 #endif |
| 389 |
| 390 // On Android, where Page Info does not (yet) contain a link to the Help |
| 391 // Center (https://crbug.com/679532), or in corner cases where Page Info is |
| 392 // not shown (for example, no navigation entry), just launch the Help topic |
| 393 // directly. |
| 394 const GURL kSecurityIndicatorHelpCenterUrl( |
| 395 "https://support.google.com/chrome/?p=ui_security_indicator"); |
| 387 web_contents()->OpenURL(content::OpenURLParams( | 396 web_contents()->OpenURL(content::OpenURLParams( |
| 388 GURL(kSecurityIndicatorHelpCenterUrl), content::Referrer(), | 397 GURL(kSecurityIndicatorHelpCenterUrl), content::Referrer(), |
| 389 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, | 398 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
| 390 false /* is_renderer_initiated */)); | 399 false /* is_renderer_initiated */)); |
| 391 } | 400 } |
| 392 | 401 |
| 393 } // namespace autofill | 402 } // namespace autofill |
| OLD | NEW |