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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 static const uint32 QUOTA_MANAGED_STORAGE_MASK_PERSISTENT = 1 << 1; | 79 static const uint32 QUOTA_MANAGED_STORAGE_MASK_PERSISTENT = 1 << 1; |
80 // Corresponds to quota::kStorageTypeSyncable. | 80 // Corresponds to quota::kStorageTypeSyncable. |
81 static const uint32 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2; | 81 static const uint32 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2; |
82 static const uint32 QUOTA_MANAGED_STORAGE_MASK_ALL = 0xFFFFFFFF; | 82 static const uint32 QUOTA_MANAGED_STORAGE_MASK_ALL = 0xFFFFFFFF; |
83 | 83 |
84 // Starts an asynchronous task that does a best-effort clear the data | 84 // Starts an asynchronous task that does a best-effort clear the data |
85 // corresponding to the given |remove_mask| and |quota_storage_remove_mask| | 85 // corresponding to the given |remove_mask| and |quota_storage_remove_mask| |
86 // inside this StoragePartition for the given |storage_origin|. | 86 // inside this StoragePartition for the given |storage_origin|. |
87 // Note session dom storage is not cleared even if you specify | 87 // Note session dom storage is not cleared even if you specify |
88 // REMOVE_DATA_MASK_LOCAL_STORAGE. | 88 // REMOVE_DATA_MASK_LOCAL_STORAGE. |
| 89 // |callback| is called when data deletion is done or at least the deletion is |
| 90 // scheduled. |
89 // | 91 // |
90 // TODO(ajwong): Right now, the embedder may have some | 92 // TODO(ajwong): Right now, the embedder may have some |
91 // URLRequestContextGetter objects that the StoragePartition does not know | 93 // URLRequestContextGetter objects that the StoragePartition does not know |
92 // about. This will no longer be the case when we resolve | 94 // about. This will no longer be the case when we resolve |
93 // http://crbug.com/159193. Remove |request_context_getter| when that bug | 95 // http://crbug.com/159193. Remove |request_context_getter| when that bug |
94 // is fixed. | 96 // is fixed. |
95 virtual void ClearDataForOrigin(uint32 remove_mask, | 97 virtual void ClearDataForOrigin(uint32 remove_mask, |
96 uint32 quota_storage_remove_mask, | 98 uint32 quota_storage_remove_mask, |
97 const GURL& storage_origin, | 99 const GURL& storage_origin, |
98 net::URLRequestContextGetter* rq_context) = 0; | 100 net::URLRequestContextGetter* rq_context, |
| 101 const base::Closure& callback) = 0; |
99 | 102 |
100 // A callback type to check if a given origin matches a storage policy. | 103 // A callback type to check if a given origin matches a storage policy. |
101 // Can be passed empty/null where used, which means the origin will always | 104 // Can be passed empty/null where used, which means the origin will always |
102 // match. | 105 // match. |
103 typedef base::Callback<bool(const GURL&, | 106 typedef base::Callback<bool(const GURL&, |
104 quota::SpecialStoragePolicy*)> | 107 quota::SpecialStoragePolicy*)> |
105 OriginMatcherFunction; | 108 OriginMatcherFunction; |
106 | 109 |
107 // Similar to ClearDataForOrigin(). | 110 // Similar to ClearDataForOrigin(). |
108 // Deletes all data out fo the StoragePartition if |storage_origin| is NULL. | 111 // Deletes all data out fo the StoragePartition if |storage_origin| is NULL. |
109 // |origin_matcher| is present if special storage policy is to be handled, | 112 // |origin_matcher| is present if special storage policy is to be handled, |
110 // otherwise the callback can be null (base::Callback::is_null() == true). | 113 // otherwise the callback can be null (base::Callback::is_null() == true). |
111 // |callback| is called when data deletion is done or at least the deletion is | 114 // |callback| is called when data deletion is done or at least the deletion is |
112 // scheduled. | 115 // scheduled. |
113 virtual void ClearData(uint32 remove_mask, | 116 virtual void ClearData(uint32 remove_mask, |
114 uint32 quota_storage_remove_mask, | 117 uint32 quota_storage_remove_mask, |
115 const GURL& storage_origin, | 118 const GURL& storage_origin, |
116 const OriginMatcherFunction& origin_matcher, | 119 const OriginMatcherFunction& origin_matcher, |
117 const base::Time begin, | 120 const base::Time begin, |
118 const base::Time end, | 121 const base::Time end, |
119 const base::Closure& callback) = 0; | 122 const base::Closure& callback) = 0; |
120 | 123 |
121 protected: | 124 protected: |
122 virtual ~StoragePartition() {} | 125 virtual ~StoragePartition() {} |
123 }; | 126 }; |
124 | 127 |
125 } // namespace content | 128 } // namespace content |
126 | 129 |
127 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 130 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
OLD | NEW |