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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // of the dictionary. The following are the known headers. | 230 // of the dictionary. The following are the known headers. |
231 const std::string domain_; | 231 const std::string domain_; |
232 const std::string path_; | 232 const std::string path_; |
233 const base::Time expiration_; // Implied by max-age. | 233 const base::Time expiration_; // Implied by max-age. |
234 const std::set<int> ports_; | 234 const std::set<int> ports_; |
235 | 235 |
236 DISALLOW_COPY_AND_ASSIGN(Dictionary); | 236 DISALLOW_COPY_AND_ASSIGN(Dictionary); |
237 }; | 237 }; |
238 | 238 |
239 SdchManager(); | 239 SdchManager(); |
240 ~SdchManager(); | 240 virtual ~SdchManager(); |
241 | 241 |
242 // Clear data (for browser data removal). | 242 // Clear data (for browser data removal). |
243 void ClearData(); | 243 void ClearData(); |
244 | 244 |
245 // Record stats on various errors. | 245 // Record stats on various errors. |
246 static void SdchErrorRecovery(ProblemCodes problem); | 246 static void SdchErrorRecovery(ProblemCodes problem); |
247 | 247 |
248 // Register a fetcher that this class can use to obtain dictionaries. | 248 // Register a fetcher that this class can use to obtain dictionaries. |
249 void set_sdch_fetcher(scoped_ptr<SdchFetcher> fetcher); | 249 void set_sdch_fetcher(scoped_ptr<SdchFetcher> fetcher); |
250 | 250 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 void FetchDictionary(const GURL& request_url, const GURL& dictionary_url); | 297 void FetchDictionary(const GURL& request_url, const GURL& dictionary_url); |
298 | 298 |
299 // Security test function used before initiating a FetchDictionary. | 299 // Security test function used before initiating a FetchDictionary. |
300 // Return true if fetch is legal. | 300 // Return true if fetch is legal. |
301 bool CanFetchDictionary(const GURL& referring_url, | 301 bool CanFetchDictionary(const GURL& referring_url, |
302 const GURL& dictionary_url) const; | 302 const GURL& dictionary_url) const; |
303 | 303 |
304 // Add an SDCH dictionary to our list of availible dictionaries. This addition | 304 // Add an SDCH dictionary to our list of availible dictionaries. This addition |
305 // will fail (return false) if addition is illegal (data in the dictionary is | 305 // will fail (return false) if addition is illegal (data in the dictionary is |
306 // not acceptable from the dictionary_url; dictionary already added, etc.). | 306 // not acceptable from the dictionary_url; dictionary already added, etc.). |
307 bool AddSdchDictionary(const std::string& dictionary_text, | 307 // virtual for testing. |
308 const GURL& dictionary_url); | 308 virtual bool AddSdchDictionary(const std::string& dictionary_text, |
| 309 const GURL& dictionary_url); |
309 | 310 |
310 // Find the vcdiff dictionary (the body of the sdch dictionary that appears | 311 // Find the vcdiff dictionary (the body of the sdch dictionary that appears |
311 // after the meta-data headers like Domain:...) with the given |server_hash| | 312 // after the meta-data headers like Domain:...) with the given |server_hash| |
312 // to use to decompreses data that arrived as SDCH encoded content. Check to | 313 // to use to decompreses data that arrived as SDCH encoded content. Check to |
313 // be sure the returned |dictionary| can be used for decoding content supplied | 314 // be sure the returned |dictionary| can be used for decoding content supplied |
314 // in response to a request for |referring_url|. | 315 // in response to a request for |referring_url|. |
315 // Return null in |dictionary| if there is no matching legal dictionary. | 316 // Return null in |dictionary| if there is no matching legal dictionary. |
316 void GetVcdiffDictionary(const std::string& server_hash, | 317 void GetVcdiffDictionary(const std::string& server_hash, |
317 const GURL& referring_url, | 318 const GURL& referring_url, |
318 scoped_refptr<Dictionary>* dictionary); | 319 scoped_refptr<Dictionary>* dictionary); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 ExperimentSet allow_latency_experiment_; | 382 ExperimentSet allow_latency_experiment_; |
382 | 383 |
383 int fetches_count_for_testing_; | 384 int fetches_count_for_testing_; |
384 | 385 |
385 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 386 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
386 }; | 387 }; |
387 | 388 |
388 } // namespace net | 389 } // namespace net |
389 | 390 |
390 #endif // NET_BASE_SDCH_MANAGER_H_ | 391 #endif // NET_BASE_SDCH_MANAGER_H_ |
OLD | NEW |