OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 CONTENT_BROWSER_NET_COOKIE_STORE_MAP_H_ |
| 6 #define CONTENT_BROWSER_NET_COOKIE_STORE_MAP_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "base/callback_forward.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/time/time.h" |
| 15 #include "content/common/content_export.h" |
| 16 |
| 17 class GURL; |
| 18 |
| 19 namespace net { |
| 20 class CookieStore; |
| 21 } // namespace net |
| 22 |
| 23 namespace content { |
| 24 |
| 25 // CookieStoreMap allows associating different CookieStore objects with |
| 26 // different schemes. It is mainly a convenience class. |
| 27 class CookieStoreMap { |
| 28 public: |
| 29 CookieStoreMap(); |
| 30 virtual ~CookieStoreMap(); |
| 31 |
| 32 // Returns the CookieStore associated with |scheme|. |
| 33 CONTENT_EXPORT net::CookieStore* GetForScheme( |
| 34 const std::string& scheme) const; |
| 35 |
| 36 // Associates a |cookie_store| with the given |scheme|. Should only be called |
| 37 // once for any given |scheme|. |cookie_store| must be non-NULL. The |
| 38 // CookieStoreMap will retain the |cookie_store| object. |
| 39 void SetForScheme(const std::string& scheme, net::CookieStore* cookie_store); |
| 40 |
| 41 // Clears cookies matching the specified parameters from all CookieStores |
| 42 // contained in this map. Calls |done| when all CookieStores have been |
| 43 // cleared. |done| is guaranteed to be run on the calling thread. |
| 44 void DeleteCookies(const GURL& origin, |
| 45 const base::Time begin, |
| 46 const base::Time end, |
| 47 const base::Closure& done); |
| 48 |
| 49 // Makes a clone of the map. Useful if the map needs to be copied to another |
| 50 // thread. |
| 51 CookieStoreMap* Clone() const; |
| 52 |
| 53 private: |
| 54 typedef std::map<std::string, scoped_refptr<net::CookieStore> > MapType; |
| 55 MapType scheme_map_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(CookieStoreMap); |
| 58 }; |
| 59 |
| 60 } // namespace content |
| 61 |
| 62 #endif // CONTENT_BROWSER_NET_COOKIE_STORE_MAP_H_ |
OLD | NEW |