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" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 | 12 |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 namespace appcache { | 15 namespace appcache { |
16 class AppCacheService; | 16 class AppCacheService; |
17 } | 17 } |
18 | 18 |
19 namespace fileapi { | 19 namespace fileapi { |
20 class FileSystemContext; | 20 class FileSystemContext; |
21 } | 21 } |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
25 } | 25 } |
26 | 26 |
27 namespace quota { | 27 namespace quota { |
28 class QuotaManager; | 28 class QuotaManager; |
29 class SpecialStoragePolicy; | |
29 } | 30 } |
30 | 31 |
31 namespace webkit_database { | 32 namespace webkit_database { |
32 class DatabaseTracker; | 33 class DatabaseTracker; |
33 } | 34 } |
34 | 35 |
35 namespace content { | 36 namespace content { |
36 | 37 |
37 class BrowserContext; | 38 class BrowserContext; |
38 class IndexedDBContext; | 39 class IndexedDBContext; |
39 class DOMStorageContext; | 40 class DOMStorageContext; |
40 | 41 |
41 // Defines what persistent state a child process can access. | 42 // Defines what persistent state a child process can access. |
42 // | 43 // |
43 // The StoragePartition defines the view each child process has of the | 44 // The StoragePartition defines the view each child process has of the |
44 // persistent state inside the BrowserContext. This is used to implement | 45 // persistent state inside the BrowserContext. This is used to implement |
45 // isolated storage where a renderer with isolated storage cannot see | 46 // isolated storage where a renderer with isolated storage cannot see |
46 // the cookies, localStorage, etc., that normal web renderers have access to. | 47 // the cookies, localStorage, etc., that normal web renderers have access to. |
47 class StoragePartition { | 48 class StoragePartition { |
48 public: | 49 public: |
50 // A callback type to check if a given origin matches a storage policy. | |
51 // Can be passed empty/null where used, which means the origin will always | |
52 // match. | |
53 typedef base::Callback<bool(const GURL&, | |
54 quota::SpecialStoragePolicy*)> | |
55 OriginMatcherFunction; | |
jam
2013/10/31 00:06:05
nit: move this to line 108, convention for content
lazyboy
2013/10/31 20:55:30
Done.
| |
56 | |
49 virtual base::FilePath GetPath() = 0; | 57 virtual base::FilePath GetPath() = 0; |
50 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; | 58 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; |
51 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; | 59 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; |
52 virtual quota::QuotaManager* GetQuotaManager() = 0; | 60 virtual quota::QuotaManager* GetQuotaManager() = 0; |
53 virtual appcache::AppCacheService* GetAppCacheService() = 0; | 61 virtual appcache::AppCacheService* GetAppCacheService() = 0; |
54 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; | 62 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; |
55 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; | 63 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; |
56 virtual DOMStorageContext* GetDOMStorageContext() = 0; | 64 virtual DOMStorageContext* GetDOMStorageContext() = 0; |
57 virtual IndexedDBContext* GetIndexedDBContext() = 0; | 65 virtual IndexedDBContext* GetIndexedDBContext() = 0; |
58 | 66 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 // TODO(ajwong): Right now, the embedder may have some | 98 // TODO(ajwong): Right now, the embedder may have some |
91 // URLRequestContextGetter objects that the StoragePartition does not know | 99 // URLRequestContextGetter objects that the StoragePartition does not know |
92 // about. This will no longer be the case when we resolve | 100 // about. This will no longer be the case when we resolve |
93 // http://crbug.com/159193. Remove |request_context_getter| when that bug | 101 // http://crbug.com/159193. Remove |request_context_getter| when that bug |
94 // is fixed. | 102 // is fixed. |
95 virtual void ClearDataForOrigin(uint32 remove_mask, | 103 virtual void ClearDataForOrigin(uint32 remove_mask, |
96 uint32 quota_storage_remove_mask, | 104 uint32 quota_storage_remove_mask, |
97 const GURL& storage_origin, | 105 const GURL& storage_origin, |
98 net::URLRequestContextGetter* rq_context) = 0; | 106 net::URLRequestContextGetter* rq_context) = 0; |
99 | 107 |
100 // Similar to ClearDataForOrigin(), but deletes all data out of the | 108 // Similar to ClearDataForOrigin(). |
101 // StoragePartition rather than just the data related to this origin. | 109 // Deletes all data out fo the StoragePartition if |storage_origin| is NULL. |
102 virtual void ClearDataForUnboundedRange(uint32 remove_mask, | 110 // |origin_matcher| is present if special storage policy is to be handled, |
103 uint32 quota_storage_remove_mask) = 0; | 111 // otherwise the callback can be null (base::Callback::is_null() == true). |
104 | 112 // |callback| is called when data deletion is done or at least the deletion is |
105 // Similar to ClearDataForOrigin(), but deletes all the data out of the | 113 // scheduled. |
106 // StoragePartion from between the given |begin| and |end| dates rather | 114 virtual void ClearData(uint32 remove_mask, |
107 // then just the data related to this origin. | 115 uint32 quota_storage_remove_mask, |
108 virtual void ClearDataForRange(uint32 remove_mask, | 116 const GURL* storage_origin, |
109 uint32 quota_storage_remove_mask, | 117 const OriginMatcherFunction& origin_matcher, |
110 const base::Time& begin, | 118 const base::Time begin, |
111 const base::Time& end, | 119 const base::Time end, |
112 const base::Closure& callback) = 0; | 120 const base::Closure& callback) = 0; |
113 | 121 |
114 protected: | 122 protected: |
115 virtual ~StoragePartition() {} | 123 virtual ~StoragePartition() {} |
116 }; | 124 }; |
117 | 125 |
118 } // namespace content | 126 } // namespace content |
119 | 127 |
120 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 128 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
OLD | NEW |