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

Side by Side Diff: net/url_request/url_request_context_builder.h

Issue 2881613002: Allow use of Mojo/V8 ProxyResolvers with URLRequestContextBuilder. (Closed)
Patch Set: Forgot to remove WaitForConnectionsListener Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This class is useful for building a simple URLRequestContext. Most creators 5 // This class is useful for building a simple URLRequestContext. Most creators
6 // of new URLRequestContexts should use this helper class to construct it. Call 6 // of new URLRequestContexts should use this helper class to construct it. Call
7 // any configuration params, and when done, invoke Build() to construct the 7 // any configuration params, and when done, invoke Build() to construct the
8 // URLRequestContext. This URLRequestContext will own all its own storage. 8 // URLRequestContext. This URLRequestContext will own all its own storage.
9 // 9 //
10 // URLRequestContextBuilder and its associated params classes are initially 10 // URLRequestContextBuilder and its associated params classes are initially
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 int quic_idle_connection_timeout_seconds; 100 int quic_idle_connection_timeout_seconds;
101 QuicTagVector quic_connection_options; 101 QuicTagVector quic_connection_options;
102 bool quic_close_sessions_on_ip_change; 102 bool quic_close_sessions_on_ip_change;
103 bool quic_migrate_sessions_on_network_change; 103 bool quic_migrate_sessions_on_network_change;
104 bool quic_migrate_sessions_early; 104 bool quic_migrate_sessions_early;
105 bool quic_disable_bidirectional_streams; 105 bool quic_disable_bidirectional_streams;
106 bool quic_race_cert_verification; 106 bool quic_race_cert_verification;
107 }; 107 };
108 108
109 URLRequestContextBuilder(); 109 URLRequestContextBuilder();
110 ~URLRequestContextBuilder(); 110 virtual ~URLRequestContextBuilder();
111 111
112 // Sets a name for this URLRequestContext. Currently the name is used in 112 // Sets a name for this URLRequestContext. Currently the name is used in
113 // MemoryDumpProvier to annotate memory usage. The name does not need to be 113 // MemoryDumpProvier to annotate memory usage. The name does not need to be
114 // unique. 114 // unique.
115 void set_name(const char* name) { name_ = name; } 115 void set_name(const char* name) { name_ = name; }
116 116
117 // Sets whether Brotli compression is enabled. Disabled by default; 117 // Sets whether Brotli compression is enabled. Disabled by default;
118 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; } 118 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; }
119 119
120 // Unlike most other setters, the builder does not take ownership of the 120 // Unlike most other setters, the builder does not take ownership of the
(...skipping 10 matching lines...) Expand all
131 static void SetHttpNetworkSessionComponents( 131 static void SetHttpNetworkSessionComponents(
132 const URLRequestContext* context, 132 const URLRequestContext* context,
133 HttpNetworkSession::Params* params); 133 HttpNetworkSession::Params* params);
134 134
135 // These functions are mutually exclusive. The ProxyConfigService, if 135 // These functions are mutually exclusive. The ProxyConfigService, if
136 // set, will be used to construct a ProxyService. 136 // set, will be used to construct a ProxyService.
137 void set_proxy_config_service( 137 void set_proxy_config_service(
138 std::unique_ptr<ProxyConfigService> proxy_config_service) { 138 std::unique_ptr<ProxyConfigService> proxy_config_service) {
139 proxy_config_service_ = std::move(proxy_config_service); 139 proxy_config_service_ = std::move(proxy_config_service);
140 } 140 }
141
142 // Sets the proxy service. If one is not provided, uses system libraries to
143 // evaluate PAC scripts, if available (And if not, skips PAC resolution).
141 void set_proxy_service(std::unique_ptr<ProxyService> proxy_service) { 144 void set_proxy_service(std::unique_ptr<ProxyService> proxy_service) {
142 proxy_service_ = std::move(proxy_service); 145 proxy_service_ = std::move(proxy_service);
143 } 146 }
144 147
145 // Call these functions to specify hard-coded Accept-Language 148 // Call these functions to specify hard-coded Accept-Language
146 // or User-Agent header values for all requests that don't 149 // or User-Agent header values for all requests that don't
147 // have the headers already set. 150 // have the headers already set.
148 void set_accept_language(const std::string& accept_language) { 151 void set_accept_language(const std::string& accept_language) {
149 accept_language_ = accept_language; 152 accept_language_ = accept_language;
150 } 153 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. 322 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object.
320 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } 323 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; }
321 324
322 // Sets a specific HttpServerProperties for use in the 325 // Sets a specific HttpServerProperties for use in the
323 // URLRequestContext rather than creating a default HttpServerPropertiesImpl. 326 // URLRequestContext rather than creating a default HttpServerPropertiesImpl.
324 void SetHttpServerProperties( 327 void SetHttpServerProperties(
325 std::unique_ptr<HttpServerProperties> http_server_properties); 328 std::unique_ptr<HttpServerProperties> http_server_properties);
326 329
327 std::unique_ptr<URLRequestContext> Build(); 330 std::unique_ptr<URLRequestContext> Build();
328 331
332 protected:
333 // Lets subclasses override ProxyService creation, using a ProxyService that
334 // uses the URLRequestContext itself to get PAC scripts. When this method is
335 // invoked, the URLRequestContext is not yet ready to service requests.
336 virtual std::unique_ptr<ProxyService> CreateProxyService(
337 std::unique_ptr<ProxyConfigService> proxy_config_service,
338 URLRequestContext* url_request_context,
339 HostResolver* host_resolver,
340 NetworkDelegate* network_delegate,
341 NetLog* net_log);
342
329 private: 343 private:
330 const char* name_; 344 const char* name_;
331 bool enable_brotli_; 345 bool enable_brotli_;
332 NetworkQualityEstimator* network_quality_estimator_; 346 NetworkQualityEstimator* network_quality_estimator_;
333 347
334 std::string accept_language_; 348 std::string accept_language_;
335 std::string user_agent_; 349 std::string user_agent_;
336 // Include support for data:// requests. 350 // Include support for data:// requests.
337 bool data_enabled_; 351 bool data_enabled_;
338 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) 352 #if !BUILDFLAG(DISABLE_FILE_SUPPORT)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // Not owned by the context builder. Once it is set to a non-null value, it 385 // Not owned by the context builder. Once it is set to a non-null value, it
372 // is guaranteed to be non-null during the lifetime of |this|. 386 // is guaranteed to be non-null during the lifetime of |this|.
373 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; 387 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_;
374 388
375 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); 389 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder);
376 }; 390 };
377 391
378 } // namespace net 392 } // namespace net
379 393
380 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ 394 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698