Index: net/ftp/ftp_auth_cache.cc |
diff --git a/net/ftp/ftp_auth_cache.cc b/net/ftp/ftp_auth_cache.cc |
index a67c2e04d071e2f8427173de61953ecdb21c73f9..40adabd727185f3cbbea392bf362c1f7be95f664 100644 |
--- a/net/ftp/ftp_auth_cache.cc |
+++ b/net/ftp/ftp_auth_cache.cc |
@@ -13,11 +13,9 @@ namespace net { |
const size_t FtpAuthCache::kMaxEntries = 10; |
FtpAuthCache::Entry::Entry(const GURL& origin, |
- const string16& username, |
- const string16& password) |
+ const AuthCredentials& credentials) |
: origin(origin), |
- username(username), |
- password(password) { |
+ credentials(credentials) { |
} |
FtpAuthCache::Entry::~Entry() {} |
@@ -34,17 +32,15 @@ FtpAuthCache::Entry* FtpAuthCache::Lookup(const GURL& origin) { |
return NULL; |
} |
-void FtpAuthCache::Add(const GURL& origin, const string16& username, |
- const string16& password) { |
+void FtpAuthCache::Add(const GURL& origin, const AuthCredentials& credentials) { |
DCHECK(origin.SchemeIs("ftp")); |
DCHECK_EQ(origin.GetOrigin(), origin); |
Entry* entry = Lookup(origin); |
if (entry) { |
- entry->username = username; |
- entry->password = password; |
+ entry->credentials = credentials; |
} else { |
- entries_.push_front(Entry(origin, username, password)); |
+ entries_.push_front(Entry(origin, credentials)); |
// Prevent unbound memory growth of the cache. |
if (entries_.size() > kMaxEntries) |
@@ -52,11 +48,10 @@ void FtpAuthCache::Add(const GURL& origin, const string16& username, |
} |
} |
-void FtpAuthCache::Remove(const GURL& origin, const string16& username, |
- const string16& password) { |
+void FtpAuthCache::Remove(const GURL& origin, |
+ const AuthCredentials& credentials) { |
for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) { |
- if (it->origin == origin && it->username == username && |
- it->password == password) { |
+ if (it->origin == origin && it->credentials.Equals(credentials)) { |
entries_.erase(it); |
DCHECK(!Lookup(origin)); |
return; |