Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: headless/public/headless_browser.h

Issue 1912673002: headless: Add support for host resolver mapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased again Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « headless/lib/headless_browser_browsertest.cc ('k') | headless/public/headless_browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // default. 79 // default.
80 net::IPEndPoint devtools_endpoint; 80 net::IPEndPoint devtools_endpoint;
81 81
82 // Address of the HTTP/HTTPS proxy server to use. The system proxy settings 82 // Address of the HTTP/HTTPS proxy server to use. The system proxy settings
83 // are used by default. 83 // are used by default.
84 net::HostPortPair proxy_server; 84 net::HostPortPair proxy_server;
85 85
86 // Optional message pump that overrides the default. Must outlive the browser. 86 // Optional message pump that overrides the default. Must outlive the browser.
87 base::MessagePump* message_pump; 87 base::MessagePump* message_pump;
88 88
89 // Comma-separated list of rules that control how hostnames are mapped. See
90 // chrome::switches::kHostRules for a description for the format.
91 std::string host_resolver_rules;
92
89 private: 93 private:
90 Options(int argc, const char** argv); 94 Options(int argc, const char** argv);
91 }; 95 };
92 96
93 class HeadlessBrowser::Options::Builder { 97 class HeadlessBrowser::Options::Builder {
94 public: 98 public:
95 Builder(int argc, const char** argv); 99 Builder(int argc, const char** argv);
96 Builder(); 100 Builder();
97 ~Builder(); 101 ~Builder();
98 102
99 Builder& SetUserAgent(const std::string& user_agent); 103 Builder& SetUserAgent(const std::string& user_agent);
100 Builder& EnableDevToolsServer(const net::IPEndPoint& endpoint); 104 Builder& EnableDevToolsServer(const net::IPEndPoint& endpoint);
101 Builder& SetMessagePump(base::MessagePump* message_pump); 105 Builder& SetMessagePump(base::MessagePump* message_pump);
102 Builder& SetProxyServer(const net::HostPortPair& proxy_server); 106 Builder& SetProxyServer(const net::HostPortPair& proxy_server);
107 Builder& SetHostResolverRules(const std::string& host_resolver_rules);
103 108
104 Options Build(); 109 Options Build();
105 110
106 private: 111 private:
107 Options options_; 112 Options options_;
108 113
109 DISALLOW_COPY_AND_ASSIGN(Builder); 114 DISALLOW_COPY_AND_ASSIGN(Builder);
110 }; 115 };
111 116
112 // Main entry point for running the headless browser. This function constructs 117 // Main entry point for running the headless browser. This function constructs
113 // the headless browser instance, passing it to the given 118 // the headless browser instance, passing it to the given
114 // |on_browser_start_callback| callback. Note that since this function executes 119 // |on_browser_start_callback| callback. Note that since this function executes
115 // the main loop, it will only return after HeadlessBrowser::Shutdown() is 120 // the main loop, it will only return after HeadlessBrowser::Shutdown() is
116 // called, returning the exit code for the process. 121 // called, returning the exit code for the process.
117 int HeadlessBrowserMain( 122 int HeadlessBrowserMain(
118 const HeadlessBrowser::Options& options, 123 const HeadlessBrowser::Options& options,
119 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback); 124 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback);
120 125
121 } // namespace headless 126 } // namespace headless
122 127
123 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_ 128 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_H_
OLDNEW
« no previous file with comments | « headless/lib/headless_browser_browsertest.cc ('k') | headless/public/headless_browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698