| 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/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.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 "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } else if (type_param == "clientside_phishing") { | 236 } else if (type_param == "clientside_phishing") { |
| 237 threat_type = safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL; | 237 threat_type = safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL; |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource; | 240 safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource; |
| 241 resource.url = request_url; | 241 resource.url = request_url; |
| 242 resource.is_subresource = request_url != main_frame_url; | 242 resource.is_subresource = request_url != main_frame_url; |
| 243 resource.is_subframe = false; | 243 resource.is_subframe = false; |
| 244 resource.threat_type = threat_type; | 244 resource.threat_type = threat_type; |
| 245 resource.web_contents_getter = | 245 resource.web_contents_getter = |
| 246 safe_browsing::SafeBrowsingUIManager::UnsafeResource:: | 246 security_interstitials::UnsafeResource:: |
| 247 GetWebContentsGetter(web_contents->GetRenderProcessHost()->GetID(), | 247 GetWebContentsGetter(web_contents->GetRenderProcessHost()->GetID(), |
| 248 web_contents->GetMainFrame()->GetRoutingID()); | 248 web_contents->GetMainFrame()->GetRoutingID()); |
| 249 resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; | 249 resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; |
| 250 | 250 |
| 251 // Normally safebrowsing interstitial types which block the main page load | 251 // Normally safebrowsing interstitial types which block the main page load |
| 252 // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and | 252 // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and |
| 253 // SB_THREAT_TYPE_URL_UNWANTED on main-frame loads) would expect there to be a | 253 // SB_THREAT_TYPE_URL_UNWANTED on main-frame loads) would expect there to be a |
| 254 // pending navigation when the SafeBrowsingBlockingPage is created. This demo | 254 // pending navigation when the SafeBrowsingBlockingPage is created. This demo |
| 255 // creates a SafeBrowsingBlockingPage but does not actually show a real | 255 // creates a SafeBrowsingBlockingPage but does not actually show a real |
| 256 // interstitial. Instead it extracts the html and displays it manually, so the | 256 // interstitial. Instead it extracts the html and displays it manually, so the |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 html = interstitial_delegate.get()->GetHTMLContents(); | 364 html = interstitial_delegate.get()->GetHTMLContents(); |
| 365 } else { | 365 } else { |
| 366 html = ResourceBundle::GetSharedInstance() | 366 html = ResourceBundle::GetSharedInstance() |
| 367 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) | 367 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) |
| 368 .as_string(); | 368 .as_string(); |
| 369 } | 369 } |
| 370 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; | 370 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; |
| 371 html_bytes->data().assign(html.begin(), html.end()); | 371 html_bytes->data().assign(html.begin(), html.end()); |
| 372 callback.Run(html_bytes.get()); | 372 callback.Run(html_bytes.get()); |
| 373 } | 373 } |
| OLD | NEW |