Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: net/base/sdch_manager.h

Issue 6347033: net: Add namespace net to Sdch* classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: namespace on unittest Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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 //
11 // The SdchManager maintains a collection of memory resident dictionaries. It 11 // The SdchManager maintains a collection of memory resident dictionaries. It
(...skipping 12 matching lines...) Expand all
24 #include <map> 24 #include <map>
25 #include <set> 25 #include <set>
26 #include <string> 26 #include <string>
27 27
28 #include "base/gtest_prod_util.h" 28 #include "base/gtest_prod_util.h"
29 #include "base/ref_counted.h" 29 #include "base/ref_counted.h"
30 #include "base/scoped_ptr.h" 30 #include "base/scoped_ptr.h"
31 #include "base/time.h" 31 #include "base/time.h"
32 #include "googleurl/src/gurl.h" 32 #include "googleurl/src/gurl.h"
33 33
34 namespace net {
35
34 //------------------------------------------------------------------------------ 36 //------------------------------------------------------------------------------
35 // Create a public interface to help us load SDCH dictionaries. 37 // Create a public interface to help us load SDCH dictionaries.
36 // The SdchManager class allows registration to support this interface. 38 // The SdchManager class allows registration to support this interface.
37 // A browser may register a fetcher that is used by the dictionary managers to 39 // A browser may register a fetcher that is used by the dictionary managers to
38 // get data from a specified URL. This allows us to use very high level browser 40 // get data from a specified URL. This allows us to use very high level browser
39 // functionality in this base (when the functionaity can be provided). 41 // functionality in this base (when the functionaity can be provided).
40 class SdchFetcher { 42 class SdchFetcher {
41 public: 43 public:
42 SdchFetcher() {} 44 SdchFetcher() {}
43 virtual ~SdchFetcher() {} 45 virtual ~SdchFetcher() {}
44 46
45 // The Schedule() method is called when there is a need to get a dictionary 47 // The Schedule() method is called when there is a need to get a dictionary
46 // from a server. The callee is responsible for getting that dictionary_text, 48 // from a server. The callee is responsible for getting that dictionary_text,
47 // and then calling back to AddSdchDictionary() to the SdchManager instance. 49 // and then calling back to AddSdchDictionary() to the SdchManager instance.
48 virtual void Schedule(const GURL& dictionary_url) = 0; 50 virtual void Schedule(const GURL& dictionary_url) = 0;
49 private: 51 private:
50 DISALLOW_COPY_AND_ASSIGN(SdchFetcher); 52 DISALLOW_COPY_AND_ASSIGN(SdchFetcher);
51 }; 53 };
54
52 //------------------------------------------------------------------------------ 55 //------------------------------------------------------------------------------
53 56
54 class SdchManager { 57 class SdchManager {
55 public: 58 public:
56 // A list of errors that appeared and were either resolved, or used to turn 59 // A list of errors that appeared and were either resolved, or used to turn
57 // off sdch encoding. 60 // off sdch encoding.
58 enum ProblemCodes { 61 enum ProblemCodes {
59 MIN_PROBLEM_CODE, 62 MIN_PROBLEM_CODE,
60 63
61 // Content-encoding correction problems. 64 // Content-encoding correction problems.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 const std::string& text() const { return text_; } 167 const std::string& text() const { return text_; }
165 168
166 private: 169 private:
167 friend class base::RefCounted<Dictionary>; 170 friend class base::RefCounted<Dictionary>;
168 friend class SdchManager; // Only manager can construct an instance. 171 friend class SdchManager; // Only manager can construct an instance.
169 FRIEND_TEST_ALL_PREFIXES(SdchFilterTest, PathMatch); 172 FRIEND_TEST_ALL_PREFIXES(SdchFilterTest, PathMatch);
170 173
171 // Construct a vc-diff usable dictionary from the dictionary_text starting 174 // Construct a vc-diff usable dictionary from the dictionary_text starting
172 // at the given offset. The supplied client_hash should be used to 175 // at the given offset. The supplied client_hash should be used to
173 // advertise the dictionary's availability relative to the suppplied URL. 176 // advertise the dictionary's availability relative to the suppplied URL.
174 Dictionary(const std::string& dictionary_text, size_t offset, 177 Dictionary(const std::string& dictionary_text,
175 const std::string& client_hash, const GURL& url, 178 size_t offset,
176 const std::string& domain, const std::string& path, 179 const std::string& client_hash,
177 const base::Time& expiration, const std::set<int> ports); 180 const GURL& url,
181 const std::string& domain,
182 const std::string& path,
183 const base::Time& expiration,
184 const std::set<int>& ports);
178 ~Dictionary(); 185 ~Dictionary();
179 186
180 const GURL& url() const { return url_; } 187 const GURL& url() const { return url_; }
181 const std::string& client_hash() const { return client_hash_; } 188 const std::string& client_hash() const { return client_hash_; }
182 189
183 // Security method to check if we can advertise this dictionary for use 190 // Security method to check if we can advertise this dictionary for use
184 // if the |target_url| returns SDCH compressed data. 191 // if the |target_url| returns SDCH compressed data.
185 bool CanAdvertise(const GURL& target_url); 192 bool CanAdvertise(const GURL& target_url);
186 193
187 // Security methods to check if we can establish a new dictionary with the 194 // Security methods to check if we can establish a new dictionary with the
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // blacklisting expires. 365 // blacklisting expires.
359 DomainCounter exponential_blacklist_count; 366 DomainCounter exponential_blacklist_count;
360 367
361 // List of hostnames for which a latency experiment is allowed (because a 368 // List of hostnames for which a latency experiment is allowed (because a
362 // round trip test has recently passed). 369 // round trip test has recently passed).
363 ExperimentSet allow_latency_experiment_; 370 ExperimentSet allow_latency_experiment_;
364 371
365 DISALLOW_COPY_AND_ASSIGN(SdchManager); 372 DISALLOW_COPY_AND_ASSIGN(SdchManager);
366 }; 373 };
367 374
375 } // namespace net
376
368 #endif // NET_BASE_SDCH_MANAGER_H_ 377 #endif // NET_BASE_SDCH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698