| Index: chrome/browser/net/spdyproxy/data_reduction_proxy_settings.h
|
| diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings.h b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings.h
|
| index f066d661713d4b39fbef8b3e680667d43f6546dc..b4c39a57521495f71f2204bca156cde315028881 100644
|
| --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings.h
|
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings.h
|
| @@ -18,6 +18,10 @@
|
| class PrefService;
|
|
|
| namespace net {
|
| +class AuthChallengeInfo;
|
| +class HostPortPair;
|
| +class HttpAuthCache;
|
| +class HttpNetworkSession;
|
| class URLFetcher;
|
| }
|
|
|
| @@ -42,12 +46,17 @@ class DataReductionProxySettings
|
| public net::NetworkChangeNotifier::IPAddressObserver {
|
| public:
|
| typedef std::vector<long long> ContentLengthList;
|
| + typedef std::vector<GURL> DataReductionProxyList;
|
|
|
| DataReductionProxySettings();
|
| virtual ~DataReductionProxySettings();
|
|
|
| void InitDataReductionProxySettings();
|
|
|
| + // If proxy authentication is compiled in, pre-cache authentication
|
| + // keys for all configured proxies in |session|.
|
| + void InitDataReductionProxySession(net::HttpNetworkSession* session);
|
| +
|
| // Add a host pattern to bypass. This should follow the same syntax used
|
| // in net::ProxyBypassRules; that is, a hostname pattern, a hostname suffix
|
| // pattern, an IP literal, a CIDR block, or the magic string '<local>'.
|
| @@ -75,8 +84,20 @@ class DataReductionProxySettings
|
| // Returns the URL of the data reduction proxy.
|
| std::string GetDataReductionProxyOrigin();
|
|
|
| - // Returns a configuration string for the proxy.
|
| - std::string GetDataReductionProxyAuth();
|
| + // Returns the URL of the fallback data reduction proxy.
|
| + std::string GetDataReductionProxyFallback();
|
| +
|
| + // Returns a vector of HostPortPairs for all configured proxies.
|
| + DataReductionProxyList GetDataReductionProxies();
|
| +
|
| + // Returns true if |auth_info| represents an authentication challenge from
|
| + // a compatible, configured proxy.
|
| + bool IsAcceptableAuthChallenge(net::AuthChallengeInfo* auth_info);
|
| +
|
| + // Returns a UTF16 string suitable for use as an authentication token in
|
| + // response to the challenge represented by |auth_info|. If the token can't
|
| + // be correctly generated for |auth_info|, returns an empty UTF16 string.
|
| + base::string16 GetTokenForAuthChallenge(net::AuthChallengeInfo* auth_info);
|
|
|
| // Returns true if the proxy is enabled.
|
| bool IsDataReductionProxyEnabled();
|
| @@ -107,14 +128,13 @@ class DataReductionProxySettings
|
|
|
| protected:
|
| void InitPrefMembers();
|
| +
|
| virtual net::URLFetcher* GetURLFetcher();
|
|
|
| // Virtualized for unit test support.
|
| virtual PrefService* GetOriginalProfilePrefs();
|
| virtual PrefService* GetLocalStatePrefs();
|
|
|
| - std::string GetDataReductionProxyOriginHostPort();
|
| -
|
| bool IsProxyOriginSetOnCommandLine();
|
| void GetContentLengths(unsigned int days,
|
| int64* original_content_length,
|
| @@ -146,10 +166,20 @@ class DataReductionProxySettings
|
| // Accessor for unit tests.
|
| std::vector<std::string> BypassRules() { return bypass_rules_;}
|
|
|
| + // Accessors for default hostnames, virtual for testing.
|
| + virtual std::string GetDefaultProxyHost();
|
| + virtual std::string GetDefaultFallbackProxyHost();
|
| +
|
| private:
|
| friend class DataReductionProxySettingsTestBase;
|
| friend class DataReductionProxySettingsTest;
|
| FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
|
| + TestAuthenticationInit);
|
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
|
| + TestAuthHashGeneration);
|
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
|
| + TestAuthHashGenerationWithOriginSetViaSwitch);
|
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
|
| TestResetDataReductionStatistics);
|
| FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest,
|
| TestIsProxyEnabledOrManaged);
|
| @@ -173,6 +203,10 @@ class DataReductionProxySettings
|
| // NetworkChangeNotifier::IPAddressObserver:
|
| virtual void OnIPAddressChanged() OVERRIDE;
|
|
|
| + // Underlying implementation of InitDataReductionProxySession(), factored
|
| + // out to be testable without creating a full HttpNetworkSession.
|
| + void InitDataReductionAuthentication(net::HttpAuthCache* auth_cache);
|
| +
|
| void OnProxyEnabledPrefChange();
|
|
|
| void ResetDataReductionStatistics();
|
| @@ -185,6 +219,11 @@ class DataReductionProxySettings
|
| void ProbeWhetherDataReductionProxyIsAvailable();
|
| std::string GetProxyCheckURL();
|
|
|
| + // Returns a UTF16 string that's the hash of the configured authentication
|
| + // key and |salt|. Returns an empty UTF16 string if no key is configured or
|
| + // the data reduction proxy feature isn't available.
|
| + base::string16 AuthHashForSalt(int64 salt);
|
| +
|
| std::vector<std::string> bypass_rules_;
|
|
|
| // Indicate whether a user has turned on the data reduction proxy previously
|
|
|