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