OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Provides global database of differential decompression dictionaries for the | 5 // Provides global database of differential decompression dictionaries for the |
6 // SDCH filter (processes sdch enconded content). | 6 // SDCH filter (processes sdch enconded content). |
7 | 7 |
8 // Exactly one instance of SdchManager is built, and all references are made | 8 // Exactly one instance of SdchManager is built, and all references are made |
9 // into that collection. | 9 // into that collection. |
10 // | 10 // |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 static void SdchErrorRecovery(ProblemCodes problem); | 244 static void SdchErrorRecovery(ProblemCodes problem); |
245 | 245 |
246 // Register a fetcher that this class can use to obtain dictionaries. | 246 // Register a fetcher that this class can use to obtain dictionaries. |
247 void set_sdch_fetcher(SdchFetcher* fetcher); | 247 void set_sdch_fetcher(SdchFetcher* fetcher); |
248 | 248 |
249 // Enables or disables SDCH compression. | 249 // Enables or disables SDCH compression. |
250 static void EnableSdchSupport(bool enabled); | 250 static void EnableSdchSupport(bool enabled); |
251 | 251 |
252 static bool sdch_enabled() { return g_sdch_enabled_; } | 252 static bool sdch_enabled() { return g_sdch_enabled_; } |
253 | 253 |
| 254 // Enables or disables SDCH compression over secure connection. |
| 255 static void EnableSecureSchemeSupport(bool enabled); |
| 256 |
| 257 static bool secure_scheme_supported() { return g_secure_scheme_supported_; } |
| 258 |
254 // Briefly prevent further advertising of SDCH on this domain (if SDCH is | 259 // Briefly prevent further advertising of SDCH on this domain (if SDCH is |
255 // enabled). After enough calls to IsInSupportedDomain() the blacklisting | 260 // enabled). After enough calls to IsInSupportedDomain() the blacklisting |
256 // will be removed. Additional blacklists take exponentially more calls | 261 // will be removed. Additional blacklists take exponentially more calls |
257 // to IsInSupportedDomain() before the blacklisting is undone. | 262 // to IsInSupportedDomain() before the blacklisting is undone. |
258 // Used when filter errors are found from a given domain, but it is plausible | 263 // Used when filter errors are found from a given domain, but it is plausible |
259 // that the cause is temporary (such as application startup, where cached | 264 // that the cause is temporary (such as application startup, where cached |
260 // entries are used, but a dictionary is not yet loaded). | 265 // entries are used, but a dictionary is not yet loaded). |
261 static void BlacklistDomain(const GURL& url); | 266 static void BlacklistDomain(const GURL& url); |
262 | 267 |
263 // Used when SEVERE filter errors are found from a given domain, to prevent | 268 // Used when SEVERE filter errors are found from a given domain, to prevent |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 342 |
338 // A map of dictionaries info indexed by the hash that the server provides. | 343 // A map of dictionaries info indexed by the hash that the server provides. |
339 typedef std::map<std::string, Dictionary*> DictionaryMap; | 344 typedef std::map<std::string, Dictionary*> DictionaryMap; |
340 | 345 |
341 // The one global instance of that holds all the data. | 346 // The one global instance of that holds all the data. |
342 static SdchManager* global_; | 347 static SdchManager* global_; |
343 | 348 |
344 // Support SDCH compression, by advertising in headers. | 349 // Support SDCH compression, by advertising in headers. |
345 static bool g_sdch_enabled_; | 350 static bool g_sdch_enabled_; |
346 | 351 |
| 352 // Support SDCH compression for HTTPS requests and responses. When supported, |
| 353 // HTTPS applicable dictionaries MUST have been acquired securely via HTTPS. |
| 354 static bool g_secure_scheme_supported_; |
| 355 |
347 // A simple implementation of a RFC 3548 "URL safe" base64 encoder. | 356 // A simple implementation of a RFC 3548 "URL safe" base64 encoder. |
348 static void UrlSafeBase64Encode(const std::string& input, | 357 static void UrlSafeBase64Encode(const std::string& input, |
349 std::string* output); | 358 std::string* output); |
350 DictionaryMap dictionaries_; | 359 DictionaryMap dictionaries_; |
351 | 360 |
352 // An instance that can fetch a dictionary given a URL. | 361 // An instance that can fetch a dictionary given a URL. |
353 scoped_ptr<SdchFetcher> fetcher_; | 362 scoped_ptr<SdchFetcher> fetcher_; |
354 | 363 |
355 // List domains where decode failures have required disabling sdch, along with | 364 // List domains where decode failures have required disabling sdch, along with |
356 // count of how many additonal uses should be blacklisted. | 365 // count of how many additonal uses should be blacklisted. |
357 DomainCounter blacklisted_domains_; | 366 DomainCounter blacklisted_domains_; |
358 | 367 |
359 // Support exponential backoff in number of domain accesses before | 368 // Support exponential backoff in number of domain accesses before |
360 // blacklisting expires. | 369 // blacklisting expires. |
361 DomainCounter exponential_blacklist_count; | 370 DomainCounter exponential_blacklist_count; |
362 | 371 |
363 // List of hostnames for which a latency experiment is allowed (because a | 372 // List of hostnames for which a latency experiment is allowed (because a |
364 // round trip test has recently passed). | 373 // round trip test has recently passed). |
365 ExperimentSet allow_latency_experiment_; | 374 ExperimentSet allow_latency_experiment_; |
366 | 375 |
367 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 376 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
368 }; | 377 }; |
369 | 378 |
370 } // namespace net | 379 } // namespace net |
371 | 380 |
372 #endif // NET_BASE_SDCH_MANAGER_H_ | 381 #endif // NET_BASE_SDCH_MANAGER_H_ |
OLD | NEW |