| 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_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 std::string strict_enforcement_param; | 67 std::string strict_enforcement_param; |
| 68 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 68 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 69 "strict_enforcement", | 69 "strict_enforcement", |
| 70 &strict_enforcement_param)) { | 70 &strict_enforcement_param)) { |
| 71 strict_enforcement = strict_enforcement_param == "1"; | 71 strict_enforcement = strict_enforcement_param == "1"; |
| 72 } | 72 } |
| 73 net::SSLInfo ssl_info; | 73 net::SSLInfo ssl_info; |
| 74 ssl_info.cert = new net::X509Certificate( | 74 ssl_info.cert = new net::X509Certificate( |
| 75 request_url.host(), "CA", base::Time::Max(), base::Time::Max()); | 75 request_url.host(), "CA", base::Time::Max(), base::Time::Max()); |
| 76 // This delegate doesn't create an interstitial. | 76 // This delegate doesn't create an interstitial. |
| 77 return new SSLBlockingPage(web_contents, cert_error, ssl_info, | 77 int options_mask = 0; |
| 78 request_url, overridable, | 78 if (overridable) |
| 79 strict_enforcement, | 79 options_mask = SSLBlockingPage::OVERRIDABLE; |
| 80 if (strict_enforcement) |
| 81 options_mask = SSLBlockingPage::STRICT_ENFORCEMENT; |
| 82 return new SSLBlockingPage(web_contents, |
| 83 cert_error, |
| 84 ssl_info, |
| 85 request_url, |
| 86 options_mask, |
| 80 base::Callback<void(bool)>()); | 87 base::Callback<void(bool)>()); |
| 81 } | 88 } |
| 82 | 89 |
| 83 SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage( | 90 SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage( |
| 84 content::WebContents* web_contents) { | 91 content::WebContents* web_contents) { |
| 85 SBThreatType threat_type = SB_THREAT_TYPE_URL_MALWARE; | 92 SBThreatType threat_type = SB_THREAT_TYPE_URL_MALWARE; |
| 86 GURL request_url("http://example.com"); | 93 GURL request_url("http://example.com"); |
| 87 std::string url_param; | 94 std::string url_param; |
| 88 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 95 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 89 "url", | 96 "url", |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 "<a href='safebrowsing?type=clientside_malware'>" | 199 "<a href='safebrowsing?type=clientside_malware'>" |
| 193 " Client Side Malware</a><br>" | 200 " Client Side Malware</a><br>" |
| 194 "<a href='safebrowsing?type=clientside_phishing'>" | 201 "<a href='safebrowsing?type=clientside_phishing'>" |
| 195 " Client Side Phishing</a><br>" | 202 " Client Side Phishing</a><br>" |
| 196 "</body></html>"; | 203 "</body></html>"; |
| 197 } | 204 } |
| 198 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; | 205 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; |
| 199 html_bytes->data().assign(html.begin(), html.end()); | 206 html_bytes->data().assign(html.begin(), html.end()); |
| 200 callback.Run(html_bytes.get()); | 207 callback.Run(html_bytes.get()); |
| 201 } | 208 } |
| OLD | NEW |