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

Unified Diff: net/ftp/ftp_auth_cache.cc

Issue 8340026: Use AuthCredentials throughout the network stack instead of username/password. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comments Created 9 years, 2 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
« no previous file with comments | « net/ftp/ftp_auth_cache.h ('k') | net/ftp/ftp_auth_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « net/ftp/ftp_auth_cache.h ('k') | net/ftp/ftp_auth_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698