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..bc4aaf452da7989ade97498bc0d7188fc96100c1 |
--- /dev/null |
+++ b/headless/public/web_contents.h |
@@ -0,0 +1,54 @@ |
+// 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 headless { |
+ |
+class WebFrame; |
+ |
+class HEADLESS_EXPORT WebContents { |
+ public: |
+ class Observer { |
+ public: |
+ // Will be called on browser thread. |
+ virtual void DocumentOnLoadCompletedInMainFrame() = 0; |
+ |
+ protected: |
+ Observer(WebContents* web_contents); |
+ virtual ~Observer(); |
+ |
+ private: |
+ class ObserverImpl; |
+ scoped_ptr<ObserverImpl> observer_; |
+ }; |
+ |
+ // Returns main frame for web page. |
+ // Should be called on browser main thread. |
+ virtual scoped_ptr<WebFrame> main_frame(); |
+ |
+ // Requests browser tab to open an url. |
Sami
2015/11/19 15:42:44
nit: s/open/navigate to/
altimin
2015/11/19 16:13:13
Done.
|
+ // Should be called on browser main thread. |
+ virtual void OpenURL(const GURL& url); |
+ |
+ 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); |
+ |
+ protected: |
+ virtual ~WebContents() {} |
+}; |
+ |
+} // namespace headless |
+ |
+#endif // HEADLESS_PUBLIC_WEB_CONTENTS_H_ |