Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: components/dom_distiller/content/dom_distiller_viewer_source.cc

Issue 105723002: Add the scheme chrome-distiller:// and hook up data source. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implement as data source instead. Also rebased across thousands of CLs. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698