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 WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ |
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/nullable_string16.h" | 12 #include "base/nullable_string16.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "webkit/dom_storage/dom_storage_types.h" |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 | 17 |
17 namespace dom_storage { | 18 namespace dom_storage { |
18 | 19 |
19 class DomStorageContext; | 20 class DomStorageContext; |
20 class DomStorageHost; | 21 class DomStorageHost; |
21 class DomStorageNamespace; | 22 class DomStorageNamespace; |
22 class DomStorageArea; | 23 class DomStorageArea; |
23 | 24 |
24 // One instance is allocated in the main process for each client process. | 25 // One instance is allocated in the main process for each client process. |
25 // Used by DomStorageMessageFilter in Chrome and by SimpleDomStorage in DRT. | 26 // Used by DomStorageMessageFilter in Chrome and by SimpleDomStorage in DRT. |
26 // This class is single threaded, and performs blocking file reads/writes, | 27 // This class is single threaded, and performs blocking file reads/writes, |
27 // so it shouldn't be used on chrome's IO thread. | 28 // so it shouldn't be used on chrome's IO thread. |
28 // See class comments for DomStorageContext for a larger overview. | 29 // See class comments for DomStorageContext for a larger overview. |
29 class DomStorageHost { | 30 class DomStorageHost { |
30 public: | 31 public: |
31 explicit DomStorageHost(DomStorageContext* context); | 32 explicit DomStorageHost(DomStorageContext* context); |
32 ~DomStorageHost(); | 33 ~DomStorageHost(); |
33 | 34 |
34 bool OpenStorageArea(int connection_id, int namespace_id, | 35 bool OpenStorageArea(int connection_id, int namespace_id, |
35 const GURL& origin); | 36 const GURL& origin); |
36 void CloseStorageArea(int connection_id); | 37 void CloseStorageArea(int connection_id); |
37 | 38 bool ExtractAreaValues(int connection_id, ValuesMap* map); |
38 unsigned GetAreaLength(int connection_id); | 39 unsigned GetAreaLength(int connection_id); |
39 NullableString16 GetAreaKey(int connection_id, unsigned index); | 40 NullableString16 GetAreaKey(int connection_id, unsigned index); |
40 NullableString16 GetAreaItem(int connection_id, const string16& key); | 41 NullableString16 GetAreaItem(int connection_id, const string16& key); |
41 bool SetAreaItem(int connection_id, const string16& key, | 42 bool SetAreaItem(int connection_id, const string16& key, |
42 const string16& value, const GURL& page_url, | 43 const string16& value, const GURL& page_url, |
43 NullableString16* old_value); | 44 NullableString16* old_value); |
44 bool RemoveAreaItem(int connection_id, const string16& key, | 45 bool RemoveAreaItem(int connection_id, const string16& key, |
45 const GURL& page_url, | 46 const GURL& page_url, |
46 string16* old_value); | 47 string16* old_value); |
47 bool ClearArea(int connection_id, const GURL& page_url); | 48 bool ClearArea(int connection_id, const GURL& page_url); |
(...skipping 11 matching lines...) Expand all Loading... |
59 | 60 |
60 DomStorageArea* GetOpenArea(int connection_id); | 61 DomStorageArea* GetOpenArea(int connection_id); |
61 | 62 |
62 scoped_refptr<DomStorageContext> context_; | 63 scoped_refptr<DomStorageContext> context_; |
63 AreaMap connections_; | 64 AreaMap connections_; |
64 }; | 65 }; |
65 | 66 |
66 } // namespace dom_storage | 67 } // namespace dom_storage |
67 | 68 |
68 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ | 69 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ |
OLD | NEW |