Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / components / dom_distiller / content / dom_distiller_viewer_source.h
blob5a9721e0dd13f6e613ec82f3acff684c315f6799
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_
6 #define COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "content/public/browser/url_data_source.h"
14 namespace dom_distiller {
16 class DomDistillerServiceInterface;
17 class DomDistillerViewerSourceTest;
18 class ViewerHandle;
19 class ViewRequestDelegate;
21 // Serves HTML and resources for viewing distilled articles.
22 class DomDistillerViewerSource : public content::URLDataSource {
23 public:
24 DomDistillerViewerSource(DomDistillerServiceInterface* dom_distiller_service,
25 const std::string& scheme);
26 ~DomDistillerViewerSource() override;
28 class RequestViewerHandle;
30 // Overridden from content::URLDataSource:
31 std::string GetSource() const override;
32 void StartDataRequest(
33 const std::string& path,
34 int render_process_id,
35 int render_frame_id,
36 const content::URLDataSource::GotDataCallback& callback) override;
37 std::string GetMimeType(const std::string& path) const override;
38 bool ShouldServiceRequest(const net::URLRequest* request) const override;
39 void WillServiceRequest(const net::URLRequest* request,
40 std::string* path) const override;
41 std::string GetContentSecurityPolicyObjectSrc() const override;
43 private:
44 friend class DomDistillerViewerSourceTest;
46 // The scheme this URLDataSource is hosted under.
47 std::string scheme_;
49 // The service which contains all the functionality needed to interact with
50 // the list of articles.
51 DomDistillerServiceInterface* dom_distiller_service_;
53 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource);
56 } // namespace dom_distiller
58 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_