| Index: net/base/sdch_manager.h
|
| diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h
|
| index 93f8a74b61bcf71d0fab24b8e7a395f573929fa1..05c8ce7a2db3f0d15631bbdbdac82d954ca4cb26 100644
|
| --- a/net/base/sdch_manager.h
|
| +++ b/net/base/sdch_manager.h
|
| @@ -2,15 +2,13 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// This file contains the SdchManager class and two nested classes
|
| -// (Dictionary, DictionarySet). SdchManager::Dictionary contains all
|
| -// of the information about an SDCH dictionary. The manager is
|
| -// responsible for storing those dictionaries, and provides access to
|
| -// them through DictionarySet objects. A DictionarySet is an object
|
| -// whose lifetime is under the control of the consumer. It is a
|
| -// reference to a set of dictionaries, and guarantees that none of
|
| -// those dictionaries will be destroyed while the DictionarySet
|
| -// reference is alive.
|
| +// This file contains the SdchManager class and the DictionarySet
|
| +// nested class. The manager is responsible for storing all
|
| +// SdchDictionarys, and provides access to them through DictionarySet
|
| +// objects. A DictionarySet is an object whose lifetime is under the
|
| +// control of the consumer. It is a reference to a set of
|
| +// dictionaries, and guarantees that none of those dictionaries will
|
| +// be destroyed while the DictionarySet reference is alive.
|
|
|
| #ifndef NET_BASE_SDCH_MANAGER_H_
|
| #define NET_BASE_SDCH_MANAGER_H_
|
| @@ -26,13 +24,13 @@
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/observer_list.h"
|
| #include "base/threading/thread_checker.h"
|
| -#include "base/time/time.h"
|
| #include "net/base/net_export.h"
|
| +#include "net/base/sdch_dictionary.h"
|
| #include "net/base/sdch_problem_codes.h"
|
| -#include "url/gurl.h"
|
| +
|
| +class GURL;
|
|
|
| namespace base {
|
| -class Clock;
|
| class Value;
|
| }
|
|
|
| @@ -56,97 +54,10 @@ class SdchObserver;
|
| // a DictionarySet object refers to it; see below.
|
| class NET_EXPORT SdchManager {
|
| public:
|
| - class Dictionary;
|
| - typedef std::map<std::string, scoped_refptr<base::RefCountedData<Dictionary>>>
|
| + typedef std::map<std::string,
|
| + scoped_refptr<base::RefCountedData<SdchDictionary>>>
|
| DictionaryMap;
|
|
|
| - class NET_EXPORT_PRIVATE Dictionary {
|
| - public:
|
| - // Construct a vc-diff usable dictionary from the dictionary_text starting
|
| - // at the given offset. The supplied client_hash should be used to
|
| - // advertise the dictionary's availability relative to the suppplied URL.
|
| - Dictionary(const std::string& dictionary_text,
|
| - size_t offset,
|
| - const std::string& client_hash,
|
| - const std::string& server_hash,
|
| - const GURL& url,
|
| - const std::string& domain,
|
| - const std::string& path,
|
| - const base::Time& expiration,
|
| - const std::set<int>& ports);
|
| -
|
| - ~Dictionary();
|
| -
|
| - // Sdch filters can get our text to use in decoding compressed data.
|
| - const std::string& text() const { return text_; }
|
| -
|
| - const GURL& url() const { return url_; }
|
| - const std::string& client_hash() const { return client_hash_; }
|
| - const std::string& server_hash() const { return server_hash_; }
|
| - const std::string& domain() const { return domain_; }
|
| - const std::string& path() const { return path_; }
|
| - const base::Time& expiration() const { return expiration_; }
|
| - const std::set<int>& ports() const { return ports_; }
|
| -
|
| - // Security methods to check if we can establish a new dictionary with the
|
| - // given data, that arrived in response to get of dictionary_url.
|
| - static SdchProblemCode CanSet(const std::string& domain,
|
| - const std::string& path,
|
| - const std::set<int>& ports,
|
| - const GURL& dictionary_url);
|
| -
|
| - // Security method to check if we can use a dictionary to decompress a
|
| - // target that arrived with a reference to this dictionary.
|
| - SdchProblemCode CanUse(const GURL& referring_url) const;
|
| -
|
| - // Compare paths to see if they "match" for dictionary use.
|
| - static bool PathMatch(const std::string& path,
|
| - const std::string& restriction);
|
| -
|
| - // Compare domains to see if the "match" for dictionary use.
|
| - static bool DomainMatch(const GURL& url, const std::string& restriction);
|
| -
|
| - // Is this dictionary expired?
|
| - bool Expired() const;
|
| -
|
| - void SetClockForTesting(scoped_ptr<base::Clock> clock);
|
| -
|
| - private:
|
| - friend class base::RefCountedData<Dictionary>;
|
| -
|
| - // Private copy-constructor to support RefCountedData<>, which requires
|
| - // that an object stored in it be either DefaultConstructible or
|
| - // CopyConstructible
|
| - Dictionary(const Dictionary& rhs);
|
| -
|
| - // The actual text of the dictionary.
|
| - std::string text_;
|
| -
|
| - // Part of the hash of text_ that the client uses to advertise the fact that
|
| - // it has a specific dictionary pre-cached.
|
| - std::string client_hash_;
|
| -
|
| - // Part of the hash of text_ that the server uses to identify the
|
| - // dictionary it wants used for decoding.
|
| - std::string server_hash_;
|
| -
|
| - // The GURL that arrived with the text_ in a URL request to specify where
|
| - // this dictionary may be used.
|
| - const GURL url_;
|
| -
|
| - // Metadate "headers" in before dictionary text contained the following:
|
| - // Each dictionary payload consists of several headers, followed by the text
|
| - // of the dictionary. The following are the known headers.
|
| - const std::string domain_;
|
| - const std::string path_;
|
| - const base::Time expiration_; // Implied by max-age.
|
| - const std::set<int> ports_;
|
| -
|
| - scoped_ptr<base::Clock> clock_;
|
| -
|
| - void operator=(const Dictionary&) = delete;
|
| - };
|
| -
|
| // A handle for one or more dictionaries which will keep the dictionaries
|
| // alive and accessible for the handle's lifetime.
|
| class NET_EXPORT_PRIVATE DictionarySet {
|
| @@ -160,7 +71,7 @@ class NET_EXPORT SdchManager {
|
| // is guaranteed to be valid for the lifetime of the DictionarySet.
|
| // Returns NULL if hash is not a valid server hash for a dictionary
|
| // named by DictionarySet.
|
| - const SdchManager::Dictionary* GetDictionary(const std::string& hash) const;
|
| + const SdchDictionary* GetDictionary(const std::string& hash) const;
|
|
|
| bool Empty() const;
|
|
|
| @@ -169,9 +80,9 @@ class NET_EXPORT SdchManager {
|
| friend class SdchManager;
|
|
|
| DictionarySet();
|
| - void AddDictionary(const std::string& server_hash,
|
| - const scoped_refptr<base::RefCountedData<
|
| - SdchManager::Dictionary>>& dictionary);
|
| + void AddDictionary(
|
| + const std::string& server_hash,
|
| + const scoped_refptr<base::RefCountedData<SdchDictionary>>& dictionary);
|
|
|
| DictionaryMap dictionaries_;
|
|
|
|
|