OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WRAPPER_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 class LevelDBWrapperImpl; | 28 class LevelDBWrapperImpl; |
29 | 29 |
30 // This is owned by Storage Partition and encapsulates all its dom storage | 30 // This is owned by Storage Partition and encapsulates all its dom storage |
31 // state. | 31 // state. |
32 class CONTENT_EXPORT DOMStorageContextWrapper : | 32 class CONTENT_EXPORT DOMStorageContextWrapper : |
33 NON_EXPORTED_BASE(public DOMStorageContext), | 33 NON_EXPORTED_BASE(public DOMStorageContext), |
34 public base::RefCountedThreadSafe<DOMStorageContextWrapper> { | 34 public base::RefCountedThreadSafe<DOMStorageContextWrapper> { |
35 public: | 35 public: |
36 // If |data_path| is empty, nothing will be saved to disk. | 36 // If |data_path| is empty, nothing will be saved to disk. |
37 DOMStorageContextWrapper( | 37 DOMStorageContextWrapper( |
| 38 const std::string& mojo_user_id, |
38 const base::FilePath& data_path, | 39 const base::FilePath& data_path, |
| 40 const base::FilePath& local_partition_path, |
39 storage::SpecialStoragePolicy* special_storage_policy); | 41 storage::SpecialStoragePolicy* special_storage_policy); |
40 | 42 |
41 // DOMStorageContext implementation. | 43 // DOMStorageContext implementation. |
42 void GetLocalStorageUsage( | 44 void GetLocalStorageUsage( |
43 const GetLocalStorageUsageCallback& callback) override; | 45 const GetLocalStorageUsageCallback& callback) override; |
44 void GetSessionStorageUsage( | 46 void GetSessionStorageUsage( |
45 const GetSessionStorageUsageCallback& callback) override; | 47 const GetSessionStorageUsageCallback& callback) override; |
46 void DeleteLocalStorage(const GURL& origin) override; | 48 void DeleteLocalStorage(const GURL& origin) override; |
47 void DeleteSessionStorage(const SessionStorageUsageInfo& usage_info) override; | 49 void DeleteSessionStorage(const SessionStorageUsageInfo& usage_info) override; |
48 void SetSaveSessionStorageOnDisk() override; | 50 void SetSaveSessionStorageOnDisk() override; |
(...skipping 18 matching lines...) Expand all Loading... |
67 mojo::InterfaceRequest<LevelDBWrapper> request); | 69 mojo::InterfaceRequest<LevelDBWrapper> request); |
68 | 70 |
69 private: | 71 private: |
70 friend class DOMStorageMessageFilter; // for access to context() | 72 friend class DOMStorageMessageFilter; // for access to context() |
71 friend class SessionStorageNamespaceImpl; // ditto | 73 friend class SessionStorageNamespaceImpl; // ditto |
72 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>; | 74 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>; |
73 | 75 |
74 ~DOMStorageContextWrapper() override; | 76 ~DOMStorageContextWrapper() override; |
75 DOMStorageContextImpl* context() const { return context_.get(); } | 77 DOMStorageContextImpl* context() const { return context_.get(); } |
76 | 78 |
77 void LevelDBWrapperImplHasNoBindings(const std::string& origin); | 79 // An inner class to keep all mojo-ish details together and not bleed them |
78 | 80 // through the public interface. |
79 // Used for mojo-based LocalStorage implementation (behind | 81 class MojoState; |
80 // --mojo-local-storage for now). Maps between an origin and its prefixed | 82 scoped_ptr<MojoState> mojo_state_; |
81 // LevelDB view. | |
82 std::map<std::string, scoped_ptr<LevelDBWrapperImpl>> level_db_wrappers_; | |
83 | 83 |
84 scoped_refptr<DOMStorageContextImpl> context_; | 84 scoped_refptr<DOMStorageContextImpl> context_; |
85 | 85 |
86 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); | 86 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); |
87 }; | 87 }; |
88 | 88 |
89 } // namespace content | 89 } // namespace content |
90 | 90 |
91 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ | 91 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
OLD | NEW |