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_BROWSER_DOM_DISTILLER_VIEWER_SOURCE_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DOM_DISTILLER_VIEWER_SOURCE_H_ |
6 #define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DOM_DISTILLER_VIEWER_SOURCE_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DOM_DISTILLER_VIEWER_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "components/dom_distiller/content/browser/external_feedback_reporter.h" | 13 #include "components/dom_distiller/content/browser/distiller_ui_handle.h" |
14 #include "content/public/browser/url_data_source.h" | 14 #include "content/public/browser/url_data_source.h" |
15 | 15 |
16 namespace dom_distiller { | 16 namespace dom_distiller { |
17 | 17 |
18 class DomDistillerServiceInterface; | 18 class DomDistillerServiceInterface; |
19 class DomDistillerViewerSourceTest; | 19 class DomDistillerViewerSourceTest; |
20 class ViewerHandle; | 20 class ViewerHandle; |
21 class ViewRequestDelegate; | 21 class ViewRequestDelegate; |
22 | 22 |
23 // Serves HTML and resources for viewing distilled articles. | 23 // Serves HTML and resources for viewing distilled articles. |
24 class DomDistillerViewerSource : public content::URLDataSource { | 24 class DomDistillerViewerSource : public content::URLDataSource { |
25 public: | 25 public: |
26 DomDistillerViewerSource( | 26 DomDistillerViewerSource( |
27 DomDistillerServiceInterface* dom_distiller_service, | 27 DomDistillerServiceInterface* dom_distiller_service, |
28 const std::string& scheme, | 28 const std::string& scheme, |
29 scoped_ptr<ExternalFeedbackReporter> external_reporter); | 29 scoped_ptr<DistillerUIHandle> ui_handle); |
30 ~DomDistillerViewerSource() override; | 30 ~DomDistillerViewerSource() override; |
31 | 31 |
32 class RequestViewerHandle; | 32 class RequestViewerHandle; |
33 | 33 |
34 // Overridden from content::URLDataSource: | 34 // Overridden from content::URLDataSource: |
35 std::string GetSource() const override; | 35 std::string GetSource() const override; |
36 void StartDataRequest( | 36 void StartDataRequest( |
37 const std::string& path, | 37 const std::string& path, |
38 int render_process_id, | 38 int render_process_id, |
39 int render_frame_id, | 39 int render_frame_id, |
40 const content::URLDataSource::GotDataCallback& callback) override; | 40 const content::URLDataSource::GotDataCallback& callback) override; |
41 std::string GetMimeType(const std::string& path) const override; | 41 std::string GetMimeType(const std::string& path) const override; |
42 bool ShouldServiceRequest(const net::URLRequest* request) const override; | 42 bool ShouldServiceRequest(const net::URLRequest* request) const override; |
43 void WillServiceRequest(const net::URLRequest* request, | 43 void WillServiceRequest(const net::URLRequest* request, |
44 std::string* path) const override; | 44 std::string* path) const override; |
45 std::string GetContentSecurityPolicyObjectSrc() const override; | 45 std::string GetContentSecurityPolicyObjectSrc() const override; |
46 std::string GetContentSecurityPolicyFrameSrc() const override; | 46 std::string GetContentSecurityPolicyFrameSrc() const override; |
47 | 47 |
48 private: | 48 private: |
49 friend class DomDistillerViewerSourceTest; | 49 friend class DomDistillerViewerSourceTest; |
50 | 50 |
51 // The scheme this URLDataSource is hosted under. | 51 // The scheme this URLDataSource is hosted under. |
52 std::string scheme_; | 52 std::string scheme_; |
53 | 53 |
54 // The service which contains all the functionality needed to interact with | 54 // The service which contains all the functionality needed to interact with |
55 // the list of articles. | 55 // the list of articles. |
56 DomDistillerServiceInterface* dom_distiller_service_; | 56 DomDistillerServiceInterface* dom_distiller_service_; |
57 | 57 |
58 // A means for starting/opening an external service for feedback reporting. | 58 // An object for accessing chrome-specific UI controls including external |
59 scoped_ptr<ExternalFeedbackReporter> external_feedback_reporter_; | 59 // feedback and opening the distiller settings. |
| 60 scoped_ptr<DistillerUIHandle> distiller_ui_handle_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource); | 62 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource); |
62 }; | 63 }; |
63 | 64 |
64 } // namespace dom_distiller | 65 } // namespace dom_distiller |
65 | 66 |
66 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DOM_DISTILLER_VIEWER_SOURCE_
H_ | 67 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DOM_DISTILLER_VIEWER_SOURCE_
H_ |
OLD | NEW |