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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 struct HeadlessBrowser::Options { | 67 struct HeadlessBrowser::Options { |
68 ~Options(); | 68 ~Options(); |
69 | 69 |
70 class Builder; | 70 class Builder; |
71 | 71 |
72 // Command line options to be passed to browser. | 72 // Command line options to be passed to browser. |
73 int argc; | 73 int argc; |
74 const char** argv; | 74 const char** argv; |
75 | 75 |
76 std::string user_agent; | 76 std::string user_agent; |
| 77 std::string navigator_platform; |
77 | 78 |
78 static const int kInvalidPort = -1; | 79 static const int kInvalidPort = -1; |
79 // If not null, create start devtools for remote debugging | 80 // If not null, create start devtools for remote debugging |
80 // on specified port. | 81 // on specified port. |
81 int devtools_http_port; | 82 int devtools_http_port; |
82 | 83 |
83 // Optional URLRequestContextGetter for customizing network stack. | 84 // Optional URLRequestContextGetter for customizing network stack. |
| 85 // Allows overriding: |
| 86 // - Cookie storage |
| 87 // - HTTP cache |
| 88 // - SSL config |
| 89 // - Proxy service |
84 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter; | 90 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter; |
85 | 91 |
| 92 scoped_ptr<base::MessagePump> message_pump; |
| 93 |
86 private: | 94 private: |
87 Options(int argc, const char** argv); | 95 Options(int argc, const char** argv); |
88 }; | 96 }; |
89 | 97 |
90 class HeadlessBrowser::Options::Builder { | 98 class HeadlessBrowser::Options::Builder { |
91 public: | 99 public: |
92 Builder(int argc, const char** argv); | 100 Builder(int argc, const char** argv); |
93 ~Builder(); | 101 ~Builder(); |
94 | 102 |
95 Builder& SetUserAgent(const std::string& user_agent); | 103 Builder& SetUserAgent(const std::string& user_agent); |
96 Builder& EnableDevToolsServer(int port); | 104 Builder& EnableDevToolsServer(int port); |
97 Builder& SetURLRequestContextGetter( | 105 Builder& SetURLRequestContextGetter( |
98 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); | 106 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); |
99 | 107 |
100 Options Build(); | 108 Options Build(); |
101 | 109 |
102 private: | 110 private: |
103 Options options_; | 111 Options options_; |
104 | 112 |
105 DISALLOW_COPY_AND_ASSIGN(Builder); | 113 DISALLOW_COPY_AND_ASSIGN(Builder); |
106 }; | 114 }; |
107 | 115 |
108 } // namespace headless | 116 } // namespace headless |
109 | 117 |
110 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ | 118 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ |
OLD | NEW |