| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "android_webview/browser/aw_safe_browsing_blocking_page.h" | 5 #include "android_webview/browser/aw_safe_browsing_blocking_page.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_browser_context.h" |
| 7 #include "android_webview/browser/aw_safe_browsing_ui_manager.h" | 8 #include "android_webview/browser/aw_safe_browsing_ui_manager.h" |
| 9 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
| 8 #include "components/security_interstitials/content/security_interstitial_contro
ller_client.h" | 10 #include "components/security_interstitials/content/security_interstitial_contro
ller_client.h" |
| 9 #include "components/security_interstitials/content/unsafe_resource.h" | 11 #include "components/security_interstitials/content/unsafe_resource.h" |
| 10 #include "components/security_interstitials/core/base_safe_browsing_error_ui.h" | 12 #include "components/security_interstitials/core/base_safe_browsing_error_ui.h" |
| 11 #include "components/security_interstitials/core/safe_browsing_quiet_error_ui.h" | 13 #include "components/security_interstitials/core/safe_browsing_quiet_error_ui.h" |
| 12 #include "content/public/browser/interstitial_page.h" | 14 #include "content/public/browser/interstitial_page.h" |
| 13 #include "content/public/browser/navigation_entry.h" | 15 #include "content/public/browser/navigation_entry.h" |
| 14 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 15 | 17 |
| 16 using content::InterstitialPage; | 18 using content::InterstitialPage; |
| 17 using content::WebContents; | 19 using content::WebContents; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 36 std::move(controller_client), | 38 std::move(controller_client), |
| 37 display_options) { | 39 display_options) { |
| 38 if (errorUiType == ErrorUiType::QUIET_SMALL || | 40 if (errorUiType == ErrorUiType::QUIET_SMALL || |
| 39 errorUiType == ErrorUiType::QUIET_GIANT) { | 41 errorUiType == ErrorUiType::QUIET_GIANT) { |
| 40 set_sb_error_ui(base::MakeUnique<SafeBrowsingQuietErrorUI>( | 42 set_sb_error_ui(base::MakeUnique<SafeBrowsingQuietErrorUI>( |
| 41 unsafe_resources[0].url, main_frame_url, | 43 unsafe_resources[0].url, main_frame_url, |
| 42 GetInterstitialReason(unsafe_resources), display_options, | 44 GetInterstitialReason(unsafe_resources), display_options, |
| 43 ui_manager->app_locale(), base::Time::NowFromSystemTime(), controller(), | 45 ui_manager->app_locale(), base::Time::NowFromSystemTime(), controller(), |
| 44 errorUiType == ErrorUiType::QUIET_GIANT)); | 46 errorUiType == ErrorUiType::QUIET_GIANT)); |
| 45 } | 47 } |
| 48 |
| 49 // TODO(timvolodine): invoke TriggerManager::StartCollectingThreatDetails(), |
| 50 // (via AwBrowserContext, e.g. |
| 51 // AwBrowserContext::FromWebContents(web_contents)), crbug.com/731747. |
| 46 } | 52 } |
| 47 | 53 |
| 48 // static | 54 // static |
| 49 void AwSafeBrowsingBlockingPage::ShowBlockingPage( | 55 void AwSafeBrowsingBlockingPage::ShowBlockingPage( |
| 50 AwSafeBrowsingUIManager* ui_manager, | 56 AwSafeBrowsingUIManager* ui_manager, |
| 51 const UnsafeResource& unsafe_resource) { | 57 const UnsafeResource& unsafe_resource) { |
| 52 DVLOG(1) << __func__ << " " << unsafe_resource.url.spec(); | 58 DVLOG(1) << __func__ << " " << unsafe_resource.url.spec(); |
| 53 WebContents* web_contents = unsafe_resource.web_contents_getter.Run(); | 59 WebContents* web_contents = unsafe_resource.web_contents_getter.Run(); |
| 54 | 60 |
| 55 if (InterstitialPage::GetInterstitialPage(web_contents) && | 61 if (InterstitialPage::GetInterstitialPage(web_contents) && |
| (...skipping 24 matching lines...) Expand all Loading... |
| 80 AwSafeBrowsingBlockingPage* blocking_page = new AwSafeBrowsingBlockingPage( | 86 AwSafeBrowsingBlockingPage* blocking_page = new AwSafeBrowsingBlockingPage( |
| 81 ui_manager, web_contents, entry ? entry->GetURL() : GURL(), | 87 ui_manager, web_contents, entry ? entry->GetURL() : GURL(), |
| 82 unsafe_resources, | 88 unsafe_resources, |
| 83 CreateControllerClient(web_contents, unsafe_resources, ui_manager), | 89 CreateControllerClient(web_contents, unsafe_resources, ui_manager), |
| 84 display_options, errorType); | 90 display_options, errorType); |
| 85 blocking_page->Show(); | 91 blocking_page->Show(); |
| 86 } | 92 } |
| 87 } | 93 } |
| 88 | 94 |
| 89 } // namespace android_webview | 95 } // namespace android_webview |
| OLD | NEW |