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

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

Issue 341563002: Theme Preferences for Distilled Pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor Created 6 years, 5 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
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/dom_distiller_viewer_source.h" 5 #include "components/dom_distiller/content/dom_distiller_viewer_source.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted_memory.h" 11 #include "base/memory/ref_counted_memory.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "components/dom_distiller/core/dom_distiller_service.h"
15 #include "components/dom_distiller/core/task_tracker.h" 16 #include "components/dom_distiller/core/task_tracker.h"
16 #include "components/dom_distiller/core/url_constants.h" 17 #include "components/dom_distiller/core/url_constants.h"
17 #include "components/dom_distiller/core/viewer.h" 18 #include "components/dom_distiller/core/viewer.h"
18 #include "content/public/browser/navigation_details.h" 19 #include "content/public/browser/navigation_details.h"
19 #include "content/public/browser/navigation_entry.h" 20 #include "content/public/browser/navigation_entry.h"
20 #include "content/public/browser/render_frame_host.h" 21 #include "content/public/browser/render_frame_host.h"
21 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 #include "content/public/browser/web_contents_observer.h" 24 #include "content/public/browser/web_contents_observer.h"
24 #include "net/base/url_util.h" 25 #include "net/base/url_util.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 const content::URLDataSource::GotDataCallback& callback) { 253 const content::URLDataSource::GotDataCallback& callback) {
253 content::RenderFrameHost* render_frame_host = 254 content::RenderFrameHost* render_frame_host =
254 content::RenderFrameHost::FromID(render_process_id, render_frame_id); 255 content::RenderFrameHost::FromID(render_process_id, render_frame_id);
255 DCHECK(render_frame_host); 256 DCHECK(render_frame_host);
256 content::RenderViewHost* render_view_host = 257 content::RenderViewHost* render_view_host =
257 render_frame_host->GetRenderViewHost(); 258 render_frame_host->GetRenderViewHost();
258 DCHECK(render_view_host); 259 DCHECK(render_view_host);
259 CHECK_EQ(0, render_view_host->GetEnabledBindings()); 260 CHECK_EQ(0, render_view_host->GetEnabledBindings());
260 261
261 if (kViewerCssPath == path) { 262 if (kViewerCssPath == path) {
262 std::string css = viewer::GetCss(); 263 std::string css = viewer::GetCss(
264 dom_distiller_service_->GetReaderModePrefs());
263 callback.Run(base::RefCountedString::TakeString(&css)); 265 callback.Run(base::RefCountedString::TakeString(&css));
264 return; 266 return;
265 } 267 }
266 if (kViewerJsPath == path) { 268 if (kViewerJsPath == path) {
267 std::string js = viewer::GetJavaScript(); 269 std::string js = viewer::GetJavaScript();
268 callback.Run(base::RefCountedString::TakeString(&js)); 270 callback.Run(base::RefCountedString::TakeString(&js));
269 return; 271 return;
270 } 272 }
271 content::WebContents* web_contents = 273 content::WebContents* web_contents =
272 content::WebContents::FromRenderFrameHost( 274 content::WebContents::FromRenderFrameHost(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 const net::URLRequest* request, 321 const net::URLRequest* request,
320 std::string* path) const { 322 std::string* path) const {
321 } 323 }
322 324
323 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc() 325 std::string DomDistillerViewerSource::GetContentSecurityPolicyObjectSrc()
324 const { 326 const {
325 return "object-src 'none'; style-src 'self';"; 327 return "object-src 'none'; style-src 'self';";
326 } 328 }
327 329
328 } // namespace dom_distiller 330 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698