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

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: Addressed all comments 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 "base/gtest_prod_util.h"
shashi 2014/02/27 04:29:08 nit: is this import needed?
10 #include "content/public/browser/url_data_source.h" 11 #include "content/public/browser/url_data_source.h"
11 12
12 namespace dom_distiller { 13 namespace dom_distiller {
13 14
14 class DomDistillerService; 15 class DomDistillerServiceInterface;
16 class DomDistillerViewerSourceTest;
17 class ViewerHandle;
18 class ViewRequestDelegate;
15 19
16 // Serves HTML and resources for viewing distilled articles. 20 // Serves HTML and resources for viewing distilled articles.
17 class DomDistillerViewerSource : public content::URLDataSource { 21 class DomDistillerViewerSource : public content::URLDataSource {
18 public: 22 public:
19 DomDistillerViewerSource(DomDistillerService* dom_distiller_service, 23 DomDistillerViewerSource(DomDistillerServiceInterface* dom_distiller_service,
20 const std::string& scheme); 24 const std::string& scheme);
21 virtual ~DomDistillerViewerSource(); 25 virtual ~DomDistillerViewerSource();
22 26
23 private: 27 class RequestViewerHandle;
28
24 // Overridden from content::URLDataSource: 29 // Overridden from content::URLDataSource:
25 virtual std::string GetSource() const OVERRIDE; 30 virtual std::string GetSource() const OVERRIDE;
26 virtual void StartDataRequest( 31 virtual void StartDataRequest(
27 const std::string& path, 32 const std::string& path,
28 int render_process_id, 33 int render_process_id,
29 int render_frame_id, 34 int render_frame_id,
30 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; 35 const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
31 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; 36 virtual std::string GetMimeType(const std::string& path) const OVERRIDE;
32 virtual bool ShouldServiceRequest(const net::URLRequest* request) 37 virtual bool ShouldServiceRequest(const net::URLRequest* request) const
33 const OVERRIDE; 38 OVERRIDE;
34 virtual void WillServiceRequest(const net::URLRequest* request, 39 virtual void WillServiceRequest(const net::URLRequest* request,
35 std::string* path) const OVERRIDE; 40 std::string* path) const OVERRIDE;
36 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE; 41 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE;
37 42
43 private:
44 friend class DomDistillerViewerSourceTest;
45
46 // Based on the given path, calls into the DomDistillerServiceInterface for
47 // viewing distilled content either based on the URL or the entry ID.
shashi 2014/02/27 04:29:08 nit: Do you mean: Based on the |path|
nyquist 2014/02/27 19:50:19 Done.
48 scoped_ptr<ViewerHandle> CreateViewRequest(
49 const std::string& path,
50 ViewRequestDelegate* view_request_delegate);
51
38 // The scheme this URLDataSource is hosted under. 52 // The scheme this URLDataSource is hosted under.
39 std::string scheme_; 53 std::string scheme_;
40 54
41 // The service which contains all the functionality needed to interact with 55 // The service which contains all the functionality needed to interact with
42 // the list of articles. 56 // the list of articles.
43 DomDistillerService* dom_distiller_service_; 57 DomDistillerServiceInterface* dom_distiller_service_;
44 58
45 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource); 59 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource);
46 }; 60 };
47 61
48 } // namespace dom_distiller 62 } // namespace dom_distiller
49 63
50 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_ 64 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698