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

Side by Side Diff: ios/net/cookies/cookie_store_ios_persistent.mm

Issue 2649083002: Divide CookieStoreIOS into two different classes with different backends (Closed)
Patch Set: Eugene's comments Created 3 years, 10 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
OLDNEW
(Empty)
1 // Copyright (c) 2017 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 #import "ios/net/cookies/cookie_store_ios_persistent.h"
6
7 #import <Foundation/Foundation.h>
8
9 #include "ios/net/cookies/system_cookie_util.h"
10 #include "net/cookies/cookie_monster.h"
11
12 namespace net {
13
14 #pragma mark -
15 #pragma mark CookieStoreIOSPersistent
16
17 CookieStoreIOSPersistent::CookieStoreIOSPersistent(
18 net::CookieMonster::PersistentCookieStore* persistent_store)
19 : CookieStoreIOS(persistent_store,
20 [NSHTTPCookieStorage sharedHTTPCookieStorage]) {}
21
22 CookieStoreIOSPersistent::~CookieStoreIOSPersistent() {}
23
24 #pragma mark -
25 #pragma mark CookieStoreIOSPersistent methods
26
27 void CookieStoreIOSPersistent::SetCookieWithOptionsAsync(
28 const GURL& url,
29 const std::string& cookie_line,
30 const net::CookieOptions& options,
31 const SetCookiesCallback& callback) {
32 DCHECK(thread_checker().CalledOnValidThread());
33
34 cookie_monster()->SetCookieWithOptionsAsync(url, cookie_line, options,
35 WrapSetCallback(callback));
36 }
37
38 void CookieStoreIOSPersistent::SetCookieWithDetailsAsync(
39 const GURL& url,
40 const std::string& name,
41 const std::string& value,
42 const std::string& domain,
43 const std::string& path,
44 base::Time creation_time,
45 base::Time expiration_time,
46 base::Time last_access_time,
47 bool secure,
48 bool http_only,
49 CookieSameSite same_site,
50 bool enforce_strict_secure,
51 CookiePriority priority,
52 const SetCookiesCallback& callback) {
53 DCHECK(thread_checker().CalledOnValidThread());
54
55 cookie_monster()->SetCookieWithDetailsAsync(
56 url, name, value, domain, path, creation_time, expiration_time,
57 last_access_time, secure, http_only, same_site, enforce_strict_secure,
58 priority, WrapSetCallback(callback));
59 }
60
61 void CookieStoreIOSPersistent::GetCookiesWithOptionsAsync(
62 const GURL& url,
63 const net::CookieOptions& options,
64 const GetCookiesCallback& callback) {
65 DCHECK(thread_checker().CalledOnValidThread());
66 cookie_monster()->GetCookiesWithOptionsAsync(url, options, callback);
67 }
68
69 void CookieStoreIOSPersistent::GetCookieListWithOptionsAsync(
70 const GURL& url,
71 const net::CookieOptions& options,
72 const GetCookieListCallback& callback) {
73 DCHECK(thread_checker().CalledOnValidThread());
74
75 cookie_monster()->GetCookieListWithOptionsAsync(url, options, callback);
76 }
77
78 void CookieStoreIOSPersistent::GetAllCookiesAsync(
79 const GetCookieListCallback& callback) {
80 DCHECK(thread_checker().CalledOnValidThread());
81
82 cookie_monster()->GetAllCookiesAsync(callback);
83 }
84
85 void CookieStoreIOSPersistent::DeleteCookieAsync(
86 const GURL& url,
87 const std::string& cookie_name,
88 const base::Closure& callback) {
89 DCHECK(thread_checker().CalledOnValidThread());
90
91 cookie_monster()->DeleteCookieAsync(url, cookie_name, WrapClosure(callback));
92 }
93
94 void CookieStoreIOSPersistent::DeleteCanonicalCookieAsync(
95 const CanonicalCookie& cookie,
96 const DeleteCallback& callback) {
97 DCHECK(thread_checker().CalledOnValidThread());
98
99 cookie_monster()->DeleteCanonicalCookieAsync(cookie,
100 WrapDeleteCallback(callback));
101 }
102
103 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenAsync(
104 const base::Time& delete_begin,
105 const base::Time& delete_end,
106 const DeleteCallback& callback) {
107 DCHECK(thread_checker().CalledOnValidThread());
108
109 if (metrics_enabled())
110 ResetCookieCountMetrics();
111
112 cookie_monster()->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
113 WrapDeleteCallback(callback));
114 }
115
116 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenWithPredicateAsync(
117 const base::Time& delete_begin,
118 const base::Time& delete_end,
119 const CookiePredicate& predicate,
120 const DeleteCallback& callback) {
121 DCHECK(thread_checker().CalledOnValidThread());
122
123 if (metrics_enabled())
124 ResetCookieCountMetrics();
125
126 cookie_monster()->DeleteAllCreatedBetweenWithPredicateAsync(
127 delete_begin, delete_end, predicate, WrapDeleteCallback(callback));
128 }
129
130 void CookieStoreIOSPersistent::DeleteSessionCookiesAsync(
131 const DeleteCallback& callback) {
132 DCHECK(thread_checker().CalledOnValidThread());
133
134 if (metrics_enabled())
135 ResetCookieCountMetrics();
136
137 cookie_monster()->DeleteSessionCookiesAsync(WrapDeleteCallback(callback));
138 }
139
140 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698