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

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

Issue 22297005: Move webkit/{browser,common}/dom_storage into content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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_DOM_STORAGE_CONTEXT_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ 6 #define CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/time/time.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 14 #include "url/gurl.h"
14 class GURL;
15
16 namespace dom_storage {
17 struct LocalStorageUsageInfo;
18 struct SessionStorageUsageInfo;
19 }
20 15
21 namespace content { 16 namespace content {
22 17
23 class BrowserContext; 18 class BrowserContext;
19 struct LocalStorageUsageInfo;
24 class SessionStorageNamespace; 20 class SessionStorageNamespace;
21 struct SessionStorageUsageInfo;
25 22
26 // Represents the per-BrowserContext Local Storage data. 23 // Represents the per-BrowserContext Local Storage data.
27 class DOMStorageContext { 24 class DOMStorageContext {
28 public: 25 public:
29 typedef base::Callback< 26 typedef base::Callback<
30 void(const std::vector<dom_storage::LocalStorageUsageInfo>&)> 27 void(const std::vector<LocalStorageUsageInfo>&)>
31 GetLocalStorageUsageCallback; 28 GetLocalStorageUsageCallback;
32 29
33 typedef base::Callback< 30 typedef base::Callback<
34 void(const std::vector<dom_storage::SessionStorageUsageInfo>&)> 31 void(const std::vector<SessionStorageUsageInfo>&)>
35 GetSessionStorageUsageCallback; 32 GetSessionStorageUsageCallback;
36 33
37 // Returns a collection of origins using local storage to the given callback. 34 // Returns a collection of origins using local storage to the given callback.
38 virtual void GetLocalStorageUsage( 35 virtual void GetLocalStorageUsage(
39 const GetLocalStorageUsageCallback& callback) = 0; 36 const GetLocalStorageUsageCallback& callback) = 0;
40 37
41 // Returns a collection of origins using session storage to the given 38 // Returns a collection of origins using session storage to the given
42 // callback. 39 // callback.
43 virtual void GetSessionStorageUsage( 40 virtual void GetSessionStorageUsage(
44 const GetSessionStorageUsageCallback& callback) = 0; 41 const GetSessionStorageUsageCallback& callback) = 0;
45 42
46 // Deletes the local storage data for the given origin. 43 // Deletes the local storage data for the given origin.
47 virtual void DeleteLocalStorage(const GURL& origin) = 0; 44 virtual void DeleteLocalStorage(const GURL& origin) = 0;
48 45
49 // Deletes the session storage data identified by |usage_info|. 46 // Deletes the session storage data identified by |usage_info|.
50 virtual void DeleteSessionStorage( 47 virtual void DeleteSessionStorage(
51 const dom_storage::SessionStorageUsageInfo& usage_info) = 0; 48 const SessionStorageUsageInfo& usage_info) = 0;
52 49
53 // If this is called, sessionStorage data will be stored on disk, and can be 50 // If this is called, sessionStorage data will be stored on disk, and can be
54 // restored after a browser restart (with RecreateSessionStorage). This 51 // restored after a browser restart (with RecreateSessionStorage). This
55 // function must be called right after DOMStorageContextImpl is created, and 52 // function must be called right after DOMStorageContextProxy is created, and
56 // before it's used. 53 // before it's used.
57 virtual void SetSaveSessionStorageOnDisk() = 0; 54 virtual void SetSaveSessionStorageOnDisk() = 0;
58 55
59 // Creates a SessionStorageNamespace with the given |persistent_id|. Used 56 // Creates a SessionStorageNamespace with the given |persistent_id|. Used
60 // after tabs are restored by session restore. When created, the 57 // after tabs are restored by session restore. When created, the
61 // SessionStorageNamespace with the correct |persistent_id| will be 58 // SessionStorageNamespace with the correct |persistent_id| will be
62 // associated with the persisted sessionStorage data. 59 // associated with the persisted sessionStorage data.
63 virtual scoped_refptr<SessionStorageNamespace> RecreateSessionStorage( 60 virtual scoped_refptr<SessionStorageNamespace> RecreateSessionStorage(
64 const std::string& persistent_id) = 0; 61 const std::string& persistent_id) = 0;
65 62
66 // Starts deleting sessionStorages which don't have an associated 63 // Starts deleting sessionStorages which don't have an associated
67 // SessionStorageNamespace alive. Called when SessionStorageNamespaces have 64 // SessionStorageNamespace alive. Called when SessionStorageNamespaces have
68 // been created after a session restore, or a session restore won't happen. 65 // been created after a session restore, or a session restore won't happen.
69 virtual void StartScavengingUnusedSessionStorage() = 0; 66 virtual void StartScavengingUnusedSessionStorage() = 0;
70 67
71 protected: 68 protected:
72 virtual ~DOMStorageContext() {} 69 virtual ~DOMStorageContext() {}
73 }; 70 };
74 71
72 // Used to report Local Storage usage info by DOMStorageContext.
73 struct CONTENT_EXPORT LocalStorageUsageInfo {
jam 2013/08/06 16:13:49 per content api conventions (http://www.chromium.o
kinuko 2013/08/07 14:29:52 Done.
74 GURL origin;
75 size_t data_size;
76 base::Time last_modified;
77
78 LocalStorageUsageInfo();
79 ~LocalStorageUsageInfo();
80 };
81
82 // Used to report Session Storage usage info by DOMStorageContext.
83 struct CONTENT_EXPORT SessionStorageUsageInfo {
84 GURL origin;
85 std::string persistent_namespace_id;
86
87 SessionStorageUsageInfo();
88 ~SessionStorageUsageInfo();
89 };
90
75 } // namespace content 91 } // namespace content
76 92
77 #endif // CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ 93 #endif // CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698