OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | |
6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "headless/public/headless_export.h" | |
12 | |
13 namespace base { | |
14 class SingleThreadTaskRunner; | |
15 } | |
16 | |
17 namespace gfx { | |
18 class Size; | |
19 } | |
20 | |
21 namespace headless { | |
22 class WebContents; | |
23 | |
24 class HEADLESS_EXPORT HeadlessBrowser { | |
25 public: | |
26 static HeadlessBrowser* Get(); | |
27 | |
28 // Create a new browser tab. | |
29 virtual scoped_ptr<WebContents> CreateWebContents(const gfx::Size& size) = 0; | |
30 | |
31 virtual scoped_refptr<base::SingleThreadTaskRunner> browser_main_thread() = 0; | |
32 virtual scoped_refptr<base::SingleThreadTaskRunner> | |
33 renderer_main_thread() = 0; | |
34 | |
35 // Main routine for running browser. | |
36 // Takes command line args and callback to run as soon as browser starts. | |
37 // Should be called from main in the following manner: | |
38 // int main(int argc, const char** argv) { | |
39 // return headless::HeadlessBrowser::Get()->Run( | |
40 // argc, argv, base::Bind(function_to_be_run_on_browser_start)); | |
41 // } | |
42 virtual int Run( | |
43 int argc, | |
44 const char** argv, | |
45 const base::Closure& on_browser_start_callback); | |
Sami
2015/11/19 16:24:39
Pure virtual.
| |
46 | |
47 // Requests browser to stop as soon as possible. | |
48 virtual void Stop() = 0; | |
49 | |
50 protected: | |
51 virtual ~HeadlessBrowser() {} | |
52 }; | |
53 | |
54 } // namespace headless | |
55 | |
56 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | |
OLD | NEW |