Support for unpacked ARM packed relocations.
[chromium-blink-merge.git] / components / data_reduction_proxy / browser / http_auth_handler_data_reduction_proxy.h
blob3db5dc246291a885cfdfd5cfb4baad4b1dce4eb0
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_HTTP_AUTH_HANDLER_DATA_REDUCTION_PROXY_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_HTTP_AUTH_HANDLER_DATA_REDUCTION_PROXY_H_
8 #include <string>
9 #include <vector>
11 #include "base/gtest_prod_util.h"
12 #include "net/http/http_auth_handler.h"
13 #include "net/http/http_auth_handler_factory.h"
15 namespace data_reduction_proxy {
17 // Code for handling http SpdyProxy authentication.
18 class HttpAuthHandlerDataReductionProxy : public net::HttpAuthHandler {
19 public:
20 // Returns the data reduction proxy auth scheme.
21 static std::string Scheme();
23 class Factory : public net::HttpAuthHandlerFactory {
24 public:
25 // Constructs a new spdyproxy handler factory which mints handlers that
26 // respond to challenges only from the given |authorized_spdyproxy_origins|.
27 explicit Factory(const std::vector<GURL>& authorized_spdyproxy_origins);
28 virtual ~Factory();
30 virtual int CreateAuthHandler(
31 net::HttpAuthChallengeTokenizer* challenge,
32 net::HttpAuth::Target target,
33 const GURL& origin,
34 CreateReason reason,
35 int digest_nonce_count,
36 const net::BoundNetLog& net_log,
37 scoped_ptr<HttpAuthHandler>* handler) OVERRIDE;
39 private:
40 // The origins for which Chrome will respond to SpdyProxy auth challenges.
41 std::vector<GURL> authorized_spdyproxy_origins_;
44 // Constructs a new spdyproxy handler.
45 HttpAuthHandlerDataReductionProxy() {}
47 // Overrides from net::HttpAuthHandler.
48 virtual net::HttpAuth::AuthorizationResult HandleAnotherChallenge(
49 net::HttpAuthChallengeTokenizer* challenge) OVERRIDE;
50 virtual bool NeedsIdentity() OVERRIDE;
51 virtual bool AllowsDefaultCredentials() OVERRIDE;
52 virtual bool AllowsExplicitCredentials() OVERRIDE;
54 private:
55 FRIEND_TEST_ALL_PREFIXES(HttpAuthHandlerDataReductionProxyTest,
56 ParseChallenge);
58 virtual ~HttpAuthHandlerDataReductionProxy();
60 virtual bool Init(net::HttpAuthChallengeTokenizer* challenge) OVERRIDE;
62 virtual int GenerateAuthTokenImpl(const net::AuthCredentials* credentials,
63 const net::HttpRequestInfo* request,
64 const net::CompletionCallback& callback,
65 std::string* auth_token) OVERRIDE;
67 bool ParseChallenge(net::HttpAuthChallengeTokenizer* challenge);
69 bool ParseChallengeProperty(const std::string& name,
70 const std::string& value);
72 // Proxy server token, encoded as UTF-8.
73 std::string ps_token_;
75 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerDataReductionProxy);
78 } // namespace data_reduction_proxy
80 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_HTTP_AUTH_HANDLER_DATA_REDUCTION_PROXY_H_