OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/base64.h" |
5 #include "base/field_trial.h" | 6 #include "base/field_trial.h" |
6 #include "base/histogram.h" | 7 #include "base/histogram.h" |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 #include "base/sha2.h" | 9 #include "base/sha2.h" |
9 #include "base/string_util.h" | 10 #include "base/string_util.h" |
10 #include "net/base/base64.h" | |
11 #include "net/base/registry_controlled_domain.h" | 11 #include "net/base/registry_controlled_domain.h" |
12 #include "net/base/sdch_manager.h" | 12 #include "net/base/sdch_manager.h" |
13 #include "net/url_request/url_request_http_job.h" | 13 #include "net/url_request/url_request_http_job.h" |
14 | 14 |
15 using base::Time; | 15 using base::Time; |
16 using base::TimeDelta; | 16 using base::TimeDelta; |
17 | 17 |
18 //------------------------------------------------------------------------------ | 18 //------------------------------------------------------------------------------ |
19 // static | 19 // static |
20 const size_t SdchManager::kMaxDictionarySize = 1000000; | 20 const size_t SdchManager::kMaxDictionarySize = 1000000; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 DCHECK_EQ(server_hash->length(), 8u); | 343 DCHECK_EQ(server_hash->length(), 8u); |
344 DCHECK_EQ(client_hash->length(), 8u); | 344 DCHECK_EQ(client_hash->length(), 8u); |
345 } | 345 } |
346 | 346 |
347 // static | 347 // static |
348 void SdchManager::UrlSafeBase64Encode(const std::string& input, | 348 void SdchManager::UrlSafeBase64Encode(const std::string& input, |
349 std::string* output) { | 349 std::string* output) { |
350 // Since this is only done during a dictionary load, and hashes are only 8 | 350 // Since this is only done during a dictionary load, and hashes are only 8 |
351 // characters, we just do the simple fixup, rather than rewriting the encoder. | 351 // characters, we just do the simple fixup, rather than rewriting the encoder. |
352 net::Base64Encode(input, output); | 352 base::Base64Encode(input, output); |
353 for (size_t i = 0; i < output->size(); ++i) { | 353 for (size_t i = 0; i < output->size(); ++i) { |
354 switch (output->data()[i]) { | 354 switch (output->data()[i]) { |
355 case '+': | 355 case '+': |
356 (*output)[i] = '-'; | 356 (*output)[i] = '-'; |
357 continue; | 357 continue; |
358 case '/': | 358 case '/': |
359 (*output)[i] = '_'; | 359 (*output)[i] = '_'; |
360 continue; | 360 continue; |
361 default: | 361 default: |
362 continue; | 362 continue; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 if (enable) { | 531 if (enable) { |
532 allow_latency_experiment_.insert(url.host()); | 532 allow_latency_experiment_.insert(url.host()); |
533 return; | 533 return; |
534 } | 534 } |
535 ExperimentSet::iterator it = allow_latency_experiment_.find(url.host()); | 535 ExperimentSet::iterator it = allow_latency_experiment_.find(url.host()); |
536 if (allow_latency_experiment_.end() == it) | 536 if (allow_latency_experiment_.end() == it) |
537 return; // It was already erased, or never allowed. | 537 return; // It was already erased, or never allowed. |
538 SdchErrorRecovery(LATENCY_TEST_DISALLOWED); | 538 SdchErrorRecovery(LATENCY_TEST_DISALLOWED); |
539 allow_latency_experiment_.erase(it); | 539 allow_latency_experiment_.erase(it); |
540 } | 540 } |
OLD | NEW |