OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_HTTP_HTTP_AUTH_CONTROLLER_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_CONTROLLER_H_ |
6 #define NET_HTTP_HTTP_AUTH_CONTROLLER_H_ | 6 #define NET_HTTP_HTTP_AUTH_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/string16.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
17 #include "net/base/net_log.h" | 18 #include "net/base/net_log.h" |
18 #include "net/http/http_auth.h" | 19 #include "net/http/http_auth.h" |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 | 22 |
22 class AuthChallengeInfo; | 23 class AuthChallengeInfo; |
23 class HostResolver; | 24 class HostResolver; |
24 class HttpAuthHandler; | 25 class HttpAuthHandler; |
(...skipping 23 matching lines...) Expand all Loading... |
48 | 49 |
49 // Checks for and handles HTTP status code 401 or 407. | 50 // Checks for and handles HTTP status code 401 or 407. |
50 // |HandleAuthChallenge()| returns OK on success, or a network error code | 51 // |HandleAuthChallenge()| returns OK on success, or a network error code |
51 // otherwise. It may also populate |auth_info_|. | 52 // otherwise. It may also populate |auth_info_|. |
52 virtual int HandleAuthChallenge(scoped_refptr<HttpResponseHeaders> headers, | 53 virtual int HandleAuthChallenge(scoped_refptr<HttpResponseHeaders> headers, |
53 bool do_not_send_server_auth, | 54 bool do_not_send_server_auth, |
54 bool establishing_tunnel, | 55 bool establishing_tunnel, |
55 const BoundNetLog& net_log); | 56 const BoundNetLog& net_log); |
56 | 57 |
57 // Store the supplied credentials and prepare to restart the auth. | 58 // Store the supplied credentials and prepare to restart the auth. |
58 virtual void ResetAuth(const std::wstring& username, | 59 virtual void ResetAuth(const string16& username, |
59 const std::wstring& password); | 60 const string16& password); |
60 | 61 |
61 virtual bool HaveAuthHandler() const { | 62 virtual bool HaveAuthHandler() const { |
62 return handler_.get() != NULL; | 63 return handler_.get() != NULL; |
63 } | 64 } |
64 | 65 |
65 virtual bool HaveAuth() const { | 66 virtual bool HaveAuth() const { |
66 return handler_.get() && !identity_.invalid; | 67 return handler_.get() && !identity_.invalid; |
67 } | 68 } |
68 | 69 |
69 virtual scoped_refptr<AuthChallengeInfo> auth_info() { | 70 virtual scoped_refptr<AuthChallengeInfo> auth_info() { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 142 |
142 std::set<std::string> disabled_schemes_; | 143 std::set<std::string> disabled_schemes_; |
143 | 144 |
144 CompletionCallbackImpl<HttpAuthController> io_callback_; | 145 CompletionCallbackImpl<HttpAuthController> io_callback_; |
145 CompletionCallback* user_callback_; | 146 CompletionCallback* user_callback_; |
146 }; | 147 }; |
147 | 148 |
148 } // namespace net | 149 } // namespace net |
149 | 150 |
150 #endif // NET_HTTP_HTTP_AUTH_CONTROLLER_H_ | 151 #endif // NET_HTTP_HTTP_AUTH_CONTROLLER_H_ |
OLD | NEW |