| 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 80b7a9eb800f52954d81556f19249c955b0fd748..03e825ba8347d4d0b62e6ba938caf3c3a4ae8b1f 100644
|
| --- a/components/dom_distiller/content/distiller_page_web_contents.h
|
| +++ b/components/dom_distiller/content/distiller_page_web_contents.h
|
| @@ -8,6 +8,7 @@
|
| #include <string>
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "components/dom_distiller/core/distiller_page.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_contents_delegate.h"
|
| @@ -22,13 +23,28 @@ class SourcePageHandleWebContents : public SourcePageHandle {
|
| scoped_ptr<content::WebContents> web_contents);
|
| ~SourcePageHandleWebContents() override;
|
|
|
| - scoped_ptr<content::WebContents> GetWebContents();
|
| + content::WebContents* GetWebContents() const override;
|
|
|
| private:
|
| // The WebContents this class owns.
|
| scoped_ptr<content::WebContents> web_contents_;
|
| };
|
|
|
| +class SourcePageHandleWebContentsWeakPtr : public SourcePageHandle {
|
| + public:
|
| + explicit SourcePageHandleWebContentsWeakPtr(
|
| + content::WebContents* web_contents);
|
| + ~SourcePageHandleWebContentsWeakPtr() override;
|
| +
|
| + content::WebContents* GetWebContents() const override;
|
| +
|
| + private:
|
| + base::WeakPtrFactory<content::WebContents> weak_factory_;
|
| +
|
| + // The WebContents this class refs.
|
| + base::WeakPtr<content::WebContents> web_contents_;
|
| +};
|
| +
|
| class DistillerPageWebContentsFactory : public DistillerPageFactory {
|
| public:
|
| explicit DistillerPageWebContentsFactory(
|
| @@ -51,8 +67,11 @@ class DistillerPageWebContents : public DistillerPage,
|
| public:
|
| DistillerPageWebContents(
|
| content::BrowserContext* browser_context,
|
| + const gfx::Size& render_view_size);
|
| + DistillerPageWebContents(
|
| + content::BrowserContext* browser_context,
|
| const gfx::Size& render_view_size,
|
| - scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle);
|
| + scoped_ptr<SourcePageHandle> optional_web_contents_handle);
|
| ~DistillerPageWebContents() override;
|
|
|
| // content::WebContentsDelegate implementation.
|
| @@ -106,9 +125,11 @@ class DistillerPageWebContents : public DistillerPage,
|
| // The JavaScript to inject to extract content.
|
| std::string script_;
|
|
|
| - scoped_ptr<content::WebContents> web_contents_;
|
| + scoped_ptr<SourcePageHandle> web_contents_handle_;
|
| content::BrowserContext* browser_context_;
|
| gfx::Size render_view_size_;
|
| + base::WeakPtrFactory<DistillerPageWebContents> weak_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DistillerPageWebContents);
|
| };
|
|
|
|
|