Update broken references to image assets
[chromium-blink-merge.git] / content / public / browser / storage_partition.h
blob9adfd67a8be424bde9c456ce7e36a5555a0bbc04
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_
6 #define CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
12 #include "base/files/file_path.h"
13 #include "base/time/time.h"
14 #include "content/common/content_export.h"
16 class GURL;
18 namespace base {
19 class Time;
22 namespace storage {
23 class FileSystemContext;
26 namespace net {
27 class URLRequestContextGetter;
30 namespace storage {
31 class QuotaManager;
32 class SpecialStoragePolicy;
35 namespace storage {
36 class DatabaseTracker;
39 namespace content {
41 class AppCacheService;
42 class BackgroundSyncContext;
43 class BrowserContext;
44 class HostZoomLevelContext;
45 class HostZoomMap;
46 class DOMStorageContext;
47 class GeofencingManager;
48 class IndexedDBContext;
49 class NavigatorConnectContext;
50 class PlatformNotificationContext;
51 class ServiceWorkerContext;
52 class ZoomLevelDelegate;
54 // Defines what persistent state a child process can access.
56 // The StoragePartition defines the view each child process has of the
57 // persistent state inside the BrowserContext. This is used to implement
58 // isolated storage where a renderer with isolated storage cannot see
59 // the cookies, localStorage, etc., that normal web renderers have access to.
60 class CONTENT_EXPORT StoragePartition {
61 public:
62 virtual base::FilePath GetPath() = 0;
63 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0;
64 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0;
65 virtual storage::QuotaManager* GetQuotaManager() = 0;
66 virtual AppCacheService* GetAppCacheService() = 0;
67 virtual storage::FileSystemContext* GetFileSystemContext() = 0;
68 virtual storage::DatabaseTracker* GetDatabaseTracker() = 0;
69 virtual DOMStorageContext* GetDOMStorageContext() = 0;
70 virtual IndexedDBContext* GetIndexedDBContext() = 0;
71 virtual ServiceWorkerContext* GetServiceWorkerContext() = 0;
72 virtual GeofencingManager* GetGeofencingManager() = 0;
73 virtual HostZoomMap* GetHostZoomMap() = 0;
74 virtual HostZoomLevelContext* GetHostZoomLevelContext() = 0;
75 virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0;
76 virtual NavigatorConnectContext* GetNavigatorConnectContext() = 0;
77 virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0;
78 virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0;
80 enum : uint32 {
81 REMOVE_DATA_MASK_APPCACHE = 1 << 0,
82 REMOVE_DATA_MASK_COOKIES = 1 << 1,
83 REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2,
84 REMOVE_DATA_MASK_INDEXEDDB = 1 << 3,
85 REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4,
86 REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5,
87 REMOVE_DATA_MASK_WEBSQL = 1 << 6,
88 REMOVE_DATA_MASK_WEBRTC_IDENTITY = 1 << 7,
89 REMOVE_DATA_MASK_SERVICE_WORKERS = 1 << 8,
90 REMOVE_DATA_MASK_ALL = 0xFFFFFFFF,
92 // Corresponds to storage::kStorageTypeTemporary.
93 QUOTA_MANAGED_STORAGE_MASK_TEMPORARY = 1 << 0,
94 // Corresponds to storage::kStorageTypePersistent.
95 QUOTA_MANAGED_STORAGE_MASK_PERSISTENT = 1 << 1,
96 // Corresponds to storage::kStorageTypeSyncable.
97 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2,
98 QUOTA_MANAGED_STORAGE_MASK_ALL = 0xFFFFFFFF,
101 // Starts an asynchronous task that does a best-effort clear the data
102 // corresponding to the given |remove_mask| and |quota_storage_remove_mask|
103 // inside this StoragePartition for the given |storage_origin|.
104 // Note session dom storage is not cleared even if you specify
105 // REMOVE_DATA_MASK_LOCAL_STORAGE.
106 // |callback| is called when data deletion is done or at least the deletion is
107 // scheduled.
109 // TODO(ajwong): Right now, the embedder may have some
110 // URLRequestContextGetter objects that the StoragePartition does not know
111 // about. This will no longer be the case when we resolve
112 // http://crbug.com/159193. Remove |request_context_getter| when that bug
113 // is fixed.
114 virtual void ClearDataForOrigin(uint32 remove_mask,
115 uint32 quota_storage_remove_mask,
116 const GURL& storage_origin,
117 net::URLRequestContextGetter* rq_context,
118 const base::Closure& callback) = 0;
120 // A callback type to check if a given origin matches a storage policy.
121 // Can be passed empty/null where used, which means the origin will always
122 // match.
123 typedef base::Callback<bool(const GURL&, storage::SpecialStoragePolicy*)>
124 OriginMatcherFunction;
126 // Similar to ClearDataForOrigin().
127 // Deletes all data out fo the StoragePartition if |storage_origin| is
128 // nullptr.
129 // |origin_matcher| is present if special storage policy is to be handled,
130 // otherwise the callback can be null (base::Callback::is_null() == true).
131 // |callback| is called when data deletion is done or at least the deletion is
132 // scheduled.
133 virtual void ClearData(uint32 remove_mask,
134 uint32 quota_storage_remove_mask,
135 const GURL& storage_origin,
136 const OriginMatcherFunction& origin_matcher,
137 const base::Time begin,
138 const base::Time end,
139 const base::Closure& callback) = 0;
141 // Write any unwritten data to disk.
142 // Note: this method does not sync the data - it only ensures that any
143 // unwritten data has been written out to the filesystem.
144 virtual void Flush() = 0;
146 protected:
147 virtual ~StoragePartition() {}
150 } // namespace content
152 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_