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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "content/public/browser/dom_storage_context.h" | 13 #include "content/public/browser/dom_storage_context.h" |
14 #include "webkit/dom_storage/dom_storage_types.h" | 14 #include "webkit/dom_storage/dom_storage_types.h" |
15 | 15 |
| 16 namespace content { |
| 17 class SessionStorageNamespace; |
| 18 } |
| 19 |
16 namespace dom_storage { | 20 namespace dom_storage { |
17 class DomStorageContext; | 21 class DomStorageContext; |
18 } | 22 } |
19 | 23 |
20 namespace quota { | 24 namespace quota { |
21 class SpecialStoragePolicy; | 25 class SpecialStoragePolicy; |
22 } | 26 } |
23 | 27 |
24 // This is owned by BrowserContext (aka Profile) and encapsulates all | 28 // This is owned by BrowserContext (aka Profile) and encapsulates all |
25 // per-profile dom storage state. | 29 // per-profile dom storage state. |
26 class CONTENT_EXPORT DOMStorageContextImpl : | 30 class CONTENT_EXPORT DOMStorageContextImpl : |
27 NON_EXPORTED_BASE(public content::DOMStorageContext), | 31 NON_EXPORTED_BASE(public content::DOMStorageContext), |
28 public base::RefCountedThreadSafe<DOMStorageContextImpl> { | 32 public base::RefCountedThreadSafe<DOMStorageContextImpl> { |
29 public: | 33 public: |
30 // If |data_path| is empty, nothing will be saved to disk. | 34 // If |data_path| is empty, nothing will be saved to disk. |
31 DOMStorageContextImpl(const FilePath& data_path, | 35 DOMStorageContextImpl(const FilePath& data_path, |
32 quota::SpecialStoragePolicy* special_storage_policy); | 36 quota::SpecialStoragePolicy* special_storage_policy, |
| 37 bool session_storage_on_disk); |
33 | 38 |
34 // DOMStorageContext implementation. | 39 // DOMStorageContext implementation. |
35 virtual void GetAllStorageFiles( | 40 virtual void GetAllStorageFiles( |
36 const GetAllStorageFilesCallback& callback) OVERRIDE; | 41 const GetAllStorageFilesCallback& callback) OVERRIDE; |
37 virtual FilePath GetFilePath(const string16& origin_id) const OVERRIDE; | 42 virtual FilePath GetFilePath(const string16& origin_id) const OVERRIDE; |
38 virtual void DeleteForOrigin(const string16& origin_id) OVERRIDE; | 43 virtual void DeleteForOrigin(const string16& origin_id) OVERRIDE; |
39 virtual void DeleteLocalStorageFile(const FilePath& file_path) OVERRIDE; | 44 virtual void DeleteLocalStorageFile(const FilePath& file_path) OVERRIDE; |
40 virtual void DeleteDataModifiedSince(const base::Time& cutoff) OVERRIDE; | 45 virtual void DeleteDataModifiedSince(const base::Time& cutoff) OVERRIDE; |
| 46 virtual void DoomSessionStorage(int64 namespace_id) OVERRIDE; |
| 47 |
| 48 virtual content::SessionStorageNamespace* CreateSessionStorage( |
| 49 const std::string& persistent_id) OVERRIDE; |
41 | 50 |
42 // Called to free up memory that's not strictly needed. | 51 // Called to free up memory that's not strictly needed. |
43 void PurgeMemory(); | 52 void PurgeMemory(); |
44 | 53 |
45 // Used by content settings to alter the behavior around | 54 // Used by content settings to alter the behavior around |
46 // what data to keep and what data to discard at shutdown. | 55 // what data to keep and what data to discard at shutdown. |
47 // The policy is not so straight forward to describe, see | 56 // The policy is not so straight forward to describe, see |
48 // the implementation for details. | 57 // the implementation for details. |
49 void SetClearLocalState(bool clear_local_state); | 58 void SetClearLocalState(bool clear_local_state); |
50 void SaveSessionState(); | 59 void SaveSessionState(); |
(...skipping 12 matching lines...) Expand all Loading... |
63 | 72 |
64 virtual ~DOMStorageContextImpl(); | 73 virtual ~DOMStorageContextImpl(); |
65 dom_storage::DomStorageContext* context() const { return context_.get(); } | 74 dom_storage::DomStorageContext* context() const { return context_.get(); } |
66 | 75 |
67 scoped_refptr<dom_storage::DomStorageContext> context_; | 76 scoped_refptr<dom_storage::DomStorageContext> context_; |
68 | 77 |
69 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl); | 78 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl); |
70 }; | 79 }; |
71 | 80 |
72 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ | 81 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ |
OLD | NEW |