Chromium Code Reviews| Index: headless/lib/browser/headless_web_contents_impl.h |
| diff --git a/headless/lib/browser/headless_web_contents_impl.h b/headless/lib/browser/headless_web_contents_impl.h |
| index e1cdc2d1615b59ea3e11d5f88e5d76b93982234b..7fe5eb6f31d1398adc5566518b3e690ddcae9901 100644 |
| --- a/headless/lib/browser/headless_web_contents_impl.h |
| +++ b/headless/lib/browser/headless_web_contents_impl.h |
| @@ -24,15 +24,24 @@ class Size; |
| } |
| namespace headless { |
| +class HeadlessBrowserImpl; |
| class WebContentsObserverAdapter; |
| class HeadlessWebContentsImpl : public HeadlessWebContents { |
| public: |
| - HeadlessWebContentsImpl(content::BrowserContext* context, |
| - aura::Window* parent_window, |
| - const gfx::Size& initial_size); |
| ~HeadlessWebContentsImpl() override; |
| + static std::unique_ptr<HeadlessWebContentsImpl> Create( |
| + content::BrowserContext* context, |
| + aura::Window* parent_window, |
| + const gfx::Size& initial_size, |
| + HeadlessBrowserImpl* browser); |
| + |
| + // Takes ownership of |web_contents|. |
| + static std::unique_ptr<HeadlessWebContentsImpl> FromWebContents( |
|
Sami
2016/04/20 16:38:50
Maybe call this CreateFromWebContents() since this
altimin
2016/04/20 17:35:25
Done.
|
| + content::WebContents* web_contents, |
| + HeadlessBrowserImpl* browser); |
| + |
| // HeadlessWebContents implementation: |
| void AddObserver(Observer* observer) override; |
| void RemoveObserver(Observer* observer) override; |
| @@ -40,10 +49,24 @@ class HeadlessWebContentsImpl : public HeadlessWebContents { |
| content::WebContents* web_contents() const; |
| bool OpenURL(const GURL& url); |
| + bool IsDirectlyCreated() const override; |
| + |
| + void Close() override; |
| + |
| private: |
| + // Takes ownership of |web_contents|. |
| + HeadlessWebContentsImpl(content::WebContents* web_contents, |
| + HeadlessBrowserImpl* browser); |
| + |
| + void InitializeScreen(aura::Window* parent_window, |
| + const gfx::Size& initial_size); |
| + |
| class Delegate; |
| std::unique_ptr<Delegate> web_contents_delegate_; |
| std::unique_ptr<content::WebContents> web_contents_; |
| + bool is_directly_created_; |
| + |
| + HeadlessBrowserImpl* browser_; |
|
Sami
2016/04/20 16:38:50
// Not owned.
altimin
2016/04/20 17:35:25
Done.
|
| using ObserverMap = |
| std::unordered_map<HeadlessWebContents::Observer*, |