| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 threat_type = safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL; | 211 threat_type = safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL; |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource; | 214 safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource; |
| 215 resource.url = request_url; | 215 resource.url = request_url; |
| 216 resource.is_subresource = request_url != main_frame_url; | 216 resource.is_subresource = request_url != main_frame_url; |
| 217 resource.is_subframe = false; | 217 resource.is_subframe = false; |
| 218 resource.threat_type = threat_type; | 218 resource.threat_type = threat_type; |
| 219 resource.render_process_host_id = | 219 resource.render_process_host_id = |
| 220 web_contents->GetRenderProcessHost()->GetID(); | 220 web_contents->GetRenderProcessHost()->GetID(); |
| 221 resource.render_frame_id = web_contents->GetFocusedFrame()->GetRoutingID(); | 221 resource.render_frame_id = web_contents->GetMainFrame()->GetRoutingID(); |
| 222 resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; | 222 resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; |
| 223 | 223 |
| 224 // Normally safebrowsing interstitial types which block the main page load | 224 // Normally safebrowsing interstitial types which block the main page load |
| 225 // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and | 225 // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and |
| 226 // SB_THREAT_TYPE_URL_UNWANTED on main-frame loads) would expect there to be a | 226 // SB_THREAT_TYPE_URL_UNWANTED on main-frame loads) would expect there to be a |
| 227 // pending navigation when the SafeBrowsingBlockingPage is created. This demo | 227 // pending navigation when the SafeBrowsingBlockingPage is created. This demo |
| 228 // creates a SafeBrowsingBlockingPage but does not actually show a real | 228 // creates a SafeBrowsingBlockingPage but does not actually show a real |
| 229 // interstitial. Instead it extracts the html and displays it manually, so the | 229 // interstitial. Instead it extracts the html and displays it manually, so the |
| 230 // parts which depend on the NavigationEntry are not hit. | 230 // parts which depend on the NavigationEntry are not hit. |
| 231 return safe_browsing::SafeBrowsingBlockingPage::CreateBlockingPage( | 231 return safe_browsing::SafeBrowsingBlockingPage::CreateBlockingPage( |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 html = interstitial_delegate.get()->GetHTMLContents(); | 339 html = interstitial_delegate.get()->GetHTMLContents(); |
| 340 } else { | 340 } else { |
| 341 html = ResourceBundle::GetSharedInstance() | 341 html = ResourceBundle::GetSharedInstance() |
| 342 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) | 342 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) |
| 343 .as_string(); | 343 .as_string(); |
| 344 } | 344 } |
| 345 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; | 345 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; |
| 346 html_bytes->data().assign(html.begin(), html.end()); | 346 html_bytes->data().assign(html.begin(), html.end()); |
| 347 callback.Run(html_bytes.get()); | 347 callback.Run(html_bytes.get()); |
| 348 } | 348 } |
| OLD | NEW |