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

Unified Diff: components/dom_distiller/content/distiller_page_web_contents.h

Issue 266073003: Add support for distilling current WebContents (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/dom_distiller.gypi ('k') | components/dom_distiller/content/distiller_page_web_contents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/content/distiller_page_web_contents.h
diff --git a/components/dom_distiller/content/distiller_page_web_contents.h b/components/dom_distiller/content/distiller_page_web_contents.h
index 52509f502804a79ae61d2c1bb1dd08d6f621008b..aed9789cf55249188c0d0460aa68e7804e04774e 100644
--- a/components/dom_distiller/content/distiller_page_web_contents.h
+++ b/components/dom_distiller/content/distiller_page_web_contents.h
@@ -21,7 +21,18 @@ using content::RenderViewHost;
namespace dom_distiller {
-class DistillerContext;
+class SourcePageHandleWebContents : public SourcePageHandle {
+ public:
+ explicit SourcePageHandleWebContents(
+ scoped_ptr<content::WebContents> web_contents);
+ virtual ~SourcePageHandleWebContents();
+
+ scoped_ptr<content::WebContents> GetWebContents();
+
+ private:
+ // The WebContents this class owns.
+ scoped_ptr<content::WebContents> web_contents_;
+};
class DistillerPageWebContentsFactory : public DistillerPageFactory {
public:
@@ -31,6 +42,8 @@ class DistillerPageWebContentsFactory : public DistillerPageFactory {
virtual ~DistillerPageWebContentsFactory() {}
virtual scoped_ptr<DistillerPage> CreateDistillerPage() const OVERRIDE;
+ virtual scoped_ptr<DistillerPage> CreateDistillerPageWithHandle(
+ scoped_ptr<SourcePageHandle> handle) const OVERRIDE;
private:
content::BrowserContext* browser_context_;
@@ -39,7 +52,9 @@ class DistillerPageWebContentsFactory : public DistillerPageFactory {
class DistillerPageWebContents : public DistillerPage,
public content::WebContentsObserver {
public:
- DistillerPageWebContents(content::BrowserContext* browser_context);
+ DistillerPageWebContents(
+ content::BrowserContext* browser_context,
+ scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle);
virtual ~DistillerPageWebContents();
// content::WebContentsObserver implementation.
@@ -58,6 +73,8 @@ class DistillerPageWebContents : public DistillerPage,
const std::string& script) OVERRIDE;
private:
+ friend class TestDistillerPageWebContents;
+
enum State {
// The page distiller is idle.
IDLE,
@@ -70,6 +87,10 @@ class DistillerPageWebContents : public DistillerPage,
EXECUTING_JAVASCRIPT
};
+ // Creates a new WebContents, adds |this| as an observer, and loads the
+ // |url|.
+ virtual void CreateNewWebContents(const GURL& url);
+
// Injects and executes JavaScript in the context of a loaded page. This
// must only be called after the page has successfully loaded.
void ExecuteJavaScript();
« no previous file with comments | « components/dom_distiller.gypi ('k') | components/dom_distiller/content/distiller_page_web_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698