OLD | NEW |
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" |
11 #include "components/dom_distiller/core/distiller_page.h" | 11 #include "components/dom_distiller/core/distiller_page.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace content { | |
17 class RenderViewHost; | |
18 } | |
19 | |
20 using content::RenderViewHost; | |
21 | |
22 namespace dom_distiller { | 16 namespace dom_distiller { |
23 | 17 |
24 class SourcePageHandleWebContents : public SourcePageHandle { | 18 class SourcePageHandleWebContents : public SourcePageHandle { |
25 public: | 19 public: |
26 explicit SourcePageHandleWebContents( | 20 explicit SourcePageHandleWebContents( |
27 scoped_ptr<content::WebContents> web_contents); | 21 scoped_ptr<content::WebContents> web_contents); |
28 virtual ~SourcePageHandleWebContents(); | 22 virtual ~SourcePageHandleWebContents(); |
29 | 23 |
30 scoped_ptr<content::WebContents> GetWebContents(); | 24 scoped_ptr<content::WebContents> GetWebContents(); |
31 | 25 |
(...skipping 19 matching lines...) Expand all Loading... |
51 | 45 |
52 class DistillerPageWebContents : public DistillerPage, | 46 class DistillerPageWebContents : public DistillerPage, |
53 public content::WebContentsObserver { | 47 public content::WebContentsObserver { |
54 public: | 48 public: |
55 DistillerPageWebContents( | 49 DistillerPageWebContents( |
56 content::BrowserContext* browser_context, | 50 content::BrowserContext* browser_context, |
57 scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle); | 51 scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle); |
58 virtual ~DistillerPageWebContents(); | 52 virtual ~DistillerPageWebContents(); |
59 | 53 |
60 // content::WebContentsObserver implementation. | 54 // content::WebContentsObserver implementation. |
61 virtual void DocumentLoadedInFrame(int64 frame_id, | 55 virtual void DocumentLoadedInFrame( |
62 RenderViewHost* render_view_host) OVERRIDE; | 56 content::RenderFrameHost* render_frame_host) OVERRIDE; |
63 | 57 |
64 virtual void DidFailLoad(int64 frame_id, | 58 virtual void DidFailLoad(content::RenderFrameHost* render_frame_host, |
65 const GURL& validated_url, | 59 const GURL& validated_url, |
66 bool is_main_frame, | |
67 int error_code, | 60 int error_code, |
68 const base::string16& error_description, | 61 const base::string16& error_description) OVERRIDE; |
69 RenderViewHost* render_view_host) OVERRIDE; | |
70 | 62 |
71 protected: | 63 protected: |
72 virtual void DistillPageImpl(const GURL& url, | 64 virtual void DistillPageImpl(const GURL& url, |
73 const std::string& script) OVERRIDE; | 65 const std::string& script) OVERRIDE; |
74 | 66 |
75 private: | 67 private: |
76 friend class TestDistillerPageWebContents; | 68 friend class TestDistillerPageWebContents; |
77 | 69 |
78 enum State { | 70 enum State { |
79 // The page distiller is idle. | 71 // The page distiller is idle. |
(...skipping 26 matching lines...) Expand all Loading... |
106 std::string script_; | 98 std::string script_; |
107 | 99 |
108 scoped_ptr<content::WebContents> web_contents_; | 100 scoped_ptr<content::WebContents> web_contents_; |
109 content::BrowserContext* browser_context_; | 101 content::BrowserContext* browser_context_; |
110 DISALLOW_COPY_AND_ASSIGN(DistillerPageWebContents); | 102 DISALLOW_COPY_AND_ASSIGN(DistillerPageWebContents); |
111 }; | 103 }; |
112 | 104 |
113 } // namespace dom_distiller | 105 } // namespace dom_distiller |
114 | 106 |
115 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_PAGE_WEB_CONTENTS_H_ | 107 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_PAGE_WEB_CONTENTS_H_ |
OLD | NEW |