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 bool SdchManager::g_sdch_enabled_ = true; | |
55 | |
56 // static | |
57 #if defined(OS_IOS) | 54 #if defined(OS_IOS) |
58 // Workaround for http://crbug.com/418975; remove when fixed. | 55 // Workaround for http://crbug.com/418975; remove when fixed. |
59 bool SdchManager::g_secure_scheme_supported_ = false; | 56 bool SdchManager::g_sdch_enabled_ = false; |
60 #else | 57 #else |
| 58 bool SdchManager::g_sdch_enabled_ = true; |
| 59 #endif |
| 60 |
| 61 // static |
61 bool SdchManager::g_secure_scheme_supported_ = true; | 62 bool SdchManager::g_secure_scheme_supported_ = true; |
62 #endif | |
63 | 63 |
64 //------------------------------------------------------------------------------ | 64 //------------------------------------------------------------------------------ |
65 SdchManager::Dictionary::Dictionary(const std::string& dictionary_text, | 65 SdchManager::Dictionary::Dictionary(const std::string& dictionary_text, |
66 size_t offset, | 66 size_t offset, |
67 const std::string& client_hash, | 67 const std::string& client_hash, |
68 const GURL& gurl, | 68 const GURL& gurl, |
69 const std::string& domain, | 69 const std::string& domain, |
70 const std::string& path, | 70 const std::string& path, |
71 const base::Time& expiration, | 71 const base::Time& expiration, |
72 const std::set<int>& ports) | 72 const std::set<int>& ports) |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 void SdchManager::UrlSafeBase64Encode(const std::string& input, | 614 void SdchManager::UrlSafeBase64Encode(const std::string& input, |
615 std::string* output) { | 615 std::string* output) { |
616 // Since this is only done during a dictionary load, and hashes are only 8 | 616 // 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. | 617 // characters, we just do the simple fixup, rather than rewriting the encoder. |
618 base::Base64Encode(input, output); | 618 base::Base64Encode(input, output); |
619 std::replace(output->begin(), output->end(), '+', '-'); | 619 std::replace(output->begin(), output->end(), '+', '-'); |
620 std::replace(output->begin(), output->end(), '/', '_'); | 620 std::replace(output->begin(), output->end(), '/', '_'); |
621 } | 621 } |
622 | 622 |
623 } // namespace net | 623 } // namespace net |
OLD | NEW |