| 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 CookieStore; |
| 24 class URLRequestContextGetter; | 25 class URLRequestContextGetter; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace quota { | 28 namespace quota { |
| 28 class QuotaManager; | 29 class QuotaManager; |
| 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; |
| 39 class CookieStoreMap; |
| 40 class DOMStorageContext; |
| 38 class IndexedDBContext; | 41 class IndexedDBContext; |
| 39 class DOMStorageContext; | |
| 40 | 42 |
| 41 // Defines what persistent state a child process can access. | 43 // Defines what persistent state a child process can access. |
| 42 // | 44 // |
| 43 // The StoragePartition defines the view each child process has of the | 45 // The StoragePartition defines the view each child process has of the |
| 44 // persistent state inside the BrowserContext. This is used to implement | 46 // persistent state inside the BrowserContext. This is used to implement |
| 45 // isolated storage where a renderer with isolated storage cannot see | 47 // isolated storage where a renderer with isolated storage cannot see |
| 46 // the cookies, localStorage, etc., that normal web renderers have access to. | 48 // the cookies, localStorage, etc., that normal web renderers have access to. |
| 47 class StoragePartition { | 49 class StoragePartition { |
| 48 public: | 50 public: |
| 49 virtual base::FilePath GetPath() = 0; | 51 virtual base::FilePath GetPath() = 0; |
| 50 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; | 52 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; |
| 51 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; | 53 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; |
| 52 virtual quota::QuotaManager* GetQuotaManager() = 0; | 54 virtual quota::QuotaManager* GetQuotaManager() = 0; |
| 53 virtual appcache::AppCacheService* GetAppCacheService() = 0; | 55 virtual appcache::AppCacheService* GetAppCacheService() = 0; |
| 54 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; | 56 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; |
| 55 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; | 57 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; |
| 56 virtual DOMStorageContext* GetDOMStorageContext() = 0; | 58 virtual DOMStorageContext* GetDOMStorageContext() = 0; |
| 57 virtual IndexedDBContext* GetIndexedDBContext() = 0; | 59 virtual IndexedDBContext* GetIndexedDBContext() = 0; |
| 60 virtual net::CookieStore* GetCookieStoreForScheme( |
| 61 const std::string& scheme) = 0; |
| 58 | 62 |
| 59 enum RemoveDataMask { | 63 enum RemoveDataMask { |
| 60 REMOVE_DATA_MASK_APPCACHE = 1 << 0, | 64 REMOVE_DATA_MASK_APPCACHE = 1 << 0, |
| 61 REMOVE_DATA_MASK_COOKIES = 1 << 1, | 65 REMOVE_DATA_MASK_COOKIES = 1 << 1, |
| 62 REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2, | 66 REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2, |
| 63 REMOVE_DATA_MASK_INDEXEDDB = 1 << 3, | 67 REMOVE_DATA_MASK_INDEXEDDB = 1 << 3, |
| 64 REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4, | 68 REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4, |
| 65 REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5, | 69 REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5, |
| 66 REMOVE_DATA_MASK_WEBSQL = 1 << 6, | 70 REMOVE_DATA_MASK_WEBSQL = 1 << 6, |
| 67 REMOVE_DATA_MASK_WEBRTC_IDENTITY = 1 << 7, | 71 REMOVE_DATA_MASK_WEBRTC_IDENTITY = 1 << 7, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 79 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2, | 83 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2, |
| 80 | 84 |
| 81 QUOTA_MANAGED_STORAGE_MASK_ALL = -1 | 85 QUOTA_MANAGED_STORAGE_MASK_ALL = -1 |
| 82 }; | 86 }; |
| 83 | 87 |
| 84 // Starts an asynchronous task that does a best-effort clear the data | 88 // Starts an asynchronous task that does a best-effort clear the data |
| 85 // corresponding to the given |remove_mask| and |quota_storage_remove_mask| | 89 // corresponding to the given |remove_mask| and |quota_storage_remove_mask| |
| 86 // inside this StoragePartition for the given |storage_origin|. | 90 // inside this StoragePartition for the given |storage_origin|. |
| 87 // Note session dom storage is not cleared even if you specify | 91 // Note session dom storage is not cleared even if you specify |
| 88 // REMOVE_DATA_MASK_LOCAL_STORAGE. | 92 // REMOVE_DATA_MASK_LOCAL_STORAGE. |
| 89 // | |
| 90 // TODO(ajwong): Right now, the embedder may have some | |
| 91 // URLRequestContextGetter objects that the StoragePartition does not know | |
| 92 // about. This will no longer be the case when we resolve | |
| 93 // http://crbug.com/159193. Remove |request_context_getter| when that bug | |
| 94 // is fixed. | |
| 95 virtual void ClearDataForOrigin(uint32 remove_mask, | 93 virtual void ClearDataForOrigin(uint32 remove_mask, |
| 96 uint32 quota_storage_remove_mask, | 94 uint32 quota_storage_remove_mask, |
| 97 const GURL& storage_origin, | 95 const GURL& storage_origin) = 0; |
| 98 net::URLRequestContextGetter* rq_context) = 0; | |
| 99 | 96 |
| 100 // Similar to ClearDataForOrigin(), but deletes all data out of the | 97 // Similar to ClearDataForOrigin(), but deletes all data out of the |
| 101 // StoragePartition rather than just the data related to this origin. | 98 // StoragePartition rather than just the data related to this origin. |
| 102 virtual void ClearDataForUnboundedRange(uint32 remove_mask, | 99 virtual void ClearDataForUnboundedRange(uint32 remove_mask, |
| 103 uint32 quota_storage_remove_mask) = 0; | 100 uint32 quota_storage_remove_mask) = 0; |
| 104 | 101 |
| 105 // Similar to ClearDataForOrigin(), but deletes all the data out of the | 102 // Similar to ClearDataForOrigin(), but deletes all the data out of the |
| 106 // StoragePartion from between the given |begin| and |end| dates rather | 103 // StoragePartion from between the given |begin| and |end| dates rather |
| 107 // then just the data related to this origin. | 104 // then just the data related to this origin. |
| 108 virtual void ClearDataForRange(uint32 remove_mask, | 105 virtual void ClearDataForRange(uint32 remove_mask, |
| 109 uint32 quota_storage_remove_mask, | 106 uint32 quota_storage_remove_mask, |
| 110 const base::Time& begin, | 107 const base::Time& begin, |
| 111 const base::Time& end, | 108 const base::Time& end, |
| 112 const base::Closure& callback) = 0; | 109 const base::Closure& callback) = 0; |
| 113 | 110 |
| 114 protected: | 111 protected: |
| 115 virtual ~StoragePartition() {} | 112 virtual ~StoragePartition() {} |
| 116 }; | 113 }; |
| 117 | 114 |
| 118 } // namespace content | 115 } // namespace content |
| 119 | 116 |
| 120 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ | 117 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ |
| OLD | NEW |