OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
6 #define CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 6 #define CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "net/cookies/cookie_store.h" | |
16 | 17 |
17 class GURL; | 18 class GURL; |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class Time; | 21 class Time; |
21 } | 22 } |
22 | 23 |
23 namespace storage { | 24 namespace storage { |
24 class FileSystemContext; | 25 class FileSystemContext; |
25 } | 26 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 const GURL& storage_origin, | 121 const GURL& storage_origin, |
121 net::URLRequestContextGetter* rq_context, | 122 net::URLRequestContextGetter* rq_context, |
122 const base::Closure& callback) = 0; | 123 const base::Closure& callback) = 0; |
123 | 124 |
124 // A callback type to check if a given origin matches a storage policy. | 125 // A callback type to check if a given origin matches a storage policy. |
125 // Can be passed empty/null where used, which means the origin will always | 126 // Can be passed empty/null where used, which means the origin will always |
126 // match. | 127 // match. |
127 typedef base::Callback<bool(const GURL&, storage::SpecialStoragePolicy*)> | 128 typedef base::Callback<bool(const GURL&, storage::SpecialStoragePolicy*)> |
128 OriginMatcherFunction; | 129 OriginMatcherFunction; |
129 | 130 |
131 // A callback type to check if a given cookie should be cleared. | |
132 using CookieMatcherFunction = net::CookieStore::ClearCookiesPredicate; | |
michaeln
2016/03/09 20:25:51
CookieMatcherFunction is a clearer and more broadl
dmurph
2016/03/10 23:00:11
mmmmmm I like the word Predicate because that's ex
| |
133 | |
130 // Similar to ClearDataForOrigin(). | 134 // Similar to ClearDataForOrigin(). |
131 // Deletes all data out fo the StoragePartition if |storage_origin| is | 135 // Deletes all data out for the StoragePartition if |storage_origin| is empty. |
132 // nullptr. | |
133 // |origin_matcher| is present if special storage policy is to be handled, | 136 // |origin_matcher| is present if special storage policy is to be handled, |
134 // otherwise the callback can be null (base::Callback::is_null() == true). | 137 // otherwise the callback can be null (base::Callback::is_null() == true). |
135 // |callback| is called when data deletion is done or at least the deletion is | 138 // |callback| is called when data deletion is done or at least the deletion is |
136 // scheduled. | 139 // scheduled. |
137 virtual void ClearData(uint32_t remove_mask, | 140 virtual void ClearData(uint32_t remove_mask, |
138 uint32_t quota_storage_remove_mask, | 141 uint32_t quota_storage_remove_mask, |
139 const GURL& storage_origin, | 142 const GURL& storage_origin, |
140 const OriginMatcherFunction& origin_matcher, | 143 const OriginMatcherFunction& origin_matcher, |
michaeln
2016/03/09 20:25:51
Not new to this cl, this one is a little confusing
dmurph
2016/03/10 23:00:11
They are used by different subsystems. I clarified
| |
141 const base::Time begin, | 144 const base::Time begin, |
142 const base::Time end, | 145 const base::Time end, |
143 const base::Closure& callback) = 0; | 146 const base::Closure& callback) = 0; |
144 | 147 |
148 // Similar to ClearData(). | |
149 // Deletes all data out for the StoragePartition. | |
150 // * |origin_matcher| is present if special storage policy is to be handled, | |
151 // otherwise the callback should be null (base::Callback::is_null()==true). | |
152 // The origin matcher does not apply to cookies, instead use: | |
153 // * |cookies_matcher| is present if special cookie clearing is to be handled. | |
154 // If the callback is null all cookies withing the time range will be | |
155 // cleared. | |
156 // * |callback| is called when data deletion is done or at least the deletion | |
157 // is scheduled. | |
158 virtual void ClearData(uint32_t remove_mask, | |
159 uint32_t quota_storage_remove_mask, | |
160 const OriginMatcherFunction& origin_matcher, | |
161 const CookieMatcherFunction& cookie_matcher, | |
michaeln
2016/03/09 20:25:51
Hooray for punting to the higher level logic to so
dmurph
2016/03/10 23:00:11
:)
| |
162 const base::Time begin, | |
163 const base::Time end, | |
164 const base::Closure& callback) = 0; | |
165 | |
145 // Write any unwritten data to disk. | 166 // Write any unwritten data to disk. |
146 // Note: this method does not sync the data - it only ensures that any | 167 // Note: this method does not sync the data - it only ensures that any |
147 // unwritten data has been written out to the filesystem. | 168 // unwritten data has been written out to the filesystem. |
148 virtual void Flush() = 0; | 169 virtual void Flush() = 0; |
149 | 170 |
150 protected: | 171 protected: |
151 virtual ~StoragePartition() {} | 172 virtual ~StoragePartition() {} |
152 }; | 173 }; |
153 | 174 |
154 } // namespace content | 175 } // namespace content |
155 | 176 |
156 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 177 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
OLD | NEW |