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