OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/public/common/url_constants.h" |
| 12 #include "net/url_request/url_request.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 namespace dom_distiller { |
| 16 |
| 17 DomDistillerViewerSource::DomDistillerViewerSource() {} |
| 18 |
| 19 DomDistillerViewerSource::~DomDistillerViewerSource() {} |
| 20 |
| 21 std::string DomDistillerViewerSource::GetSource() const { |
| 22 return chrome::kDomDistillerScheme; |
| 23 } |
| 24 |
| 25 void DomDistillerViewerSource::StartDataRequest( |
| 26 const std::string& path, |
| 27 int render_process_id, |
| 28 int render_view_id, |
| 29 const content::URLDataSource::GotDataCallback& callback) { |
| 30 std::string page_template = "Aloha!"; |
| 31 callback.Run(base::RefCountedString::TakeString(&page_template)); |
| 32 }; |
| 33 |
| 34 std::string DomDistillerViewerSource::GetMimeType( |
| 35 const std::string& path) const { |
| 36 return "text/html"; |
| 37 } |
| 38 |
| 39 bool DomDistillerViewerSource::ShouldServiceRequest( |
| 40 const net::URLRequest* request) const { |
| 41 return request->url().SchemeIs(chrome::kDomDistillerScheme); |
| 42 } |
| 43 |
| 44 std::string DomDistillerViewerSource::GetContentSecurityPolicyFrameSrc() const { |
| 45 return "frame-src none;"; |
| 46 } |
| 47 |
| 48 } // namespace dom_distiller |
OLD | NEW |