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_safe_browsing_ui_manager.h" | 7 #include "android_webview/browser/aw_safe_browsing_ui_manager.h" |
8 #include "components/security_interstitials/content/security_interstitial_contro ller_client.h" | 8 #include "components/security_interstitials/content/security_interstitial_contro ller_client.h" |
9 #include "components/security_interstitials/content/unsafe_resource.h" | 9 #include "components/security_interstitials/content/unsafe_resource.h" |
10 #include "components/security_interstitials/core/base_safe_browsing_error_ui.h" | 10 #include "components/security_interstitials/core/base_safe_browsing_error_ui.h" |
11 #include "content/public/browser/interstitial_page.h" | 11 #include "content/public/browser/interstitial_page.h" |
12 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 | 14 |
15 using content::InterstitialPage; | 15 using content::InterstitialPage; |
16 using content::WebContents; | 16 using content::WebContents; |
17 using security_interstitials::BaseSafeBrowsingErrorUI; | 17 using security_interstitials::BaseSafeBrowsingErrorUI; |
18 using security_interstitials::SecurityInterstitialControllerClient; | 18 using security_interstitials::SecurityInterstitialControllerClient; |
19 | 19 |
20 namespace android_webview { | 20 namespace android_webview { |
21 | 21 |
22 AwSafeBrowsingBlockingPage::AwSafeBrowsingBlockingPage( | 22 AwSafeBrowsingBlockingPage::AwSafeBrowsingBlockingPage( |
23 AwSafeBrowsingUIManager* ui_manager, | 23 AwSafeBrowsingUIManager* ui_manager, |
24 WebContents* web_contents, | 24 WebContents* web_contents, |
25 const GURL& main_frame_url, | 25 const GURL& main_frame_url, |
26 const UnsafeResourceList& unsafe_resources, | 26 const UnsafeResourceList& unsafe_resources, |
27 std::unique_ptr<SecurityInterstitialControllerClient> controller_client, | 27 std::unique_ptr<SecurityInterstitialControllerClient> controller_client, |
28 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options) | 28 const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options, |
29 ErrorUiType errorType) | |
29 : BaseBlockingPage(ui_manager, | 30 : BaseBlockingPage(ui_manager, |
30 web_contents, | 31 web_contents, |
31 main_frame_url, | 32 main_frame_url, |
32 unsafe_resources, | 33 unsafe_resources, |
33 std::move(controller_client), | 34 std::move(controller_client), |
34 display_options) {} | 35 display_options, |
36 errorType) {} | |
35 | 37 |
36 // static | 38 // static |
37 void AwSafeBrowsingBlockingPage::ShowBlockingPage( | 39 void AwSafeBrowsingBlockingPage::ShowBlockingPage( |
38 AwSafeBrowsingUIManager* ui_manager, | 40 AwSafeBrowsingUIManager* ui_manager, |
39 const UnsafeResource& unsafe_resource) { | 41 const UnsafeResource& unsafe_resource) { |
40 DVLOG(1) << __func__ << " " << unsafe_resource.url.spec(); | 42 DVLOG(1) << __func__ << " " << unsafe_resource.url.spec(); |
41 WebContents* web_contents = unsafe_resource.web_contents_getter.Run(); | 43 WebContents* web_contents = unsafe_resource.web_contents_getter.Run(); |
42 | 44 |
43 if (InterstitialPage::GetInterstitialPage(web_contents) && | 45 if (InterstitialPage::GetInterstitialPage(web_contents) && |
44 unsafe_resource.is_subresource) { | 46 unsafe_resource.is_subresource) { |
(...skipping 10 matching lines...) Expand all Loading... | |
55 BaseSafeBrowsingErrorUI::SBErrorDisplayOptions display_options = | 57 BaseSafeBrowsingErrorUI::SBErrorDisplayOptions display_options = |
56 BaseSafeBrowsingErrorUI::SBErrorDisplayOptions( | 58 BaseSafeBrowsingErrorUI::SBErrorDisplayOptions( |
57 IsMainPageLoadBlocked(unsafe_resources), | 59 IsMainPageLoadBlocked(unsafe_resources), |
58 false, // kSafeBrowsingExtendedReportingOptInAllowed | 60 false, // kSafeBrowsingExtendedReportingOptInAllowed |
59 false, // is_off_the_record | 61 false, // is_off_the_record |
60 false, // is_extended_reporting | 62 false, // is_extended_reporting |
61 false, // is_scout | 63 false, // is_scout |
62 false, // kSafeBrowsingProceedAnywayDisabled | 64 false, // kSafeBrowsingProceedAnywayDisabled |
63 true, // is_resource_cancellable | 65 true, // is_resource_cancellable |
64 "cpn_safe_browsing_wv"); // help_center_article_link | 66 "cpn_safe_browsing_wv"); // help_center_article_link |
67 | |
68 ErrorUiType errorType; | |
sgurun-gerrit only
2017/05/22 21:05:29
Have Java return the type rather than adding a new
Nate Fischer
2017/05/22 23:13:46
Acknowledged. I'll work on this in the next patchs
| |
69 if (ui_manager->IsLoud(unsafe_resource)) { | |
70 errorType = ErrorUiType::LOUD; | |
71 } else if (ui_manager->IsGiant(unsafe_resource)) { | |
72 errorType = ErrorUiType::QUIET_GIANT; | |
73 } else { | |
74 errorType = ErrorUiType::QUIET_SMALL; | |
75 } | |
76 | |
65 AwSafeBrowsingBlockingPage* blocking_page = new AwSafeBrowsingBlockingPage( | 77 AwSafeBrowsingBlockingPage* blocking_page = new AwSafeBrowsingBlockingPage( |
66 ui_manager, web_contents, entry ? entry->GetURL() : GURL(), | 78 ui_manager, web_contents, entry ? entry->GetURL() : GURL(), |
67 unsafe_resources, | 79 unsafe_resources, |
68 CreateControllerClient(web_contents, unsafe_resources, ui_manager), | 80 CreateControllerClient(web_contents, unsafe_resources, ui_manager), |
69 display_options); | 81 display_options, errorType); |
70 blocking_page->Show(); | 82 blocking_page->Show(); |
71 } | 83 } |
72 } | 84 } |
73 | 85 |
74 } // namespace android_webview | 86 } // namespace android_webview |
OLD | NEW |