Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1654)

Unified Diff: net/ftp/ftp_auth_cache.h

Issue 201083: Cache login identity for NewFTP transactions. (Closed)
Patch Set: better Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/ftp/ftp_auth_cache.h
diff --git a/net/ftp/ftp_auth_cache.h b/net/ftp/ftp_auth_cache.h
index 1a5b0880c3d09fa754f28013c23409b252ce4777..fc68d8ab926c181c28a840e5407a67bcdc1cb1dc 100644
--- a/net/ftp/ftp_auth_cache.h
+++ b/net/ftp/ftp_auth_cache.h
@@ -6,9 +6,9 @@
#define NET_FTP_FTP_AUTH_CACHE_H_
#include <list>
+#include <string>
#include "googleurl/src/gurl.h"
-#include "net/base/auth.h"
namespace net {
@@ -25,35 +25,39 @@ class FtpAuthCache {
// Maximum number of entries we allow in the cache.
static const size_t kMaxEntries;
- FtpAuthCache() {}
- ~FtpAuthCache() {}
-
- // Check if we have authentication data for ftp server at |origin|.
- // Returns the address of corresponding AuthData object (if found) or NULL
- // (if not found).
- AuthData* Lookup(const GURL& origin);
-
- // Add an entry for |origin| to the cache. If there is already an
- // entry for |origin|, it will be overwritten. Both parameters are IN only.
- void Add(const GURL& origin, AuthData* auth_data);
-
- // Remove the entry for |origin| from the cache, if one exists.
- void Remove(const GURL& origin);
-
- private:
struct Entry {
- Entry(const GURL& origin, AuthData* auth_data)
+ Entry(const GURL& origin,
+ const std::wstring& username,
+ const std::wstring& password)
: origin(origin),
- auth_data(auth_data) {
+ username(username),
+ password(password) {
}
const GURL origin;
- scoped_refptr<AuthData> auth_data;
+ std::wstring username;
+ std::wstring password;
};
- typedef std::list<Entry> EntryList;
+
+ FtpAuthCache() {}
+ ~FtpAuthCache() {}
// Return Entry corresponding to given |origin| or NULL if not found.
- Entry* LookupEntry(const GURL& origin);
+ Entry* Lookup(const GURL& origin);
+
+ // Add an entry for |origin| to the cache (consisting of |username| and
+ // |password|). If there is already an entry for |origin|, it will be
+ // overwritten.
+ void Add(const GURL& origin, const std::wstring& username,
+ const std::wstring& password);
+
+ // Remove the entry for |origin| from the cache, if one exists and matches
+ // |username| and |password|.
+ void Remove(const GURL& origin, const std::wstring& username,
+ const std::wstring& password);
+
+ private:
+ typedef std::list<Entry> EntryList;
// Internal representation of cache, an STL list. This makes lookups O(n),
// but we expect n to be very low.

Powered by Google App Engine
This is Rietveld 408576698