| 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 17 matching lines...) Expand all Loading... |
| 28 class QuotaManager; | 28 class QuotaManager; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace webkit_database { | 31 namespace webkit_database { |
| 32 class DatabaseTracker; | 32 class DatabaseTracker; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace content { | 35 namespace content { |
| 36 | 36 |
| 37 class BrowserContext; | 37 class BrowserContext; |
| 38 class CookieStoreMap; |
| 39 class DOMStorageContext; |
| 38 class IndexedDBContext; | 40 class IndexedDBContext; |
| 39 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: |
| 49 virtual base::FilePath GetPath() = 0; | 50 virtual base::FilePath GetPath() = 0; |
| 50 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; | 51 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; |
| 51 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; | 52 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; |
| 52 virtual quota::QuotaManager* GetQuotaManager() = 0; | 53 virtual quota::QuotaManager* GetQuotaManager() = 0; |
| 53 virtual appcache::AppCacheService* GetAppCacheService() = 0; | 54 virtual appcache::AppCacheService* GetAppCacheService() = 0; |
| 54 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; | 55 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; |
| 55 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; | 56 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; |
| 56 virtual DOMStorageContext* GetDOMStorageContext() = 0; | 57 virtual DOMStorageContext* GetDOMStorageContext() = 0; |
| 57 virtual IndexedDBContext* GetIndexedDBContext() = 0; | 58 virtual IndexedDBContext* GetIndexedDBContext() = 0; |
| 59 virtual const CookieStoreMap& GetCookieStoreMap() = 0; |
| 58 | 60 |
| 59 enum StorageMask { | 61 enum StorageMask { |
| 60 kCookies = 1 << 0, | 62 kCookies = 1 << 0, |
| 61 | 63 |
| 62 // Corresponds to quota::kStorageTypeTemporary. | 64 // Corresponds to quota::kStorageTypeTemporary. |
| 63 kQuotaManagedTemporaryStorage = 1 << 1, | 65 kQuotaManagedTemporaryStorage = 1 << 1, |
| 64 | 66 |
| 65 // Corresponds to quota::kStorageTypePersistent. | 67 // Corresponds to quota::kStorageTypePersistent. |
| 66 kQuotaManagedPersistentStorage = 1 << 2, | 68 kQuotaManagedPersistentStorage = 1 << 2, |
| 67 | 69 |
| 68 // Local dom storage. | 70 // Local dom storage. |
| 69 kLocalDomStorage = 1 << 3, | 71 kLocalDomStorage = 1 << 3, |
| 70 kSessionDomStorage = 1 << 4, | 72 kSessionDomStorage = 1 << 4, |
| 71 | 73 |
| 72 // Local shader storage. | 74 // Local shader storage. |
| 73 kShaderStorage = 1 << 5, | 75 kShaderStorage = 1 << 5, |
| 74 | 76 |
| 75 // Corresponds to quota::kStorageTypeSyncable. | 77 // Corresponds to quota::kStorageTypeSyncable. |
| 76 kQuotaManagedSyncableStorage = 1 << 6, | 78 kQuotaManagedSyncableStorage = 1 << 6, |
| 77 | 79 |
| 78 kAllStorage = -1, | 80 kAllStorage = -1, |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 // Starts an asynchronous task that does a best-effort clear the data | 83 // Starts an asynchronous task that does a best-effort clear the data |
| 82 // corresonding to the given |storage_mask| inside this StoragePartition for | 84 // corresonding to the given |storage_mask| inside this StoragePartition for |
| 83 // the given |storage_origin|. Note kSessionDomStorage is not cleared and the | 85 // the given |storage_origin|. Note kSessionDomStorage is not cleared and the |
| 84 // mask is ignored. | 86 // mask is ignored. |
| 85 // | |
| 86 // TODO(ajwong): Right now, the embedder may have some | |
| 87 // URLRequestContextGetter objects that the StoragePartition does not know | |
| 88 // about. This will no longer be the case when we resolve | |
| 89 // http://crbug.com/159193. Remove |request_context_getter| when that bug | |
| 90 // is fixed. | |
| 91 virtual void AsyncClearDataForOrigin( | 87 virtual void AsyncClearDataForOrigin( |
| 92 uint32 storage_mask, | 88 uint32 storage_mask, |
| 93 const GURL& storage_origin, | 89 const GURL& storage_origin) = 0; |
| 94 net::URLRequestContextGetter* request_context_getter) = 0; | |
| 95 | 90 |
| 96 // Similar to AsyncClearDataForOrigin(), but deletes all data out of the | 91 // Similar to AsyncClearDataForOrigin(), but deletes all data out of the |
| 97 // StoragePartition rather than just the data related to this origin. | 92 // StoragePartition rather than just the data related to this origin. |
| 98 virtual void AsyncClearData(uint32 storage_mask) = 0; | 93 virtual void AsyncClearData(uint32 storage_mask) = 0; |
| 99 | 94 |
| 100 // Similar to AsyncClearDataForOrigin(), but deletes all the data out of the | 95 // Similar to AsyncClearDataForOrigin(), but deletes all the data out of the |
| 101 // StoragePartion from between the given |begin| and |end| dates rather | 96 // StoragePartion from between the given |begin| and |end| dates rather |
| 102 // then just the data related to this origin. | 97 // then just the data related to this origin. |
| 103 // | 98 // |
| 104 // Note: This currently only supports the shader cache. | 99 // Note: This currently only supports the shader cache. |
| 105 virtual void AsyncClearDataBetween(uint32 storage_mask, | 100 virtual void AsyncClearDataBetween(uint32 storage_mask, |
| 106 const base::Time& begin, | 101 const base::Time& begin, |
| 107 const base::Time& end, | 102 const base::Time& end, |
| 108 const base::Closure& callback) = 0; | 103 const base::Closure& callback) = 0; |
| 109 protected: | 104 protected: |
| 110 virtual ~StoragePartition() {} | 105 virtual ~StoragePartition() {} |
| 111 }; | 106 }; |
| 112 | 107 |
| 113 } // namespace content | 108 } // namespace content |
| 114 | 109 |
| 115 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 110 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
| OLD | NEW |