Implement multiple alternative services per origin.
[chromium-blink-merge.git] / components / cronet / url_request_context_config.h
blobd21cc409474a0b64c8d03a74b630b9ece7d3ce32
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_
6 #define COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_
8 #include <string>
10 #include "base/json/json_value_converter.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_vector.h"
14 namespace net {
15 class URLRequestContextBuilder;
16 } // namespace net
18 namespace cronet {
20 // Common configuration parameters used by Cronet to configure
21 // URLRequestContext. Can be parsed from JSON string passed through JNI.
22 struct URLRequestContextConfig {
23 // App-provided hint that server supports QUIC.
24 struct QuicHint {
25 QuicHint();
26 ~QuicHint();
28 // Register |converter| for use in converter.Convert().
29 static void RegisterJSONConverter(
30 base::JSONValueConverter<QuicHint>* converter);
32 // Host name of the server that supports QUIC.
33 std::string host;
34 // Port of the server that supports QUIC.
35 int port;
36 // Alternate protocol port.
37 int alternate_port;
39 private:
40 DISALLOW_COPY_AND_ASSIGN(QuicHint);
43 URLRequestContextConfig();
44 ~URLRequestContextConfig();
46 // Load config values from JSON format.
47 bool LoadFromJSON(const std::string& config_string);
49 // Configure |context_builder| based on |this|.
50 void ConfigureURLRequestContextBuilder(
51 net::URLRequestContextBuilder* context_builder);
53 // Register |converter| for use in converter.Convert().
54 static void RegisterJSONConverter(
55 base::JSONValueConverter<URLRequestContextConfig>* converter);
57 // Enable QUIC.
58 bool enable_quic;
59 // Enable SPDY.
60 bool enable_spdy;
61 // Enable SDCH.
62 bool enable_sdch;
63 // Type of http cache: "HTTP_CACHE_DISABLED", "HTTP_CACHE_DISK" or
64 // "HTTP_CACHE_IN_MEMORY".
65 std::string http_cache;
66 // Max size of http cache in bytes.
67 int http_cache_max_size;
68 // Disable caching for HTTP responses. Other information may be stored in
69 // the cache.
70 bool load_disable_cache;
71 // Storage path for http cache and cookie storage.
72 std::string storage_path;
73 // User-Agent request header field.
74 std::string user_agent;
75 // App-provided list of servers that support QUIC.
76 ScopedVector<QuicHint> quic_hints;
77 // Comma-separted list of QUIC connection options.
78 std::string quic_connection_options;
79 // Enable Data Reduction Proxy with authentication key.
80 std::string data_reduction_proxy_key;
81 std::string data_reduction_primary_proxy;
82 std::string data_reduction_fallback_proxy;
83 std::string data_reduction_secure_proxy_check_url;
85 private:
86 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig);
89 } // namespace cronet
91 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_