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