Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: headless/public/headless_browser.h

Issue 1461693003: [headless] Initial skeleton of headless/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed OnStart() and changed Run() Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/DEPS ('k') | headless/public/headless_export.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cd0a13776c366238062ac9b2b660b068232f9049
--- /dev/null
+++ b/headless/public/headless_browser.h
@@ -0,0 +1,56 @@
+// 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 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.
+ // Takes command line args and callback to run as soon as browser starts.
+ // Should be called from main in the following manner:
+ // int main(int argc, const char** argv) {
+ // return headless::HeadlessBrowser::Get()->Run(
+ // argc, argv, base::Bind(function_to_be_run_on_browser_start));
+ // }
+ virtual int Run(
+ int argc,
+ const char** argv,
+ const base::Closure& on_browser_start_callback);
Sami 2015/11/19 16:24:39 Pure virtual.
+
+ // Requests browser to stop as soon as possible.
+ virtual void Stop() = 0;
+
+ protected:
+ virtual ~HeadlessBrowser() {}
+};
+
+} // namespace headless
+
+#endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_
« no previous file with comments | « headless/DEPS ('k') | headless/public/headless_export.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698