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/callback_forward.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/time/time.h" |
| 14 #include "content/common/content_export.h" |
12 | 15 |
13 class GURL; | 16 class GURL; |
14 | 17 |
| 18 namespace base { |
| 19 class Time; |
| 20 } |
| 21 |
15 namespace fileapi { | 22 namespace fileapi { |
16 class FileSystemContext; | 23 class FileSystemContext; |
17 } | 24 } |
18 | 25 |
19 namespace net { | 26 namespace net { |
20 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
21 } | 28 } |
22 | 29 |
23 namespace quota { | 30 namespace quota { |
24 class QuotaManager; | 31 class QuotaManager; |
(...skipping 11 matching lines...) Expand all Loading... |
36 class IndexedDBContext; | 43 class IndexedDBContext; |
37 class DOMStorageContext; | 44 class DOMStorageContext; |
38 class ServiceWorkerContext; | 45 class ServiceWorkerContext; |
39 | 46 |
40 // Defines what persistent state a child process can access. | 47 // Defines what persistent state a child process can access. |
41 // | 48 // |
42 // The StoragePartition defines the view each child process has of the | 49 // The StoragePartition defines the view each child process has of the |
43 // persistent state inside the BrowserContext. This is used to implement | 50 // persistent state inside the BrowserContext. This is used to implement |
44 // isolated storage where a renderer with isolated storage cannot see | 51 // isolated storage where a renderer with isolated storage cannot see |
45 // the cookies, localStorage, etc., that normal web renderers have access to. | 52 // the cookies, localStorage, etc., that normal web renderers have access to. |
46 class StoragePartition { | 53 class CONTENT_EXPORT StoragePartition { |
47 public: | 54 public: |
48 virtual base::FilePath GetPath() = 0; | 55 virtual base::FilePath GetPath() = 0; |
49 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; | 56 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; |
50 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; | 57 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; |
51 virtual quota::QuotaManager* GetQuotaManager() = 0; | 58 virtual quota::QuotaManager* GetQuotaManager() = 0; |
52 virtual AppCacheService* GetAppCacheService() = 0; | 59 virtual AppCacheService* GetAppCacheService() = 0; |
53 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; | 60 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; |
54 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; | 61 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; |
55 virtual DOMStorageContext* GetDOMStorageContext() = 0; | 62 virtual DOMStorageContext* GetDOMStorageContext() = 0; |
56 virtual IndexedDBContext* GetIndexedDBContext() = 0; | 63 virtual IndexedDBContext* GetIndexedDBContext() = 0; |
57 virtual ServiceWorkerContext* GetServiceWorkerContext() = 0; | 64 virtual ServiceWorkerContext* GetServiceWorkerContext() = 0; |
58 | 65 |
59 enum RemoveDataMask { | 66 static const uint32 REMOVE_DATA_MASK_APPCACHE; |
60 REMOVE_DATA_MASK_APPCACHE = 1 << 0, | 67 static const uint32 REMOVE_DATA_MASK_COOKIES; |
61 REMOVE_DATA_MASK_COOKIES = 1 << 1, | 68 static const uint32 REMOVE_DATA_MASK_FILE_SYSTEMS; |
62 REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2, | 69 static const uint32 REMOVE_DATA_MASK_INDEXEDDB; |
63 REMOVE_DATA_MASK_INDEXEDDB = 1 << 3, | 70 static const uint32 REMOVE_DATA_MASK_LOCAL_STORAGE; |
64 REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4, | 71 static const uint32 REMOVE_DATA_MASK_SHADER_CACHE; |
65 REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5, | 72 static const uint32 REMOVE_DATA_MASK_WEBSQL; |
66 REMOVE_DATA_MASK_WEBSQL = 1 << 6, | 73 static const uint32 REMOVE_DATA_MASK_WEBRTC_IDENTITY; |
67 REMOVE_DATA_MASK_WEBRTC_IDENTITY = 1 << 7, | 74 static const uint32 REMOVE_DATA_MASK_ALL; |
68 REMOVE_DATA_MASK_ALL = -1 | |
69 }; | |
70 | 75 |
71 enum QuotaManagedStorageMask { | 76 // Corresponds to quota::kStorageTypeTemporary. |
72 // Corresponds to quota::kStorageTypeTemporary. | 77 static const uint32 QUOTA_MANAGED_STORAGE_MASK_TEMPORARY; |
73 QUOTA_MANAGED_STORAGE_MASK_TEMPORARY = 1 << 0, | 78 // Corresponds to quota::kStorageTypePersistent. |
74 | 79 static const uint32 QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; |
75 // Corresponds to quota::kStorageTypePersistent. | 80 // Corresponds to quota::kStorageTypeSyncable. |
76 QUOTA_MANAGED_STORAGE_MASK_PERSISTENT = 1 << 1, | 81 static const uint32 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE; |
77 | 82 static const uint32 QUOTA_MANAGED_STORAGE_MASK_ALL; |
78 // Corresponds to quota::kStorageTypeSyncable. | |
79 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2, | |
80 | |
81 QUOTA_MANAGED_STORAGE_MASK_ALL = -1 | |
82 }; | |
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 // | 89 // |
90 // TODO(ajwong): Right now, the embedder may have some | 90 // TODO(ajwong): Right now, the embedder may have some |
91 // URLRequestContextGetter objects that the StoragePartition does not know | 91 // URLRequestContextGetter objects that the StoragePartition does not know |
92 // about. This will no longer be the case when we resolve | 92 // about. This will no longer be the case when we resolve |
(...skipping 25 matching lines...) Expand all Loading... |
118 const base::Time end, | 118 const base::Time end, |
119 const base::Closure& callback) = 0; | 119 const base::Closure& callback) = 0; |
120 | 120 |
121 protected: | 121 protected: |
122 virtual ~StoragePartition() {} | 122 virtual ~StoragePartition() {} |
123 }; | 123 }; |
124 | 124 |
125 } // namespace content | 125 } // namespace content |
126 | 126 |
127 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 127 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
OLD | NEW |