OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef NET_BASE_AUTH_H__ | 5 #ifndef NET_BASE_AUTH_H__ |
6 #define NET_BASE_AUTH_H__ | 6 #define NET_BASE_AUTH_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 private: | 41 private: |
42 friend class base::RefCountedThreadSafe<AuthChallengeInfo>; | 42 friend class base::RefCountedThreadSafe<AuthChallengeInfo>; |
43 ~AuthChallengeInfo(); | 43 ~AuthChallengeInfo(); |
44 }; | 44 }; |
45 | 45 |
46 // Authentication Credentials for an authentication credentials. | 46 // Authentication Credentials for an authentication credentials. |
47 class NET_EXPORT AuthCredentials { | 47 class NET_EXPORT AuthCredentials { |
48 public: | 48 public: |
49 AuthCredentials(); | 49 AuthCredentials(); |
| 50 AuthCredentials(const string16& username, const string16& password); |
50 ~AuthCredentials(); | 51 ~AuthCredentials(); |
51 | 52 |
| 53 bool Equals(const AuthCredentials& other) const; |
| 54 bool Empty() const; |
| 55 |
| 56 void Set(const string16& username, const string16& password); |
| 57 |
| 58 const string16& username() const { return username_; } |
| 59 const string16& password() const { return password_; } |
| 60 |
| 61 private: |
52 // The username to provide, possibly empty. This should be ASCII only to | 62 // The username to provide, possibly empty. This should be ASCII only to |
53 // minimize compatibility problems, but arbitrary UTF-16 strings are allowed | 63 // minimize compatibility problems, but arbitrary UTF-16 strings are allowed |
54 // and will be attempted. | 64 // and will be attempted. |
55 string16 username; | 65 string16 username_; |
56 | 66 |
57 // The password to provide, possibly empty. This should be ASCII only to | 67 // The password to provide, possibly empty. This should be ASCII only to |
58 // minimize compatibility problems, but arbitrary UTF-16 strings are allowed | 68 // minimize compatibility problems, but arbitrary UTF-16 strings are allowed |
59 // and will be attempted. | 69 // and will be attempted. |
60 string16 password; | 70 string16 password_; |
61 | 71 |
62 // Intentionally allowing the implicit copy constructor and assignment | 72 // Intentionally allowing the implicit copy constructor and assignment |
63 // operators. | 73 // operators. |
64 }; | 74 }; |
65 | 75 |
66 // Authentication structures | 76 // Authentication structures |
67 enum AuthState { | 77 enum AuthState { |
68 AUTH_STATE_DONT_NEED_AUTH, | 78 AUTH_STATE_DONT_NEED_AUTH, |
69 AUTH_STATE_NEED_AUTH, | 79 AUTH_STATE_NEED_AUTH, |
70 AUTH_STATE_HAVE_AUTH, | 80 AUTH_STATE_HAVE_AUTH, |
71 AUTH_STATE_CANCELED | 81 AUTH_STATE_CANCELED |
72 }; | 82 }; |
73 | 83 |
74 class AuthData : public base::RefCountedThreadSafe<AuthData> { | 84 class AuthData : public base::RefCountedThreadSafe<AuthData> { |
75 public: | 85 public: |
76 AuthState state; // whether we need, have, or gave up on authentication. | 86 AuthState state; // whether we need, have, or gave up on authentication. |
77 AuthCredentials credentials; // The credentials to use for auth. | 87 AuthCredentials credentials; // The credentials to use for auth. |
78 | 88 |
79 // We wouldn't instantiate this class if we didn't need authentication. | 89 // We wouldn't instantiate this class if we didn't need authentication. |
80 AuthData(); | 90 AuthData(); |
81 | 91 |
82 private: | 92 private: |
83 friend class base::RefCountedThreadSafe<AuthData>; | 93 friend class base::RefCountedThreadSafe<AuthData>; |
84 ~AuthData(); | 94 ~AuthData(); |
85 }; | 95 }; |
86 | 96 |
87 } // namespace net | 97 } // namespace net |
88 | 98 |
89 #endif // NET_BASE_AUTH_H__ | 99 #endif // NET_BASE_AUTH_H__ |
OLD | NEW |