| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/ftp/ftp_auth_cache.h" | 5 #include "net/ftp/ftp_auth_cache.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 const size_t FtpAuthCache::kMaxEntries = 10; | 13 const size_t FtpAuthCache::kMaxEntries = 10; |
| 14 | 14 |
| 15 FtpAuthCache::Entry::Entry(const GURL& origin, |
| 16 const string16& username, |
| 17 const string16& password) |
| 18 : origin(origin), |
| 19 username(username), |
| 20 password(password) { |
| 21 } |
| 22 |
| 23 FtpAuthCache::Entry::~Entry() {} |
| 24 |
| 25 FtpAuthCache::FtpAuthCache() {} |
| 26 |
| 27 FtpAuthCache::~FtpAuthCache() {} |
| 28 |
| 15 FtpAuthCache::Entry* FtpAuthCache::Lookup(const GURL& origin) { | 29 FtpAuthCache::Entry* FtpAuthCache::Lookup(const GURL& origin) { |
| 16 for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) { | 30 for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) { |
| 17 if (it->origin == origin) | 31 if (it->origin == origin) |
| 18 return &(*it); | 32 return &(*it); |
| 19 } | 33 } |
| 20 return NULL; | 34 return NULL; |
| 21 } | 35 } |
| 22 | 36 |
| 23 void FtpAuthCache::Add(const GURL& origin, const string16& username, | 37 void FtpAuthCache::Add(const GURL& origin, const string16& username, |
| 24 const string16& password) { | 38 const string16& password) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 44 if (it->origin == origin && it->username == username && | 58 if (it->origin == origin && it->username == username && |
| 45 it->password == password) { | 59 it->password == password) { |
| 46 entries_.erase(it); | 60 entries_.erase(it); |
| 47 DCHECK(!Lookup(origin)); | 61 DCHECK(!Lookup(origin)); |
| 48 return; | 62 return; |
| 49 } | 63 } |
| 50 } | 64 } |
| 51 } | 65 } |
| 52 | 66 |
| 53 } // namespace net | 67 } // namespace net |
| OLD | NEW |