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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 const GURL& storage_origin, | 119 const GURL& storage_origin, |
119 net::URLRequestContextGetter* rq_context, | 120 net::URLRequestContextGetter* rq_context, |
120 const base::Closure& callback) = 0; | 121 const base::Closure& callback) = 0; |
121 | 122 |
122 // A callback type to check if a given origin matches a storage policy. | 123 // A callback type to check if a given origin matches a storage policy. |
123 // Can be passed empty/null where used, which means the origin will always | 124 // Can be passed empty/null where used, which means the origin will always |
124 // match. | 125 // match. |
125 typedef base::Callback<bool(const GURL&, storage::SpecialStoragePolicy*)> | 126 typedef base::Callback<bool(const GURL&, storage::SpecialStoragePolicy*)> |
126 OriginMatcherFunction; | 127 OriginMatcherFunction; |
127 | 128 |
| 129 // A callback type to check if a given cookie should be cleared. |
| 130 using CookieMatcherFunction = net::CookieStore::CookiePredicate; |
| 131 |
128 // Similar to ClearDataForOrigin(). | 132 // Similar to ClearDataForOrigin(). |
129 // Deletes all data out fo the StoragePartition if |storage_origin| is | 133 // Deletes all data out for the StoragePartition if |storage_origin| is empty. |
130 // nullptr. | |
131 // |origin_matcher| is present if special storage policy is to be handled, | 134 // |origin_matcher| is present if special storage policy is to be handled, |
132 // otherwise the callback can be null (base::Callback::is_null() == true). | 135 // otherwise the callback can be null (base::Callback::is_null() == true). |
133 // |callback| is called when data deletion is done or at least the deletion is | 136 // |callback| is called when data deletion is done or at least the deletion is |
134 // scheduled. | 137 // scheduled. |
| 138 // storage_origin and origin_matcher_function are used for different |
| 139 // subsystems. One does not imply the other. |
135 virtual void ClearData(uint32_t remove_mask, | 140 virtual void ClearData(uint32_t remove_mask, |
136 uint32_t quota_storage_remove_mask, | 141 uint32_t quota_storage_remove_mask, |
137 const GURL& storage_origin, | 142 const GURL& storage_origin, |
138 const OriginMatcherFunction& origin_matcher, | 143 const OriginMatcherFunction& origin_matcher, |
139 const base::Time begin, | 144 const base::Time begin, |
140 const base::Time end, | 145 const base::Time end, |
141 const base::Closure& callback) = 0; | 146 const base::Closure& callback) = 0; |
142 | 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 // Note: Make sure you know what you are doing before clearing cookies |
| 159 // selectively. You don't want to break the web. |
| 160 virtual void ClearData(uint32_t remove_mask, |
| 161 uint32_t quota_storage_remove_mask, |
| 162 const OriginMatcherFunction& origin_matcher, |
| 163 const CookieMatcherFunction& cookie_matcher, |
| 164 const base::Time begin, |
| 165 const base::Time end, |
| 166 const base::Closure& callback) = 0; |
| 167 |
143 // Write any unwritten data to disk. | 168 // Write any unwritten data to disk. |
144 // Note: this method does not sync the data - it only ensures that any | 169 // Note: this method does not sync the data - it only ensures that any |
145 // unwritten data has been written out to the filesystem. | 170 // unwritten data has been written out to the filesystem. |
146 virtual void Flush() = 0; | 171 virtual void Flush() = 0; |
147 | 172 |
148 protected: | 173 protected: |
149 virtual ~StoragePartition() {} | 174 virtual ~StoragePartition() {} |
150 }; | 175 }; |
151 | 176 |
152 } // namespace content | 177 } // namespace content |
153 | 178 |
154 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 179 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
OLD | NEW |