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/android/cronet_url_request_context_adapter.h" | 5 #include "components/cronet/android/cronet_url_request_context_adapter.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 if (config->enable_sdch) { | 477 if (config->enable_sdch) { |
478 DCHECK(context_->sdch_manager()); | 478 DCHECK(context_->sdch_manager()); |
479 sdch_owner_.reset( | 479 sdch_owner_.reset( |
480 new net::SdchOwner(context_->sdch_manager(), context_.get())); | 480 new net::SdchOwner(context_->sdch_manager(), context_.get())); |
481 if (json_pref_store_) { | 481 if (json_pref_store_) { |
482 sdch_owner_->EnablePersistentStorage( | 482 sdch_owner_->EnablePersistentStorage( |
483 make_scoped_ptr(new SdchOwnerPrefStorage(json_pref_store_.get()))); | 483 make_scoped_ptr(new SdchOwnerPrefStorage(json_pref_store_.get()))); |
484 } | 484 } |
485 } | 485 } |
486 | 486 |
487 // Currently (circa M39) enabling QUIC requires setting probability threshold. | |
488 if (config->enable_quic) { | 487 if (config->enable_quic) { |
489 context_->http_server_properties() | |
490 ->SetAlternativeServiceProbabilityThreshold(0.0f); | |
491 for (auto hint = config->quic_hints.begin(); | 488 for (auto hint = config->quic_hints.begin(); |
492 hint != config->quic_hints.end(); ++hint) { | 489 hint != config->quic_hints.end(); ++hint) { |
493 const URLRequestContextConfig::QuicHint& quic_hint = **hint; | 490 const URLRequestContextConfig::QuicHint& quic_hint = **hint; |
494 if (quic_hint.host.empty()) { | 491 if (quic_hint.host.empty()) { |
495 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; | 492 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; |
496 continue; | 493 continue; |
497 } | 494 } |
498 | 495 |
499 url::CanonHostInfo host_info; | 496 url::CanonHostInfo host_info; |
500 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); | 497 std::string canon_host(net::CanonicalizeHost(quic_hint.host, &host_info)); |
(...skipping 16 matching lines...) Expand all Loading... |
517 << quic_hint.alternate_port; | 514 << quic_hint.alternate_port; |
518 continue; | 515 continue; |
519 } | 516 } |
520 | 517 |
521 net::HostPortPair quic_hint_host_port_pair(canon_host, | 518 net::HostPortPair quic_hint_host_port_pair(canon_host, |
522 quic_hint.port); | 519 quic_hint.port); |
523 net::AlternativeService alternative_service( | 520 net::AlternativeService alternative_service( |
524 net::AlternateProtocol::QUIC, "", | 521 net::AlternateProtocol::QUIC, "", |
525 static_cast<uint16_t>(quic_hint.alternate_port)); | 522 static_cast<uint16_t>(quic_hint.alternate_port)); |
526 context_->http_server_properties()->SetAlternativeService( | 523 context_->http_server_properties()->SetAlternativeService( |
527 quic_hint_host_port_pair, alternative_service, 1.0f, | 524 quic_hint_host_port_pair, alternative_service, base::Time::Max()); |
528 base::Time::Max()); | |
529 } | 525 } |
530 } | 526 } |
531 | 527 |
532 // Iterate through PKP configuration for every host. | 528 // Iterate through PKP configuration for every host. |
533 for (const auto& pkp : config->pkp_list) { | 529 for (const auto& pkp : config->pkp_list) { |
534 // Add the host pinning. | 530 // Add the host pinning. |
535 context_->transport_security_state()->AddHPKP( | 531 context_->transport_security_state()->AddHPKP( |
536 pkp->host, pkp->expiration_date, pkp->include_subdomains, | 532 pkp->host, pkp->expiration_date, pkp->include_subdomains, |
537 pkp->pin_hashes, GURL::EmptyGURL()); | 533 pkp->pin_hashes, GURL::EmptyGURL()); |
538 } | 534 } |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 JNIEnv* env, | 799 JNIEnv* env, |
804 const JavaParamRef<jclass>& jcaller) { | 800 const JavaParamRef<jclass>& jcaller) { |
805 base::StatisticsRecorder::Initialize(); | 801 base::StatisticsRecorder::Initialize(); |
806 std::vector<uint8_t> data; | 802 std::vector<uint8_t> data; |
807 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 803 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
808 return ScopedJavaLocalRef<jbyteArray>(); | 804 return ScopedJavaLocalRef<jbyteArray>(); |
809 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 805 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
810 } | 806 } |
811 | 807 |
812 } // namespace cronet | 808 } // namespace cronet |
OLD | NEW |