OLD | NEW |
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_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "content/common/content_export.h" |
9 #include "content/public/browser/dom_storage_context.h" | 10 #include "content/public/browser/dom_storage_context.h" |
10 | 11 |
11 namespace base { | 12 namespace base { |
12 class FilePath; | 13 class FilePath; |
13 } | 14 } |
14 | 15 |
15 namespace dom_storage { | |
16 class DomStorageContext; | |
17 } | |
18 | |
19 namespace quota { | 16 namespace quota { |
20 class SpecialStoragePolicy; | 17 class SpecialStoragePolicy; |
21 } | 18 } |
22 | 19 |
23 namespace content { | 20 namespace content { |
24 | 21 |
| 22 class DOMStorageContextImpl; |
| 23 |
25 // This is owned by BrowserContext (aka Profile) and encapsulates all | 24 // This is owned by BrowserContext (aka Profile) and encapsulates all |
26 // per-profile dom storage state. | 25 // per-profile dom storage state. |
27 class CONTENT_EXPORT DOMStorageContextImpl : | 26 class CONTENT_EXPORT DOMStorageContextWrapper : |
28 NON_EXPORTED_BASE(public DOMStorageContext), | 27 NON_EXPORTED_BASE(public DOMStorageContext), |
29 public base::RefCountedThreadSafe<DOMStorageContextImpl> { | 28 public base::RefCountedThreadSafe<DOMStorageContextWrapper> { |
30 public: | 29 public: |
31 // If |data_path| is empty, nothing will be saved to disk. | 30 // If |data_path| is empty, nothing will be saved to disk. |
32 DOMStorageContextImpl(const base::FilePath& data_path, | 31 DOMStorageContextWrapper(const base::FilePath& data_path, |
33 quota::SpecialStoragePolicy* special_storage_policy); | 32 quota::SpecialStoragePolicy* special_storage_policy); |
34 | 33 |
35 // DOMStorageContext implementation. | 34 // DOMStorageContext implementation. |
36 virtual void GetLocalStorageUsage( | 35 virtual void GetLocalStorageUsage( |
37 const GetLocalStorageUsageCallback& callback) OVERRIDE; | 36 const GetLocalStorageUsageCallback& callback) OVERRIDE; |
38 virtual void GetSessionStorageUsage( | 37 virtual void GetSessionStorageUsage( |
39 const GetSessionStorageUsageCallback& callback) OVERRIDE; | 38 const GetSessionStorageUsageCallback& callback) OVERRIDE; |
40 virtual void DeleteLocalStorage(const GURL& origin) OVERRIDE; | 39 virtual void DeleteLocalStorage(const GURL& origin) OVERRIDE; |
41 virtual void DeleteSessionStorage( | 40 virtual void DeleteSessionStorage( |
42 const dom_storage::SessionStorageUsageInfo& usage_info) OVERRIDE; | 41 const SessionStorageUsageInfo& usage_info) OVERRIDE; |
43 virtual void SetSaveSessionStorageOnDisk() OVERRIDE; | 42 virtual void SetSaveSessionStorageOnDisk() OVERRIDE; |
44 virtual scoped_refptr<SessionStorageNamespace> | 43 virtual scoped_refptr<SessionStorageNamespace> |
45 RecreateSessionStorage(const std::string& persistent_id) OVERRIDE; | 44 RecreateSessionStorage(const std::string& persistent_id) OVERRIDE; |
46 virtual void StartScavengingUnusedSessionStorage() OVERRIDE; | 45 virtual void StartScavengingUnusedSessionStorage() OVERRIDE; |
47 | 46 |
48 // Called to free up memory that's not strictly needed. | 47 // Called to free up memory that's not strictly needed. |
49 void PurgeMemory(); | 48 void PurgeMemory(); |
50 | 49 |
51 // Used by content settings to alter the behavior around | 50 // Used by content settings to alter the behavior around |
52 // what data to keep and what data to discard at shutdown. | 51 // what data to keep and what data to discard at shutdown. |
53 // The policy is not so straight forward to describe, see | 52 // The policy is not so straight forward to describe, see |
54 // the implementation for details. | 53 // the implementation for details. |
55 void SetForceKeepSessionState(); | 54 void SetForceKeepSessionState(); |
56 | 55 |
57 // Called when the BrowserContext/Profile is going away. | 56 // Called when the BrowserContext/Profile is going away. |
58 void Shutdown(); | 57 void Shutdown(); |
59 | 58 |
60 private: | 59 private: |
61 friend class DOMStorageMessageFilter; // for access to context() | 60 friend class DOMStorageMessageFilter; // for access to context() |
62 friend class SessionStorageNamespaceImpl; // ditto | 61 friend class SessionStorageNamespaceImpl; // ditto |
63 friend class base::RefCountedThreadSafe<DOMStorageContextImpl>; | 62 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>; |
64 | 63 |
65 virtual ~DOMStorageContextImpl(); | 64 virtual ~DOMStorageContextWrapper(); |
66 dom_storage::DomStorageContext* context() const { return context_.get(); } | 65 DOMStorageContextImpl* context() const { return context_.get(); } |
67 | 66 |
68 scoped_refptr<dom_storage::DomStorageContext> context_; | 67 scoped_refptr<DOMStorageContextImpl> context_; |
69 | 68 |
70 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl); | 69 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); |
71 }; | 70 }; |
72 | 71 |
73 } // namespace content | 72 } // namespace content |
74 | 73 |
75 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ | 74 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
OLD | NEW |