Chromium Code Reviews| Index: headless/public/web_contents.h |
| diff --git a/headless/public/web_contents.h b/headless/public/web_contents.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cfed91e659b21996d000ffb65661d1e519a416fe |
| --- /dev/null |
| +++ b/headless/public/web_contents.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef HEADLESS_PUBLIC_WEB_CONTENTS_H_ |
| +#define HEADLESS_PUBLIC_WEB_CONTENTS_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "headless/public/headless_export.h" |
| +#include "url/gurl.h" |
| + |
| +class SkBitmap; |
| + |
| +namespace content { |
| +class WebContents; |
| +} |
| + |
| +namespace headless { |
| +class WebFrame; |
| + |
| +class HEADLESS_EXPORT WebContents { |
|
Sami
2015/12/01 14:03:58
Could just have a top-level comment here that says
altimin
2015/12/01 15:17:29
Done.
|
| + public: |
| + virtual ~WebContents() {} |
| + |
| + class Observer { |
|
Sami
2015/12/01 14:03:58
How do you set the observer? Can you have several?
|
| + public: |
| + // Will be called on browser thread. |
| + virtual void DocumentOnLoadCompletedInMainFrame() = 0; |
| + |
| + // TODO(altimin): More OnSomething() methods will go here. |
| + |
| + protected: |
| + explicit Observer(WebContents* web_contents); |
| + virtual ~Observer(); |
| + |
| + private: |
| + class ObserverImpl; |
| + scoped_ptr<ObserverImpl> observer_; |
|
Sami
2015/12/01 14:03:58
DISALLOW_COPY_AND_ASSIGN
altimin
2015/12/01 15:17:29
Done.
|
| + }; |
| + |
| + // Returns main frame for web page. |
| + // Should be called on browser main thread. |
| + virtual scoped_ptr<WebFrame> main_frame() = 0; |
|
Sami
2015/12/01 14:03:58
I don't think we can return a scoped_ptr here. Tha
altimin
2015/12/01 15:17:29
Done.
|
| + |
| + // Requests browser tab to nagivate to given url. |
| + // Should be called on browser main thread. |
| + virtual void OpenURL(const GURL& url) = 0; |
| + |
| + using ScreenshotCallback = base::Callback<void(scoped_ptr<SkBitmap>)>; |
| + // Requests an image of web contents. |
| + // Should be called on browser main thread. |
| + virtual void GetScreenshot(const ScreenshotCallback& callback) = 0; |
| + |
| + protected: |
| + virtual content::WebContents* web_contents() = 0; |
|
Sami
2015/12/01 14:03:57
Does this need to be here? I imagine the impl clas
altimin
2015/12/01 15:17:29
This is needed for Observer (which is a wrapper ar
|
| +}; |
|
Sami
2015/12/01 14:03:58
DISALLOW_COPY_AND_ASSIGN
|
| + |
| +} // namespace headless |
| + |
| +#endif // HEADLESS_PUBLIC_WEB_CONTENTS_H_ |