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

Side by Side Diff: net/base/cookie_monster.h

Issue 7529043: Rename NET_API to NET_EXPORT, and rename NET_TEST to NET_EXPORT_PRIVATE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 // Brought to you by the letter D and the number 2. 5 // Brought to you by the letter D and the number 2.
6 6
7 #ifndef NET_BASE_COOKIE_MONSTER_H_ 7 #ifndef NET_BASE_COOKIE_MONSTER_H_
8 #define NET_BASE_COOKIE_MONSTER_H_ 8 #define NET_BASE_COOKIE_MONSTER_H_
9 #pragma once 9 #pragma once
10 10
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/synchronization/lock.h" 20 #include "base/synchronization/lock.h"
21 #include "base/task.h" 21 #include "base/task.h"
22 #include "base/time.h" 22 #include "base/time.h"
23 #include "net/base/cookie_store.h" 23 #include "net/base/cookie_store.h"
24 #include "net/base/net_api.h" 24 #include "net/base/net_export.h"
25 25
26 class GURL; 26 class GURL;
27 27
28 namespace base { 28 namespace base {
29 class Histogram; 29 class Histogram;
30 } 30 }
31 31
32 namespace net { 32 namespace net {
33 33
34 class CookieList; 34 class CookieList;
35 35
36 // The cookie monster is the system for storing and retrieving cookies. It has 36 // The cookie monster is the system for storing and retrieving cookies. It has
37 // an in-memory list of all cookies, and synchronizes non-session cookies to an 37 // an in-memory list of all cookies, and synchronizes non-session cookies to an
38 // optional permanent storage that implements the PersistentCookieStore 38 // optional permanent storage that implements the PersistentCookieStore
39 // interface. 39 // interface.
40 // 40 //
41 // This class IS thread-safe. Normally, it is only used on the I/O thread, but 41 // This class IS thread-safe. Normally, it is only used on the I/O thread, but
42 // is also accessed directly through Automation for UI testing. 42 // is also accessed directly through Automation for UI testing.
43 // 43 //
44 // Several methods exist in asynchronous forms. Calls may be deferred if all 44 // Several methods exist in asynchronous forms. Calls may be deferred if all
45 // affected cookies are not yet loaded from the backing store. Otherwise, the 45 // affected cookies are not yet loaded from the backing store. Otherwise, the
46 // callback may be invoked immediately (prior to return of the asynchronous 46 // callback may be invoked immediately (prior to return of the asynchronous
47 // function). 47 // function).
48 // 48 //
49 // Callbacks are guaranteed to be invoked on the calling thread. 49 // Callbacks are guaranteed to be invoked on the calling thread.
50 // 50 //
51 // TODO(deanm) Implement CookieMonster, the cookie database. 51 // TODO(deanm) Implement CookieMonster, the cookie database.
52 // - Verify that our domain enforcement and non-dotted handling is correct 52 // - Verify that our domain enforcement and non-dotted handling is correct
53 class NET_API CookieMonster : public CookieStore { 53 class NET_EXPORT CookieMonster : public CookieStore {
54 public: 54 public:
55 class CanonicalCookie; 55 class CanonicalCookie;
56 class Delegate; 56 class Delegate;
57 class ParsedCookie; 57 class ParsedCookie;
58 class PersistentCookieStore; 58 class PersistentCookieStore;
59 59
60 // Terminology: 60 // Terminology:
61 // * The 'top level domain' (TLD) of an internet domain name is 61 // * The 'top level domain' (TLD) of an internet domain name is
62 // the terminal "." free substring (e.g. "com" for google.com 62 // the terminal "." free substring (e.g. "com" for google.com
63 // or world.std.com). 63 // or world.std.com).
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 base::Time last_statistic_record_time_; 580 base::Time last_statistic_record_time_;
581 581
582 bool keep_expired_cookies_; 582 bool keep_expired_cookies_;
583 583
584 static bool enable_file_scheme_; 584 static bool enable_file_scheme_;
585 585
586 DISALLOW_COPY_AND_ASSIGN(CookieMonster); 586 DISALLOW_COPY_AND_ASSIGN(CookieMonster);
587 }; 587 };
588 588
589 class NET_API CookieMonster::CanonicalCookie { 589 class NET_EXPORT CookieMonster::CanonicalCookie {
590 public: 590 public:
591 591
592 // These constructors do no validation or canonicalization of their inputs; 592 // These constructors do no validation or canonicalization of their inputs;
593 // the resulting CanonicalCookies should not be relied on to be canonical 593 // the resulting CanonicalCookies should not be relied on to be canonical
594 // unless the caller has done appropriate validation and canonicalization 594 // unless the caller has done appropriate validation and canonicalization
595 // themselves. 595 // themselves.
596 CanonicalCookie(); 596 CanonicalCookie();
597 CanonicalCookie(const GURL& url, 597 CanonicalCookie(const GURL& url,
598 const std::string& name, 598 const std::string& name,
599 const std::string& value, 599 const std::string& value,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 // a new cookie is written with the updated values, generating a notification 739 // a new cookie is written with the updated values, generating a notification
740 // with cause CHANGE_COOKIE_EXPLICIT. 740 // with cause CHANGE_COOKIE_EXPLICIT.
741 virtual void OnCookieChanged(const CookieMonster::CanonicalCookie& cookie, 741 virtual void OnCookieChanged(const CookieMonster::CanonicalCookie& cookie,
742 bool removed, 742 bool removed,
743 ChangeCause cause) = 0; 743 ChangeCause cause) = 0;
744 protected: 744 protected:
745 friend class base::RefCountedThreadSafe<CookieMonster::Delegate>; 745 friend class base::RefCountedThreadSafe<CookieMonster::Delegate>;
746 virtual ~Delegate() {} 746 virtual ~Delegate() {}
747 }; 747 };
748 748
749 class NET_API CookieMonster::ParsedCookie { 749 class NET_EXPORT CookieMonster::ParsedCookie {
750 public: 750 public:
751 typedef std::pair<std::string, std::string> TokenValuePair; 751 typedef std::pair<std::string, std::string> TokenValuePair;
752 typedef std::vector<TokenValuePair> PairList; 752 typedef std::vector<TokenValuePair> PairList;
753 753
754 // The maximum length of a cookie string we will try to parse 754 // The maximum length of a cookie string we will try to parse
755 static const size_t kMaxCookieSize = 4096; 755 static const size_t kMaxCookieSize = 4096;
756 // The maximum number of Token/Value pairs. Shouldn't have more than 8. 756 // The maximum number of Token/Value pairs. Shouldn't have more than 8.
757 static const int kMaxPairs = 16; 757 static const int kMaxPairs = 16;
758 758
759 // Construct from a cookie string like "BLAH=1; path=/; domain=.google.com" 759 // Construct from a cookie string like "BLAH=1; path=/; domain=.google.com"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 private: 876 private:
877 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 877 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
878 }; 878 };
879 879
880 class CookieList : public std::vector<CookieMonster::CanonicalCookie> { 880 class CookieList : public std::vector<CookieMonster::CanonicalCookie> {
881 }; 881 };
882 882
883 } // namespace net 883 } // namespace net
884 884
885 #endif // NET_BASE_COOKIE_MONSTER_H_ 885 #endif // NET_BASE_COOKIE_MONSTER_H_
OLDNEW
« no previous file with comments | « net/base/cert_verify_result.h ('k') | net/base/cookie_store.h » ('j') | net/base/net_export.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698