| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "components/cronet/url_request_context_config.h" | 5 #include "components/cronet/url_request_context_config.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
| 12 #include "base/values.h" | 14 #include "base/values.h" |
| 13 #include "net/cert/cert_verifier.h" | 15 #include "net/cert/cert_verifier.h" |
| 14 #include "net/dns/host_resolver.h" | 16 #include "net/dns/host_resolver.h" |
| 15 #include "net/quic/quic_protocol.h" | 17 #include "net/quic/quic_protocol.h" |
| 16 #include "net/quic/quic_utils.h" | 18 #include "net/quic/quic_utils.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 scoped_ptr<base::Value> options = | 50 scoped_ptr<base::Value> options = |
| 49 base::JSONReader::Read(experimental_options); | 51 base::JSONReader::Read(experimental_options); |
| 50 | 52 |
| 51 if (!options) { | 53 if (!options) { |
| 52 DCHECK(false) << "Parsing experimental options failed: " | 54 DCHECK(false) << "Parsing experimental options failed: " |
| 53 << experimental_options; | 55 << experimental_options; |
| 54 return; | 56 return; |
| 55 } | 57 } |
| 56 | 58 |
| 57 scoped_ptr<base::DictionaryValue> dict = | 59 scoped_ptr<base::DictionaryValue> dict = |
| 58 base::DictionaryValue::From(options.Pass()); | 60 base::DictionaryValue::From(std::move(options)); |
| 59 | 61 |
| 60 if (!dict) { | 62 if (!dict) { |
| 61 DCHECK(false) << "Experimental options string is not a dictionary: " | 63 DCHECK(false) << "Experimental options string is not a dictionary: " |
| 62 << experimental_options; | 64 << experimental_options; |
| 63 return; | 65 return; |
| 64 } | 66 } |
| 65 | 67 |
| 66 const base::DictionaryValue* quic_args = nullptr; | 68 const base::DictionaryValue* quic_args = nullptr; |
| 67 if (dict->GetDictionary(kQuicFieldTrialName, &quic_args)) { | 69 if (dict->GetDictionary(kQuicFieldTrialName, &quic_args)) { |
| 68 std::string quic_connection_options; | 70 std::string quic_connection_options; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 context_builder->DisableHttpCache(); | 195 context_builder->DisableHttpCache(); |
| 194 } | 196 } |
| 195 context_builder->set_user_agent(user_agent); | 197 context_builder->set_user_agent(user_agent); |
| 196 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); | 198 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); |
| 197 context_builder->set_sdch_enabled(enable_sdch); | 199 context_builder->set_sdch_enabled(enable_sdch); |
| 198 | 200 |
| 199 ParseAndSetExperimentalOptions(experimental_options, context_builder, | 201 ParseAndSetExperimentalOptions(experimental_options, context_builder, |
| 200 net_log); | 202 net_log); |
| 201 | 203 |
| 202 if (mock_cert_verifier) | 204 if (mock_cert_verifier) |
| 203 context_builder->SetCertVerifier(mock_cert_verifier.Pass()); | 205 context_builder->SetCertVerifier(std::move(mock_cert_verifier)); |
| 204 // TODO(mef): Use |config| to set cookies. | 206 // TODO(mef): Use |config| to set cookies. |
| 205 } | 207 } |
| 206 | 208 |
| 207 } // namespace cronet | 209 } // namespace cronet |
| OLD | NEW |