Index: headless/public/headless_browser.h |
diff --git a/headless/public/headless_browser.h b/headless/public/headless_browser.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..005f09afbca9e65bb01af8f1fd8465292957b959 |
--- /dev/null |
+++ b/headless/public/headless_browser.h |
@@ -0,0 +1,59 @@ |
+// 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_HEADLESS_BROWSER_H_ |
+#define HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
+ |
+#include "base/callback.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "headless/public/headless_export.h" |
+ |
+namespace base { |
+class SingleThreadTaskRunner; |
+ |
+namespace trace_event { |
Sami
2015/11/19 15:42:44
nit: remove
altimin
2015/11/19 16:13:13
Done.
|
+class TraceConfig; |
+} |
+} |
+ |
+namespace gfx { |
+class Size; |
+} |
+ |
+namespace headless { |
+class WebContents; |
+ |
+class HEADLESS_EXPORT HeadlessBrowser { |
+ public: |
+ static HeadlessBrowser* Get(); |
+ |
+ // Create a new browser tab. |
+ virtual scoped_ptr<WebContents> CreateWebContents(const gfx::Size& size) = 0; |
+ |
+ virtual scoped_refptr<base::SingleThreadTaskRunner> browser_main_thread() = 0; |
+ virtual scoped_refptr<base::SingleThreadTaskRunner> |
+ renderer_main_thread() = 0; |
+ |
+ // Main routine for running browser. |
+ // Should be called from main in the following manner: |
+ // int main(int argc, const char** argv) { |
+ // return headless::HeadlessBrowser::Get()->Run(argc, argv); |
+ // } |
+ virtual int Run(int argc, const char** argv) = 0; |
+ |
+ // Requests browser to stop as soon as possible. |
+ virtual void Stop() = 0; |
+ |
+ // Registers a callback to be executed on browser main thread |
+ // as soon as browser starts. |
+ virtual void OnStart(const base::Closure& on_start_callback) = 0; |
+ |
+ protected: |
+ virtual ~HeadlessBrowser() {} |
+}; |
+ |
+} // namespace headless |
+ |
+#endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |