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

Side by Side Diff: content/public/browser/storage_partition.h

Issue 1741123002: Add removal filter support for Cookies, Storage, and Content Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ios fix, and fixed test Created 4 years, 9 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
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
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::CookiePredicate;
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.
140 // storage_origin and origin_matcher_function are used for different
141 // subsystems. One does not imply the other.
137 virtual void ClearData(uint32_t remove_mask, 142 virtual void ClearData(uint32_t remove_mask,
138 uint32_t quota_storage_remove_mask, 143 uint32_t quota_storage_remove_mask,
139 const GURL& storage_origin, 144 const GURL& storage_origin,
140 const OriginMatcherFunction& origin_matcher, 145 const OriginMatcherFunction& origin_matcher,
141 const base::Time begin, 146 const base::Time begin,
142 const base::Time end, 147 const base::Time end,
143 const base::Closure& callback) = 0; 148 const base::Closure& callback) = 0;
144 149
150 // Similar to ClearData().
151 // Deletes all data out for the StoragePartition.
152 // * |origin_matcher| is present if special storage policy is to be handled,
153 // otherwise the callback should be null (base::Callback::is_null()==true).
154 // The origin matcher does not apply to cookies, instead use:
155 // * |cookies_matcher| is present if special cookie clearing is to be handled.
156 // If the callback is null all cookies withing the time range will be
157 // cleared.
158 // * |callback| is called when data deletion is done or at least the deletion
159 // is scheduled.
160 // Note: Make sure you know what you are doing before clearing cookies
161 // selectively. You don't want to break the web.
162 virtual void ClearData(uint32_t remove_mask,
163 uint32_t quota_storage_remove_mask,
164 const OriginMatcherFunction& origin_matcher,
165 const CookieMatcherFunction& cookie_matcher,
166 const base::Time begin,
167 const base::Time end,
168 const base::Closure& callback) = 0;
169
145 // Write any unwritten data to disk. 170 // Write any unwritten data to disk.
146 // Note: this method does not sync the data - it only ensures that any 171 // Note: this method does not sync the data - it only ensures that any
147 // unwritten data has been written out to the filesystem. 172 // unwritten data has been written out to the filesystem.
148 virtual void Flush() = 0; 173 virtual void Flush() = 0;
149 174
150 protected: 175 protected:
151 virtual ~StoragePartition() {} 176 virtual ~StoragePartition() {}
152 }; 177 };
153 178
154 } // namespace content 179 } // namespace content
155 180
156 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ 181 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698