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 | |
259 // Briefly prevent further advertising of SDCH on this domain (if SDCH is | 254 // Briefly prevent further advertising of SDCH on this domain (if SDCH is |
260 // enabled). After enough calls to IsInSupportedDomain() the blacklisting | 255 // enabled). After enough calls to IsInSupportedDomain() the blacklisting |
261 // will be removed. Additional blacklists take exponentially more calls | 256 // will be removed. Additional blacklists take exponentially more calls |
262 // to IsInSupportedDomain() before the blacklisting is undone. | 257 // to IsInSupportedDomain() before the blacklisting is undone. |
263 // Used when filter errors are found from a given domain, but it is plausible | 258 // Used when filter errors are found from a given domain, but it is plausible |
264 // that the cause is temporary (such as application startup, where cached | 259 // that the cause is temporary (such as application startup, where cached |
265 // entries are used, but a dictionary is not yet loaded). | 260 // entries are used, but a dictionary is not yet loaded). |
266 static void BlacklistDomain(const GURL& url); | 261 static void BlacklistDomain(const GURL& url); |
267 | 262 |
268 // Used when SEVERE filter errors are found from a given domain, to prevent | 263 // 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... |
342 | 337 |
343 // A map of dictionaries info indexed by the hash that the server provides. | 338 // A map of dictionaries info indexed by the hash that the server provides. |
344 typedef std::map<std::string, Dictionary*> DictionaryMap; | 339 typedef std::map<std::string, Dictionary*> DictionaryMap; |
345 | 340 |
346 // The one global instance of that holds all the data. | 341 // The one global instance of that holds all the data. |
347 static SdchManager* global_; | 342 static SdchManager* global_; |
348 | 343 |
349 // Support SDCH compression, by advertising in headers. | 344 // Support SDCH compression, by advertising in headers. |
350 static bool g_sdch_enabled_; | 345 static bool g_sdch_enabled_; |
351 | 346 |
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 | |
356 // A simple implementation of a RFC 3548 "URL safe" base64 encoder. | 347 // A simple implementation of a RFC 3548 "URL safe" base64 encoder. |
357 static void UrlSafeBase64Encode(const std::string& input, | 348 static void UrlSafeBase64Encode(const std::string& input, |
358 std::string* output); | 349 std::string* output); |
359 DictionaryMap dictionaries_; | 350 DictionaryMap dictionaries_; |
360 | 351 |
361 // An instance that can fetch a dictionary given a URL. | 352 // An instance that can fetch a dictionary given a URL. |
362 scoped_ptr<SdchFetcher> fetcher_; | 353 scoped_ptr<SdchFetcher> fetcher_; |
363 | 354 |
364 // List domains where decode failures have required disabling sdch, along with | 355 // List domains where decode failures have required disabling sdch, along with |
365 // count of how many additonal uses should be blacklisted. | 356 // count of how many additonal uses should be blacklisted. |
366 DomainCounter blacklisted_domains_; | 357 DomainCounter blacklisted_domains_; |
367 | 358 |
368 // Support exponential backoff in number of domain accesses before | 359 // Support exponential backoff in number of domain accesses before |
369 // blacklisting expires. | 360 // blacklisting expires. |
370 DomainCounter exponential_blacklist_count; | 361 DomainCounter exponential_blacklist_count; |
371 | 362 |
372 // List of hostnames for which a latency experiment is allowed (because a | 363 // List of hostnames for which a latency experiment is allowed (because a |
373 // round trip test has recently passed). | 364 // round trip test has recently passed). |
374 ExperimentSet allow_latency_experiment_; | 365 ExperimentSet allow_latency_experiment_; |
375 | 366 |
376 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 367 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
377 }; | 368 }; |
378 | 369 |
379 } // namespace net | 370 } // namespace net |
380 | 371 |
381 #endif // NET_BASE_SDCH_MANAGER_H_ | 372 #endif // NET_BASE_SDCH_MANAGER_H_ |
OLD | NEW |