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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/content/dom_distiller_viewer_source.cc
diff --git a/components/dom_distiller/content/dom_distiller_viewer_source.cc b/components/dom_distiller/content/dom_distiller_viewer_source.cc
new file mode 100644
index 0000000000000000000000000000000000000000..48961f699dc7ab5318824238178ec0a88ea1431c
--- /dev/null
+++ b/components/dom_distiller/content/dom_distiller_viewer_source.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/dom_distiller/content/dom_distiller_viewer_source.h"
+
+#include <string>
+
+#include "base/memory/ref_counted_memory.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/common/url_constants.h"
+#include "net/url_request/url_request.h"
+#include "url/gurl.h"
+
+namespace dom_distiller {
+
+DomDistillerViewerSource::DomDistillerViewerSource() {}
+
+DomDistillerViewerSource::~DomDistillerViewerSource() {}
+
+std::string DomDistillerViewerSource::GetSource() const {
+ return chrome::kDomDistillerScheme;
+}
+
+void DomDistillerViewerSource::StartDataRequest(
+ const std::string& path,
+ int render_process_id,
+ int render_view_id,
+ const content::URLDataSource::GotDataCallback& callback) {
+ std::string page_template = "Aloha!";
+ callback.Run(base::RefCountedString::TakeString(&page_template));
+};
+
+std::string DomDistillerViewerSource::GetMimeType(
+ const std::string& path) const {
+ return "text/html";
+}
+
+bool DomDistillerViewerSource::ShouldServiceRequest(
+ const net::URLRequest* request) const {
+ return request->url().SchemeIs(chrome::kDomDistillerScheme);
+}
+
+std::string DomDistillerViewerSource::GetContentSecurityPolicyFrameSrc() const {
+ return "frame-src none;";
+}
+
+} // namespace dom_distiller

Powered by Google App Engine
This is Rietveld 408576698