| 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 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "headless/public/headless_browser_context.h" | 16 #include "headless/public/headless_browser_context.h" |
| 17 #include "headless/public/headless_export.h" | 17 #include "headless/public/headless_export.h" |
| 18 #include "headless/public/headless_web_contents.h" | 18 #include "headless/public/headless_web_contents.h" |
| 19 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
| 20 #include "net/base/ip_endpoint.h" | 20 #include "net/base/ip_endpoint.h" |
| 21 #include "net/url_request/url_request_job_factory.h" | |
| 22 | 21 |
| 23 namespace base { | 22 namespace base { |
| 24 class MessagePump; | 23 class MessagePump; |
| 25 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace gfx { | 27 namespace gfx { |
| 29 class Size; | 28 class Size; |
| 30 } | 29 } |
| 31 | 30 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 virtual HeadlessBrowserContext::Builder CreateBrowserContextBuilder() = 0; | 65 virtual HeadlessBrowserContext::Builder CreateBrowserContextBuilder() = 0; |
| 67 | 66 |
| 68 protected: | 67 protected: |
| 69 HeadlessBrowser() {} | 68 HeadlessBrowser() {} |
| 70 virtual ~HeadlessBrowser() {} | 69 virtual ~HeadlessBrowser() {} |
| 71 | 70 |
| 72 private: | 71 private: |
| 73 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowser); | 72 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowser); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 using ProtocolHandlerMap = std::unordered_map< | |
| 77 std::string, | |
| 78 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>>; | |
| 79 | |
| 80 // Embedding API overrides for the headless browser. | 75 // Embedding API overrides for the headless browser. |
| 81 struct HeadlessBrowser::Options { | 76 struct HeadlessBrowser::Options { |
| 82 class Builder; | 77 class Builder; |
| 83 | 78 |
| 84 Options(Options&& options); | 79 Options(Options&& options); |
| 85 ~Options(); | 80 ~Options(); |
| 86 | 81 |
| 87 Options& operator=(Options&& options); | 82 Options& operator=(Options&& options); |
| 88 | 83 |
| 89 // Command line options to be passed to browser. | 84 // Command line options to be passed to browser. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // the main loop, it will only return after HeadlessBrowser::Shutdown() is | 167 // the main loop, it will only return after HeadlessBrowser::Shutdown() is |
| 173 // called, returning the exit code for the process. It is not possible to | 168 // called, returning the exit code for the process. It is not possible to |
| 174 // initialize the browser again after it has been torn down. | 169 // initialize the browser again after it has been torn down. |
| 175 int HeadlessBrowserMain( | 170 int HeadlessBrowserMain( |
| 176 HeadlessBrowser::Options options, | 171 HeadlessBrowser::Options options, |
| 177 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); | 172 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); |
| 178 | 173 |
| 179 } // namespace headless | 174 } // namespace headless |
| 180 | 175 |
| 181 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 176 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
| OLD | NEW |