OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 5 #ifndef HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Returns the HeadlessWebContents associated with the | 48 // Returns the HeadlessWebContents associated with the |
49 // |devtools_agent_host_id| if any. Otherwise returns null. | 49 // |devtools_agent_host_id| if any. Otherwise returns null. |
50 virtual HeadlessWebContents* GetWebContentsForDevToolsAgentHostId( | 50 virtual HeadlessWebContents* GetWebContentsForDevToolsAgentHostId( |
51 const std::string& devtools_agent_host_id) = 0; | 51 const std::string& devtools_agent_host_id) = 0; |
52 | 52 |
53 // Returns HeadlessBrowserContext associated with the given id if any. | 53 // Returns HeadlessBrowserContext associated with the given id if any. |
54 // Otherwise returns null. | 54 // Otherwise returns null. |
55 virtual HeadlessBrowserContext* GetBrowserContextForId( | 55 virtual HeadlessBrowserContext* GetBrowserContextForId( |
56 const std::string& id) = 0; | 56 const std::string& id) = 0; |
57 | 57 |
| 58 // Returns a task runner for submitting work to the browser file thread. |
| 59 virtual scoped_refptr<base::SingleThreadTaskRunner> BrowserFileThread() |
| 60 const = 0; |
| 61 |
| 62 // Returns a task runner for submitting work to the browser io thread. |
| 63 virtual scoped_refptr<base::SingleThreadTaskRunner> BrowserIoThread() |
| 64 const = 0; |
| 65 |
58 // Returns a task runner for submitting work to the browser main thread. | 66 // Returns a task runner for submitting work to the browser main thread. |
59 virtual scoped_refptr<base::SingleThreadTaskRunner> BrowserMainThread() | 67 virtual scoped_refptr<base::SingleThreadTaskRunner> BrowserMainThread() |
60 const = 0; | 68 const = 0; |
61 | 69 |
62 // Returns a task runner for submitting work to the browser file thread. | |
63 virtual scoped_refptr<base::SingleThreadTaskRunner> BrowserFileThread() | |
64 const = 0; | |
65 | |
66 // Requests browser to stop as soon as possible. |Run| will return as soon as | 70 // Requests browser to stop as soon as possible. |Run| will return as soon as |
67 // browser stops. | 71 // browser stops. |
68 // IMPORTANT: All pointers to HeadlessBrowserContexts and HeadlessWebContents | 72 // IMPORTANT: All pointers to HeadlessBrowserContexts and HeadlessWebContents |
69 // become invalid after calling this function. | 73 // become invalid after calling this function. |
70 virtual void Shutdown() = 0; | 74 virtual void Shutdown() = 0; |
71 | 75 |
72 protected: | 76 protected: |
73 HeadlessBrowser() {} | 77 HeadlessBrowser() {} |
74 virtual ~HeadlessBrowser() {} | 78 virtual ~HeadlessBrowser() {} |
75 | 79 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // the main loop, it will only return after HeadlessBrowser::Shutdown() is | 204 // the main loop, it will only return after HeadlessBrowser::Shutdown() is |
201 // called, returning the exit code for the process. It is not possible to | 205 // called, returning the exit code for the process. It is not possible to |
202 // initialize the browser again after it has been torn down. | 206 // initialize the browser again after it has been torn down. |
203 int HeadlessBrowserMain( | 207 int HeadlessBrowserMain( |
204 HeadlessBrowser::Options options, | 208 HeadlessBrowser::Options options, |
205 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); | 209 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); |
206 | 210 |
207 } // namespace headless | 211 } // namespace headless |
208 | 212 |
209 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 213 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
OLD | NEW |