| 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 "components/dom_distiller/content/browser/dom_distiller_viewer_source.h
" | 5 #include "components/dom_distiller/content/browser/dom_distiller_viewer_source.h
" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 std::string DomDistillerViewerSource::GetSource() const { | 225 std::string DomDistillerViewerSource::GetSource() const { |
| 226 return scheme_ + "://"; | 226 return scheme_ + "://"; |
| 227 } | 227 } |
| 228 | 228 |
| 229 void DomDistillerViewerSource::StartDataRequest( | 229 void DomDistillerViewerSource::StartDataRequest( |
| 230 const std::string& path, | 230 const std::string& path, |
| 231 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, | 231 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
| 232 const content::URLDataSource::GotDataCallback& callback) { | 232 const content::URLDataSource::GotDataCallback& callback) { |
| 233 content::WebContents* web_contents = wc_getter.Run(); | 233 content::WebContents* web_contents = wc_getter.Run(); |
| 234 if (!web_contents) |
| 235 return; |
| 234 if (kViewerCssPath == path) { | 236 if (kViewerCssPath == path) { |
| 235 std::string css = viewer::GetCss(); | 237 std::string css = viewer::GetCss(); |
| 236 callback.Run(base::RefCountedString::TakeString(&css)); | 238 callback.Run(base::RefCountedString::TakeString(&css)); |
| 237 return; | 239 return; |
| 238 } else if (kViewerLoadingImagePath == path) { | 240 } else if (kViewerLoadingImagePath == path) { |
| 239 std::string image = viewer::GetLoadingImage(); | 241 std::string image = viewer::GetLoadingImage(); |
| 240 callback.Run(base::RefCountedString::TakeString(&image)); | 242 callback.Run(base::RefCountedString::TakeString(&image)); |
| 241 return; | 243 return; |
| 242 } else if (base::StartsWith(path, kViewerSaveFontScalingPath, | 244 } else if (base::StartsWith(path, kViewerSaveFontScalingPath, |
| 243 base::CompareCase::SENSITIVE)) { | 245 base::CompareCase::SENSITIVE)) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 std::string DomDistillerViewerSource::GetContentSecurityPolicyStyleSrc() | 306 std::string DomDistillerViewerSource::GetContentSecurityPolicyStyleSrc() |
| 305 const { | 307 const { |
| 306 return "style-src 'self' https://fonts.googleapis.com;"; | 308 return "style-src 'self' https://fonts.googleapis.com;"; |
| 307 } | 309 } |
| 308 | 310 |
| 309 std::string DomDistillerViewerSource::GetContentSecurityPolicyChildSrc() const { | 311 std::string DomDistillerViewerSource::GetContentSecurityPolicyChildSrc() const { |
| 310 return "child-src *;"; | 312 return "child-src *;"; |
| 311 } | 313 } |
| 312 | 314 |
| 313 } // namespace dom_distiller | 315 } // namespace dom_distiller |
| OLD | NEW |