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

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

Issue 151003006: Add support for distilling arbitrary URLs in DOM Distiller Viewer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added new strings to iOS whitelist Created 6 years, 9 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 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_
6 #define COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_ 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "content/public/browser/url_data_source.h" 10 #include "content/public/browser/url_data_source.h"
11 11
12 namespace dom_distiller { 12 namespace dom_distiller {
13 13
14 class DomDistillerService; 14 class DomDistillerServiceInterface;
15 class DomDistillerViewerSourceTest;
16 class ViewerHandle;
17 class ViewRequestDelegate;
15 18
16 // Serves HTML and resources for viewing distilled articles. 19 // Serves HTML and resources for viewing distilled articles.
17 class DomDistillerViewerSource : public content::URLDataSource { 20 class DomDistillerViewerSource : public content::URLDataSource {
18 public: 21 public:
19 DomDistillerViewerSource(DomDistillerService* dom_distiller_service, 22 DomDistillerViewerSource(DomDistillerServiceInterface* dom_distiller_service,
20 const std::string& scheme); 23 const std::string& scheme);
21 virtual ~DomDistillerViewerSource(); 24 virtual ~DomDistillerViewerSource();
22 25
23 private: 26 class RequestViewerHandle;
27
24 // Overridden from content::URLDataSource: 28 // Overridden from content::URLDataSource:
25 virtual std::string GetSource() const OVERRIDE; 29 virtual std::string GetSource() const OVERRIDE;
26 virtual void StartDataRequest( 30 virtual void StartDataRequest(
27 const std::string& path, 31 const std::string& path,
28 int render_process_id, 32 int render_process_id,
29 int render_frame_id, 33 int render_frame_id,
30 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; 34 const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
31 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; 35 virtual std::string GetMimeType(const std::string& path) const OVERRIDE;
32 virtual bool ShouldServiceRequest(const net::URLRequest* request) 36 virtual bool ShouldServiceRequest(const net::URLRequest* request) const
33 const OVERRIDE; 37 OVERRIDE;
34 virtual void WillServiceRequest(const net::URLRequest* request, 38 virtual void WillServiceRequest(const net::URLRequest* request,
35 std::string* path) const OVERRIDE; 39 std::string* path) const OVERRIDE;
36 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE; 40 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE;
37 41
42 private:
43 friend class DomDistillerViewerSourceTest;
44
45 // Based on the given path, calls into the DomDistillerServiceInterface for
46 // viewing distilled content based on the |path|.
47 scoped_ptr<ViewerHandle> CreateViewRequest(
48 const std::string& path,
49 ViewRequestDelegate* view_request_delegate);
50
38 // The scheme this URLDataSource is hosted under. 51 // The scheme this URLDataSource is hosted under.
39 std::string scheme_; 52 std::string scheme_;
40 53
41 // The service which contains all the functionality needed to interact with 54 // The service which contains all the functionality needed to interact with
42 // the list of articles. 55 // the list of articles.
43 DomDistillerService* dom_distiller_service_; 56 DomDistillerServiceInterface* dom_distiller_service_;
44 57
45 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource); 58 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource);
46 }; 59 };
47 60
48 } // namespace dom_distiller 61 } // namespace dom_distiller
49 62
50 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_ 63 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_
OLDNEW
« no previous file with comments | « components/dom_distiller/DEPS ('k') | components/dom_distiller/content/dom_distiller_viewer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698