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