Don't preload rarely seen large images
[chromium-blink-merge.git] / components / dom_distiller / content / dom_distiller_viewer_source.h
blob49202522a2f02fd569a63459af28129727d739a8
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 "base/memory/scoped_ptr.h"
13 #include "components/dom_distiller/core/external_feedback_reporter.h"
14 #include "content/public/browser/url_data_source.h"
16 namespace dom_distiller {
18 class DomDistillerServiceInterface;
19 class DomDistillerViewerSourceTest;
20 class ViewerHandle;
21 class ViewRequestDelegate;
23 // Serves HTML and resources for viewing distilled articles.
24 class DomDistillerViewerSource : public content::URLDataSource {
25 public:
26 DomDistillerViewerSource(
27 DomDistillerServiceInterface* dom_distiller_service,
28 const std::string& scheme,
29 scoped_ptr<ExternalFeedbackReporter> external_reporter);
30 ~DomDistillerViewerSource() override;
32 class RequestViewerHandle;
34 // Overridden from content::URLDataSource:
35 std::string GetSource() const override;
36 void StartDataRequest(
37 const std::string& path,
38 int render_process_id,
39 int render_frame_id,
40 const content::URLDataSource::GotDataCallback& callback) override;
41 std::string GetMimeType(const std::string& path) const override;
42 bool ShouldServiceRequest(const net::URLRequest* request) const override;
43 void WillServiceRequest(const net::URLRequest* request,
44 std::string* path) const override;
45 std::string GetContentSecurityPolicyObjectSrc() const override;
46 std::string GetContentSecurityPolicyFrameSrc() const override;
48 private:
49 friend class DomDistillerViewerSourceTest;
51 // The scheme this URLDataSource is hosted under.
52 std::string scheme_;
54 // The service which contains all the functionality needed to interact with
55 // the list of articles.
56 DomDistillerServiceInterface* dom_distiller_service_;
58 // A means for starting/opening an external service for feedback reporting.
59 scoped_ptr<ExternalFeedbackReporter> external_feedback_reporter_;
61 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerSource);
64 } // namespace dom_distiller
66 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DOM_DISTILLER_VIEWER_SOURCE_H_