OLD | NEW |
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 DomDistillerService; |
| 15 class ViewerHandle; |
15 | 16 |
16 // Serves HTML and resources for viewing distilled articles. | 17 // Serves HTML and resources for viewing distilled articles. |
17 class DomDistillerViewerSource : public content::URLDataSource { | 18 class DomDistillerViewerSource : public content::URLDataSource { |
18 public: | 19 public: |
19 DomDistillerViewerSource(DomDistillerService* dom_distiller_service, | 20 DomDistillerViewerSource(DomDistillerService* dom_distiller_service, |
20 const std::string& scheme); | 21 const std::string& scheme); |
21 virtual ~DomDistillerViewerSource(); | 22 virtual ~DomDistillerViewerSource(); |
22 | 23 |
23 private: | 24 private: |
| 25 class RequestViewerHandle; |
| 26 |
24 // Overridden from content::URLDataSource: | 27 // Overridden from content::URLDataSource: |
25 virtual std::string GetSource() const OVERRIDE; | 28 virtual std::string GetSource() const OVERRIDE; |
26 virtual void StartDataRequest( | 29 virtual void StartDataRequest( |
27 const std::string& path, | 30 const std::string& path, |
28 int render_process_id, | 31 int render_process_id, |
29 int render_frame_id, | 32 int render_frame_id, |
30 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 33 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
31 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; | 34 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; |
32 virtual bool ShouldServiceRequest(const net::URLRequest* request) | 35 virtual bool ShouldServiceRequest(const net::URLRequest* request) |
33 const OVERRIDE; | 36 const OVERRIDE; |
34 virtual void WillServiceRequest(const net::URLRequest* request, | 37 virtual void WillServiceRequest(const net::URLRequest* request, |
35 std::string* path) const OVERRIDE; | 38 std::string* path) const OVERRIDE; |
36 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE; | 39 virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE; |
37 | 40 |
| 41 scoped_ptr<ViewerHandle> CreateViewRequest( |
| 42 const std::string& path, |
| 43 RequestViewerHandle* request_viewer_handle); |
| 44 |
38 // The scheme this URLDataSource is hosted under. | 45 // The scheme this URLDataSource is hosted under. |
39 std::string scheme_; | 46 std::string scheme_; |
40 | 47 |
41 // The service which contains all the functionality needed to interact with | 48 // The service which contains all the functionality needed to interact with |
42 // the list of articles. | 49 // the list of articles. |
43 DomDistillerService* dom_distiller_service_; | 50 DomDistillerService* dom_distiller_service_; |
44 | 51 |
45 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource); | 52 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource); |
46 }; | 53 }; |
47 | 54 |
48 } // namespace dom_distiller | 55 } // namespace dom_distiller |
49 | 56 |
50 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_ | 57 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_ |
OLD | NEW |