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

Side by Side Diff: net/ftp/ftp_auth_cache.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « net/ftp/OWNERS ('k') | net/ftp/ftp_auth_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_FTP_FTP_AUTH_CACHE_H_
6 #define NET_FTP_FTP_AUTH_CACHE_H_
7
8 #include <list>
9
10 #include "net/base/auth.h"
11 #include "net/base/net_export.h"
12 #include "url/gurl.h"
13
14 namespace net {
15
16 // The FtpAuthCache class is a simple cache structure to store authentication
17 // information for ftp. Provides lookup, insertion, and deletion of entries.
18 // The parameter for doing lookups, insertions, and deletions is a GURL of the
19 // server's address (not a full URL with path, since FTP auth isn't per path).
20 // For example:
21 // GURL("ftp://myserver") -- OK (implied port of 21)
22 // GURL("ftp://myserver:21") -- OK
23 // GURL("ftp://myserver/PATH") -- WRONG, paths not allowed
24 class NET_EXPORT_PRIVATE FtpAuthCache {
25 public:
26 // Maximum number of entries we allow in the cache.
27 static const size_t kMaxEntries;
28
29 struct Entry {
30 Entry(const GURL& origin, const AuthCredentials& credentials);
31 ~Entry();
32
33 GURL origin;
34 AuthCredentials credentials;
35 };
36
37 FtpAuthCache();
38 ~FtpAuthCache();
39
40 // Return Entry corresponding to given |origin| or NULL if not found.
41 Entry* Lookup(const GURL& origin);
42
43 // Add an entry for |origin| to the cache using |credentials|. If there is
44 // already an entry for |origin|, it will be overwritten.
45 void Add(const GURL& origin, const AuthCredentials& credentials);
46
47 // Remove the entry for |origin| from the cache, if one exists and matches
48 // |credentials|.
49 void Remove(const GURL& origin, const AuthCredentials& credentials);
50
51 private:
52 typedef std::list<Entry> EntryList;
53
54 // Internal representation of cache, an STL list. This makes lookups O(n),
55 // but we expect n to be very low.
56 EntryList entries_;
57 };
58
59 } // namespace net
60
61 #endif // NET_FTP_FTP_AUTH_CACHE_H_
OLDNEW
« no previous file with comments | « net/ftp/OWNERS ('k') | net/ftp/ftp_auth_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698