| 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_FTP_FTP_AUTH_CACHE_H_ | 5 #ifndef NET_FTP_FTP_AUTH_CACHE_H_ |
| 6 #define NET_FTP_FTP_AUTH_CACHE_H_ | 6 #define NET_FTP_FTP_AUTH_CACHE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "net/base/net_api.h" | 13 #include "net/base/net_export.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 // The FtpAuthCache class is a simple cache structure to store authentication | 17 // The FtpAuthCache class is a simple cache structure to store authentication |
| 18 // information for ftp. Provides lookup, insertion, and deletion of entries. | 18 // information for ftp. Provides lookup, insertion, and deletion of entries. |
| 19 // The parameter for doing lookups, insertions, and deletions is a GURL of the | 19 // The parameter for doing lookups, insertions, and deletions is a GURL of the |
| 20 // server's address (not a full URL with path, since FTP auth isn't per path). | 20 // server's address (not a full URL with path, since FTP auth isn't per path). |
| 21 // For example: | 21 // For example: |
| 22 // GURL("ftp://myserver") -- OK (implied port of 21) | 22 // GURL("ftp://myserver") -- OK (implied port of 21) |
| 23 // GURL("ftp://myserver:21") -- OK | 23 // GURL("ftp://myserver:21") -- OK |
| 24 // GURL("ftp://myserver/PATH") -- WRONG, paths not allowed | 24 // GURL("ftp://myserver/PATH") -- WRONG, paths not allowed |
| 25 class NET_TEST FtpAuthCache { | 25 class NET_EXPORT_PRIVATE FtpAuthCache { |
| 26 public: | 26 public: |
| 27 // Maximum number of entries we allow in the cache. | 27 // Maximum number of entries we allow in the cache. |
| 28 static const size_t kMaxEntries; | 28 static const size_t kMaxEntries; |
| 29 | 29 |
| 30 struct Entry { | 30 struct Entry { |
| 31 Entry(const GURL& origin, const string16& username, | 31 Entry(const GURL& origin, const string16& username, |
| 32 const string16& password); | 32 const string16& password); |
| 33 ~Entry(); | 33 ~Entry(); |
| 34 | 34 |
| 35 const GURL origin; | 35 const GURL origin; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 58 typedef std::list<Entry> EntryList; | 58 typedef std::list<Entry> EntryList; |
| 59 | 59 |
| 60 // Internal representation of cache, an STL list. This makes lookups O(n), | 60 // Internal representation of cache, an STL list. This makes lookups O(n), |
| 61 // but we expect n to be very low. | 61 // but we expect n to be very low. |
| 62 EntryList entries_; | 62 EntryList entries_; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace net | 65 } // namespace net |
| 66 | 66 |
| 67 #endif // NET_FTP_FTP_AUTH_CACHE_H_ | 67 #endif // NET_FTP_FTP_AUTH_CACHE_H_ |
| OLD | NEW |