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/webui/interstitials/interstitial_ui.h" | 5 #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/net/certificate_error_reporter.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 12 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
12 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 13 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
13 #include "chrome/browser/ssl/ssl_blocking_page.h" | 14 #include "chrome/browser/ssl/ssl_blocking_page.h" |
14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
15 #include "chrome/grit/browser_resources.h" | 16 #include "chrome/grit/browser_resources.h" |
16 #include "content/public/browser/interstitial_page_delegate.h" | 17 #include "content/public/browser/interstitial_page_delegate.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
19 #include "content/public/browser/web_ui_controller.h" | 20 #include "content/public/browser/web_ui_controller.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 88 } |
88 net::SSLInfo ssl_info; | 89 net::SSLInfo ssl_info; |
89 ssl_info.cert = new net::X509Certificate( | 90 ssl_info.cert = new net::X509Certificate( |
90 request_url.host(), "CA", base::Time::Max(), base::Time::Max()); | 91 request_url.host(), "CA", base::Time::Max(), base::Time::Max()); |
91 // This delegate doesn't create an interstitial. | 92 // This delegate doesn't create an interstitial. |
92 int options_mask = 0; | 93 int options_mask = 0; |
93 if (overridable) | 94 if (overridable) |
94 options_mask |= SSLBlockingPage::OVERRIDABLE; | 95 options_mask |= SSLBlockingPage::OVERRIDABLE; |
95 if (strict_enforcement) | 96 if (strict_enforcement) |
96 options_mask |= SSLBlockingPage::STRICT_ENFORCEMENT; | 97 options_mask |= SSLBlockingPage::STRICT_ENFORCEMENT; |
97 return new SSLBlockingPage(web_contents, | 98 return new SSLBlockingPage(web_contents, cert_error, ssl_info, request_url, |
98 cert_error, | 99 options_mask, time_triggered_, nullptr, |
99 ssl_info, | 100 base::Callback<void(bool)>()); |
100 request_url, | |
101 options_mask, | |
102 time_triggered_, | |
103 base::Callback<void(bool)>()); | |
104 } | 101 } |
105 | 102 |
106 SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage( | 103 SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage( |
107 content::WebContents* web_contents) { | 104 content::WebContents* web_contents) { |
108 SBThreatType threat_type = SB_THREAT_TYPE_URL_MALWARE; | 105 SBThreatType threat_type = SB_THREAT_TYPE_URL_MALWARE; |
109 GURL request_url("http://example.com"); | 106 GURL request_url("http://example.com"); |
110 std::string url_param; | 107 std::string url_param; |
111 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 108 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
112 "url", | 109 "url", |
113 &url_param)) { | 110 &url_param)) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 html = interstitial_delegate.get()->GetHTMLContents(); | 199 html = interstitial_delegate.get()->GetHTMLContents(); |
203 } else { | 200 } else { |
204 html = ResourceBundle::GetSharedInstance() | 201 html = ResourceBundle::GetSharedInstance() |
205 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) | 202 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) |
206 .as_string(); | 203 .as_string(); |
207 } | 204 } |
208 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; | 205 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; |
209 html_bytes->data().assign(html.begin(), html.end()); | 206 html_bytes->data().assign(html.begin(), html.end()); |
210 callback.Run(html_bytes.get()); | 207 callback.Run(html_bytes.get()); |
211 } | 208 } |
OLD | NEW |