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/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 int render_frame_id, | 249 int render_frame_id, |
250 const content::URLDataSource::GotDataCallback& callback) { | 250 const content::URLDataSource::GotDataCallback& callback) { |
251 scoped_ptr<content::InterstitialPageDelegate> interstitial_delegate; | 251 scoped_ptr<content::InterstitialPageDelegate> interstitial_delegate; |
252 if (base::StartsWith(path, "ssl", base::CompareCase::SENSITIVE)) { | 252 if (base::StartsWith(path, "ssl", base::CompareCase::SENSITIVE)) { |
253 interstitial_delegate.reset(CreateSSLBlockingPage(web_contents_)); | 253 interstitial_delegate.reset(CreateSSLBlockingPage(web_contents_)); |
254 } else if (base::StartsWith(path, "safebrowsing", | 254 } else if (base::StartsWith(path, "safebrowsing", |
255 base::CompareCase::SENSITIVE)) { | 255 base::CompareCase::SENSITIVE)) { |
256 interstitial_delegate.reset(CreateSafeBrowsingBlockingPage(web_contents_)); | 256 interstitial_delegate.reset(CreateSafeBrowsingBlockingPage(web_contents_)); |
257 } | 257 } |
258 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 258 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
259 else if (base::StartsWithASCII(path, "captiveportal", true)) | 259 else if (base::StartsWith(path, "captiveportal", |
| 260 base::CompareCase::SENSITIVE)) |
260 { | 261 { |
261 interstitial_delegate.reset(CreateCaptivePortalBlockingPage(web_contents_)); | 262 interstitial_delegate.reset(CreateCaptivePortalBlockingPage(web_contents_)); |
262 } | 263 } |
263 #endif | 264 #endif |
264 std::string html; | 265 std::string html; |
265 if (interstitial_delegate.get()) { | 266 if (interstitial_delegate.get()) { |
266 html = interstitial_delegate.get()->GetHTMLContents(); | 267 html = interstitial_delegate.get()->GetHTMLContents(); |
267 } else { | 268 } else { |
268 html = ResourceBundle::GetSharedInstance() | 269 html = ResourceBundle::GetSharedInstance() |
269 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) | 270 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) |
270 .as_string(); | 271 .as_string(); |
271 } | 272 } |
272 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; | 273 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; |
273 html_bytes->data().assign(html.begin(), html.end()); | 274 html_bytes->data().assign(html.begin(), html.end()); |
274 callback.Run(html_bytes.get()); | 275 callback.Run(html_bytes.get()); |
275 } | 276 } |
OLD | NEW |