Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: content/public/browser/storage_partition.h

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 15
16 class GURL; 16 class GURL;
17 17
18 namespace base { 18 namespace base {
19 class Time; 19 class Time;
20 } 20 }
21 21
22 namespace fileapi { 22 namespace storage {
23 class FileSystemContext; 23 class FileSystemContext;
24 } 24 }
25 25
26 namespace net { 26 namespace net {
27 class URLRequestContextGetter; 27 class URLRequestContextGetter;
28 } 28 }
29 29
30 namespace quota { 30 namespace storage {
31 class QuotaManager; 31 class QuotaManager;
32 class SpecialStoragePolicy; 32 class SpecialStoragePolicy;
33 } 33 }
34 34
35 namespace webkit_database { 35 namespace storage {
36 class DatabaseTracker; 36 class DatabaseTracker;
37 } 37 }
38 38
39 namespace content { 39 namespace content {
40 40
41 class AppCacheService; 41 class AppCacheService;
42 class BrowserContext; 42 class BrowserContext;
43 class IndexedDBContext; 43 class IndexedDBContext;
44 class DOMStorageContext; 44 class DOMStorageContext;
45 class ServiceWorkerContext; 45 class ServiceWorkerContext;
46 46
47 // Defines what persistent state a child process can access. 47 // Defines what persistent state a child process can access.
48 // 48 //
49 // The StoragePartition defines the view each child process has of the 49 // The StoragePartition defines the view each child process has of the
50 // persistent state inside the BrowserContext. This is used to implement 50 // persistent state inside the BrowserContext. This is used to implement
51 // isolated storage where a renderer with isolated storage cannot see 51 // isolated storage where a renderer with isolated storage cannot see
52 // the cookies, localStorage, etc., that normal web renderers have access to. 52 // the cookies, localStorage, etc., that normal web renderers have access to.
53 class CONTENT_EXPORT StoragePartition { 53 class CONTENT_EXPORT StoragePartition {
54 public: 54 public:
55 virtual base::FilePath GetPath() = 0; 55 virtual base::FilePath GetPath() = 0;
56 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0; 56 virtual net::URLRequestContextGetter* GetURLRequestContext() = 0;
57 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0; 57 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() = 0;
58 virtual quota::QuotaManager* GetQuotaManager() = 0; 58 virtual storage::QuotaManager* GetQuotaManager() = 0;
59 virtual AppCacheService* GetAppCacheService() = 0; 59 virtual AppCacheService* GetAppCacheService() = 0;
60 virtual fileapi::FileSystemContext* GetFileSystemContext() = 0; 60 virtual storage::FileSystemContext* GetFileSystemContext() = 0;
61 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0; 61 virtual storage::DatabaseTracker* GetDatabaseTracker() = 0;
62 virtual DOMStorageContext* GetDOMStorageContext() = 0; 62 virtual DOMStorageContext* GetDOMStorageContext() = 0;
63 virtual IndexedDBContext* GetIndexedDBContext() = 0; 63 virtual IndexedDBContext* GetIndexedDBContext() = 0;
64 virtual ServiceWorkerContext* GetServiceWorkerContext() = 0; 64 virtual ServiceWorkerContext* GetServiceWorkerContext() = 0;
65 65
66 static const uint32 REMOVE_DATA_MASK_APPCACHE = 1 << 0; 66 static const uint32 REMOVE_DATA_MASK_APPCACHE = 1 << 0;
67 static const uint32 REMOVE_DATA_MASK_COOKIES = 1 << 1; 67 static const uint32 REMOVE_DATA_MASK_COOKIES = 1 << 1;
68 static const uint32 REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2; 68 static const uint32 REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2;
69 static const uint32 REMOVE_DATA_MASK_INDEXEDDB = 1 << 3; 69 static const uint32 REMOVE_DATA_MASK_INDEXEDDB = 1 << 3;
70 static const uint32 REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4; 70 static const uint32 REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4;
71 static const uint32 REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5; 71 static const uint32 REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5;
72 static const uint32 REMOVE_DATA_MASK_WEBSQL = 1 << 6; 72 static const uint32 REMOVE_DATA_MASK_WEBSQL = 1 << 6;
73 static const uint32 REMOVE_DATA_MASK_WEBRTC_IDENTITY = 1 << 7; 73 static const uint32 REMOVE_DATA_MASK_WEBRTC_IDENTITY = 1 << 7;
74 static const uint32 REMOVE_DATA_MASK_SERVICE_WORKERS = 1 << 8; 74 static const uint32 REMOVE_DATA_MASK_SERVICE_WORKERS = 1 << 8;
75 static const uint32 REMOVE_DATA_MASK_ALL = 0xFFFFFFFF; 75 static const uint32 REMOVE_DATA_MASK_ALL = 0xFFFFFFFF;
76 76
77 // Corresponds to quota::kStorageTypeTemporary. 77 // Corresponds to storage::kStorageTypeTemporary.
78 static const uint32 QUOTA_MANAGED_STORAGE_MASK_TEMPORARY = 1 << 0; 78 static const uint32 QUOTA_MANAGED_STORAGE_MASK_TEMPORARY = 1 << 0;
79 // Corresponds to quota::kStorageTypePersistent. 79 // Corresponds to storage::kStorageTypePersistent.
80 static const uint32 QUOTA_MANAGED_STORAGE_MASK_PERSISTENT = 1 << 1; 80 static const uint32 QUOTA_MANAGED_STORAGE_MASK_PERSISTENT = 1 << 1;
81 // Corresponds to quota::kStorageTypeSyncable. 81 // Corresponds to storage::kStorageTypeSyncable.
82 static const uint32 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2; 82 static const uint32 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2;
83 static const uint32 QUOTA_MANAGED_STORAGE_MASK_ALL = 0xFFFFFFFF; 83 static const uint32 QUOTA_MANAGED_STORAGE_MASK_ALL = 0xFFFFFFFF;
84 84
85 // Starts an asynchronous task that does a best-effort clear the data 85 // Starts an asynchronous task that does a best-effort clear the data
86 // corresponding to the given |remove_mask| and |quota_storage_remove_mask| 86 // corresponding to the given |remove_mask| and |quota_storage_remove_mask|
87 // inside this StoragePartition for the given |storage_origin|. 87 // inside this StoragePartition for the given |storage_origin|.
88 // Note session dom storage is not cleared even if you specify 88 // Note session dom storage is not cleared even if you specify
89 // REMOVE_DATA_MASK_LOCAL_STORAGE. 89 // REMOVE_DATA_MASK_LOCAL_STORAGE.
90 // |callback| is called when data deletion is done or at least the deletion is 90 // |callback| is called when data deletion is done or at least the deletion is
91 // scheduled. 91 // scheduled.
92 // 92 //
93 // TODO(ajwong): Right now, the embedder may have some 93 // TODO(ajwong): Right now, the embedder may have some
94 // URLRequestContextGetter objects that the StoragePartition does not know 94 // URLRequestContextGetter objects that the StoragePartition does not know
95 // about. This will no longer be the case when we resolve 95 // about. This will no longer be the case when we resolve
96 // http://crbug.com/159193. Remove |request_context_getter| when that bug 96 // http://crbug.com/159193. Remove |request_context_getter| when that bug
97 // is fixed. 97 // is fixed.
98 virtual void ClearDataForOrigin(uint32 remove_mask, 98 virtual void ClearDataForOrigin(uint32 remove_mask,
99 uint32 quota_storage_remove_mask, 99 uint32 quota_storage_remove_mask,
100 const GURL& storage_origin, 100 const GURL& storage_origin,
101 net::URLRequestContextGetter* rq_context, 101 net::URLRequestContextGetter* rq_context,
102 const base::Closure& callback) = 0; 102 const base::Closure& callback) = 0;
103 103
104 // A callback type to check if a given origin matches a storage policy. 104 // A callback type to check if a given origin matches a storage policy.
105 // Can be passed empty/null where used, which means the origin will always 105 // Can be passed empty/null where used, which means the origin will always
106 // match. 106 // match.
107 typedef base::Callback<bool(const GURL&, 107 typedef base::Callback<bool(const GURL&, storage::SpecialStoragePolicy*)>
108 quota::SpecialStoragePolicy*)>
109 OriginMatcherFunction; 108 OriginMatcherFunction;
110 109
111 // Similar to ClearDataForOrigin(). 110 // Similar to ClearDataForOrigin().
112 // Deletes all data out fo the StoragePartition if |storage_origin| is NULL. 111 // Deletes all data out fo the StoragePartition if |storage_origin| is NULL.
113 // |origin_matcher| is present if special storage policy is to be handled, 112 // |origin_matcher| is present if special storage policy is to be handled,
114 // otherwise the callback can be null (base::Callback::is_null() == true). 113 // otherwise the callback can be null (base::Callback::is_null() == true).
115 // |callback| is called when data deletion is done or at least the deletion is 114 // |callback| is called when data deletion is done or at least the deletion is
116 // scheduled. 115 // scheduled.
117 virtual void ClearData(uint32 remove_mask, 116 virtual void ClearData(uint32 remove_mask,
118 uint32 quota_storage_remove_mask, 117 uint32 quota_storage_remove_mask,
119 const GURL& storage_origin, 118 const GURL& storage_origin,
120 const OriginMatcherFunction& origin_matcher, 119 const OriginMatcherFunction& origin_matcher,
121 const base::Time begin, 120 const base::Time begin,
122 const base::Time end, 121 const base::Time end,
123 const base::Closure& callback) = 0; 122 const base::Closure& callback) = 0;
124 123
125 protected: 124 protected:
126 virtual ~StoragePartition() {} 125 virtual ~StoragePartition() {}
127 }; 126 };
128 127
129 } // namespace content 128 } // namespace content
130 129
131 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_ 130 #endif // CONTENT_PUBLIC_BROWSER_STORAGE_PARTITION_H_
OLDNEW
« no previous file with comments | « content/public/browser/cookie_store_factory.h ('k') | content/public/common/storage_quota_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698