| 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> |
| 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "headless/public/headless_export.h" | 16 #include "headless/public/headless_export.h" |
| 16 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
| 17 #include "net/base/ip_endpoint.h" | 18 #include "net/base/ip_endpoint.h" |
| 18 #include "net/url_request/url_request_job_factory.h" | 19 #include "net/url_request/url_request_job_factory.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 44 // HeadlessWebContents::Observer::DevToolsTargetReady. | 45 // HeadlessWebContents::Observer::DevToolsTargetReady. |
| 45 virtual HeadlessWebContents* CreateWebContents(const GURL& initial_url, | 46 virtual HeadlessWebContents* CreateWebContents(const GURL& initial_url, |
| 46 const gfx::Size& size) = 0; | 47 const gfx::Size& size) = 0; |
| 47 | 48 |
| 48 virtual std::vector<HeadlessWebContents*> GetAllWebContents() = 0; | 49 virtual std::vector<HeadlessWebContents*> GetAllWebContents() = 0; |
| 49 | 50 |
| 50 // Returns a task runner for submitting work to the browser main thread. | 51 // Returns a task runner for submitting work to the browser main thread. |
| 51 virtual scoped_refptr<base::SingleThreadTaskRunner> BrowserMainThread() | 52 virtual scoped_refptr<base::SingleThreadTaskRunner> BrowserMainThread() |
| 52 const = 0; | 53 const = 0; |
| 53 | 54 |
| 55 // Returns a task runner for submitting work to the browser file thread. |
| 56 virtual scoped_refptr<base::SingleThreadTaskRunner> BrowserFileThread() |
| 57 const = 0; |
| 58 |
| 54 // Requests browser to stop as soon as possible. |Run| will return as soon as | 59 // Requests browser to stop as soon as possible. |Run| will return as soon as |
| 55 // browser stops. | 60 // browser stops. |
| 56 virtual void Shutdown() = 0; | 61 virtual void Shutdown() = 0; |
| 57 | 62 |
| 58 protected: | 63 protected: |
| 59 HeadlessBrowser() {} | 64 HeadlessBrowser() {} |
| 60 virtual ~HeadlessBrowser() {} | 65 virtual ~HeadlessBrowser() {} |
| 61 | 66 |
| 62 private: | 67 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowser); | 68 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowser); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // |on_browser_start_callback| callback. Note that since this function executes | 145 // |on_browser_start_callback| callback. Note that since this function executes |
| 141 // the main loop, it will only return after HeadlessBrowser::Shutdown() is | 146 // the main loop, it will only return after HeadlessBrowser::Shutdown() is |
| 142 // called, returning the exit code for the process. | 147 // called, returning the exit code for the process. |
| 143 int HeadlessBrowserMain( | 148 int HeadlessBrowserMain( |
| 144 HeadlessBrowser::Options options, | 149 HeadlessBrowser::Options options, |
| 145 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); | 150 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); |
| 146 | 151 |
| 147 } // namespace headless | 152 } // namespace headless |
| 148 | 153 |
| 149 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 154 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
| OLD | NEW |