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

Side by Side Diff: components/dom_distiller/content/distiller_page_web_contents.h

Issue 901793002: Add support for providing an external file for extracting content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved injection to constructor Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DISTILLER_PAGE_WEB_CONTENTS_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_PAGE_WEB_CONTENTS_H_
6 #define COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_PAGE_WEB_CONTENTS_H_ 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_PAGE_WEB_CONTENTS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 13 matching lines...) Expand all
24 24
25 scoped_ptr<content::WebContents> GetWebContents(); 25 scoped_ptr<content::WebContents> GetWebContents();
26 26
27 private: 27 private:
28 // The WebContents this class owns. 28 // The WebContents this class owns.
29 scoped_ptr<content::WebContents> web_contents_; 29 scoped_ptr<content::WebContents> web_contents_;
30 }; 30 };
31 31
32 class DistillerPageWebContentsFactory : public DistillerPageFactory { 32 class DistillerPageWebContentsFactory : public DistillerPageFactory {
33 public: 33 public:
34 explicit DistillerPageWebContentsFactory( 34 DistillerPageWebContentsFactory(content::BrowserContext* browser_context,
35 content::BrowserContext* browser_context) 35 const std::string& distiller_js_script);
36 : DistillerPageFactory(), browser_context_(browser_context) {}
37 ~DistillerPageWebContentsFactory() override {} 36 ~DistillerPageWebContentsFactory() override {}
38 37
39 scoped_ptr<DistillerPage> CreateDistillerPage( 38 scoped_ptr<DistillerPage> CreateDistillerPage(
40 const gfx::Size& render_view_size) const override; 39 const gfx::Size& render_view_size) const override;
41 scoped_ptr<DistillerPage> CreateDistillerPageWithHandle( 40 scoped_ptr<DistillerPage> CreateDistillerPageWithHandle(
42 scoped_ptr<SourcePageHandle> handle) const override; 41 scoped_ptr<SourcePageHandle> handle) const override;
43 42
44 private: 43 private:
45 content::BrowserContext* browser_context_; 44 content::BrowserContext* browser_context_;
45 // Contains the script which will be passed on when constructing the
46 // DistillerPageWebContents. It should contain the string $$OPTIONS, which
47 // will be replaced with options passed in as proto::DomDistillerOptions
48 // before it is executed in the page context.
49 std::string distiller_js_script_;
46 }; 50 };
47 51
48 class DistillerPageWebContents : public DistillerPage, 52 class DistillerPageWebContents : public DistillerPage,
49 public content::WebContentsDelegate, 53 public content::WebContentsDelegate,
50 public content::WebContentsObserver { 54 public content::WebContentsObserver {
51 public: 55 public:
52 DistillerPageWebContents( 56 DistillerPageWebContents(
53 content::BrowserContext* browser_context, 57 content::BrowserContext* browser_context,
54 const gfx::Size& render_view_size, 58 const gfx::Size& render_view_size,
59 const std::string& distiller_js_script,
55 scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle); 60 scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle);
56 ~DistillerPageWebContents() override; 61 ~DistillerPageWebContents() override;
57 62
58 // content::WebContentsDelegate implementation. 63 // content::WebContentsDelegate implementation.
59 gfx::Size GetSizeForNewRenderView( 64 gfx::Size GetSizeForNewRenderView(
60 content::WebContents* web_contents) const override; 65 content::WebContents* web_contents) const override;
61 66
62 // content::WebContentsObserver implementation. 67 // content::WebContentsObserver implementation.
63 void DocumentLoadedInFrame( 68 void DocumentLoadedInFrame(
64 content::RenderFrameHost* render_frame_host) override; 69 content::RenderFrameHost* render_frame_host) override;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 111
107 scoped_ptr<content::WebContents> web_contents_; 112 scoped_ptr<content::WebContents> web_contents_;
108 content::BrowserContext* browser_context_; 113 content::BrowserContext* browser_context_;
109 gfx::Size render_view_size_; 114 gfx::Size render_view_size_;
110 DISALLOW_COPY_AND_ASSIGN(DistillerPageWebContents); 115 DISALLOW_COPY_AND_ASSIGN(DistillerPageWebContents);
111 }; 116 };
112 117
113 } // namespace dom_distiller 118 } // namespace dom_distiller
114 119
115 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_PAGE_WEB_CONTENTS_H_ 120 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_PAGE_WEB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698