| OLD | NEW |
| 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 #include "net/base/sdch_manager.h" | 5 #include "net/base/sdch_manager.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // static | 44 // static |
| 45 const size_t SdchManager::kMaxDictionaryCount = 1; | 45 const size_t SdchManager::kMaxDictionaryCount = 1; |
| 46 const size_t SdchManager::kMaxDictionarySize = 500 * 1000; | 46 const size_t SdchManager::kMaxDictionarySize = 500 * 1000; |
| 47 #else | 47 #else |
| 48 // static | 48 // static |
| 49 const size_t SdchManager::kMaxDictionaryCount = 20; | 49 const size_t SdchManager::kMaxDictionaryCount = 20; |
| 50 const size_t SdchManager::kMaxDictionarySize = 1000 * 1000; | 50 const size_t SdchManager::kMaxDictionarySize = 1000 * 1000; |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 // static | 53 // static |
| 54 #if defined(OS_IOS) | |
| 55 // Workaround for http://crbug.com/418975; remove when fixed. | |
| 56 bool SdchManager::g_sdch_enabled_ = false; | |
| 57 #else | |
| 58 bool SdchManager::g_sdch_enabled_ = true; | 54 bool SdchManager::g_sdch_enabled_ = true; |
| 59 #endif | |
| 60 | 55 |
| 61 // static | 56 // static |
| 62 bool SdchManager::g_secure_scheme_supported_ = true; | 57 bool SdchManager::g_secure_scheme_supported_ = true; |
| 63 | 58 |
| 64 //------------------------------------------------------------------------------ | 59 //------------------------------------------------------------------------------ |
| 65 SdchManager::Dictionary::Dictionary(const std::string& dictionary_text, | 60 SdchManager::Dictionary::Dictionary(const std::string& dictionary_text, |
| 66 size_t offset, | 61 size_t offset, |
| 67 const std::string& client_hash, | 62 const std::string& client_hash, |
| 68 const GURL& gurl, | 63 const GURL& gurl, |
| 69 const std::string& domain, | 64 const std::string& domain, |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 void SdchManager::UrlSafeBase64Encode(const std::string& input, | 609 void SdchManager::UrlSafeBase64Encode(const std::string& input, |
| 615 std::string* output) { | 610 std::string* output) { |
| 616 // Since this is only done during a dictionary load, and hashes are only 8 | 611 // Since this is only done during a dictionary load, and hashes are only 8 |
| 617 // characters, we just do the simple fixup, rather than rewriting the encoder. | 612 // characters, we just do the simple fixup, rather than rewriting the encoder. |
| 618 base::Base64Encode(input, output); | 613 base::Base64Encode(input, output); |
| 619 std::replace(output->begin(), output->end(), '+', '-'); | 614 std::replace(output->begin(), output->end(), '+', '-'); |
| 620 std::replace(output->begin(), output->end(), '/', '_'); | 615 std::replace(output->begin(), output->end(), '/', '_'); |
| 621 } | 616 } |
| 622 | 617 |
| 623 } // namespace net | 618 } // namespace net |
| OLD | NEW |