OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ | 5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ |
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ | 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // The local storage file extension. | 102 // The local storage file extension. |
103 static const FilePath::CharType kLocalStorageExtension[]; | 103 static const FilePath::CharType kLocalStorageExtension[]; |
104 | 104 |
105 // Get the file name of the local storage file for the given origin. | 105 // Get the file name of the local storage file for the given origin. |
106 FilePath GetLocalStorageFilePath(const string16& origin_id) const; | 106 FilePath GetLocalStorageFilePath(const string16& origin_id) const; |
107 | 107 |
108 void set_clear_local_state_on_exit_(bool clear_local_state) { | 108 void set_clear_local_state_on_exit_(bool clear_local_state) { |
109 clear_local_state_on_exit_ = clear_local_state; | 109 clear_local_state_on_exit_ = clear_local_state; |
110 } | 110 } |
111 | 111 |
112 #ifdef UNIT_TEST | 112 void set_data_path_for_testing(const FilePath& data_path) { |
113 // For unit tests allow to override the |data_path_|. | 113 data_path_ = data_path; |
114 void set_data_path(const FilePath& data_path) { data_path_ = data_path; } | 114 } |
115 #endif | |
116 | 115 |
117 private: | 116 private: |
118 | 117 |
119 FRIEND_TEST_ALL_PREFIXES(DOMStorageTest, SessionOnly); | 118 FRIEND_TEST_ALL_PREFIXES(DOMStorageTest, SessionOnly); |
120 | 119 |
121 // Get the local storage instance. The object is owned by this class. | 120 // Get the local storage instance. The object is owned by this class. |
122 DOMStorageNamespace* CreateLocalStorage(); | 121 DOMStorageNamespace* CreateLocalStorage(); |
123 | 122 |
124 // Get a new session storage namespace. The object is owned by this class. | 123 // Get a new session storage namespace. The object is owned by this class. |
125 DOMStorageNamespace* CreateSessionStorage(int64 namespace_id); | 124 DOMStorageNamespace* CreateSessionStorage(int64 namespace_id); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Maps ids to StorageNamespaces. We own these objects. | 164 // Maps ids to StorageNamespaces. We own these objects. |
166 typedef std::map<int64, DOMStorageNamespace*> StorageNamespaceMap; | 165 typedef std::map<int64, DOMStorageNamespace*> StorageNamespaceMap; |
167 StorageNamespaceMap storage_namespace_map_; | 166 StorageNamespaceMap storage_namespace_map_; |
168 | 167 |
169 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 168 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
170 | 169 |
171 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContext); | 170 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContext); |
172 }; | 171 }; |
173 | 172 |
174 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ | 173 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ |
OLD | NEW |