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 |
(...skipping 28 matching lines...) Expand all Loading... |
39 unsigned GetAreaLength(int connection_id); | 39 unsigned GetAreaLength(int connection_id); |
40 NullableString16 GetAreaKey(int connection_id, unsigned index); | 40 NullableString16 GetAreaKey(int connection_id, unsigned index); |
41 NullableString16 GetAreaItem(int connection_id, const string16& key); | 41 NullableString16 GetAreaItem(int connection_id, const string16& key); |
42 bool SetAreaItem(int connection_id, const string16& key, | 42 bool SetAreaItem(int connection_id, const string16& key, |
43 const string16& value, const GURL& page_url, | 43 const string16& value, const GURL& page_url, |
44 NullableString16* old_value); | 44 NullableString16* old_value); |
45 bool RemoveAreaItem(int connection_id, const string16& key, | 45 bool RemoveAreaItem(int connection_id, const string16& key, |
46 const GURL& page_url, | 46 const GURL& page_url, |
47 string16* old_value); | 47 string16* old_value); |
48 bool ClearArea(int connection_id, const GURL& page_url); | 48 bool ClearArea(int connection_id, const GURL& page_url); |
| 49 bool HasAreaOpen(int namespace_id, const GURL& origin) const; |
49 | 50 |
50 private: | 51 private: |
51 // Struct to hold references needed for areas that are open | 52 // Struct to hold references needed for areas that are open |
52 // within our associated client process. | 53 // within our associated client process. |
53 struct NamespaceAndArea { | 54 struct NamespaceAndArea { |
54 scoped_refptr<DomStorageNamespace> namespace_; | 55 scoped_refptr<DomStorageNamespace> namespace_; |
55 scoped_refptr<DomStorageArea> area_; | 56 scoped_refptr<DomStorageArea> area_; |
56 NamespaceAndArea(); | 57 NamespaceAndArea(); |
57 ~NamespaceAndArea(); | 58 ~NamespaceAndArea(); |
58 }; | 59 }; |
59 typedef std::map<int, NamespaceAndArea > AreaMap; | 60 typedef std::map<int, NamespaceAndArea > AreaMap; |
60 | 61 |
61 DomStorageArea* GetOpenArea(int connection_id); | 62 DomStorageArea* GetOpenArea(int connection_id); |
62 | 63 |
63 scoped_refptr<DomStorageContext> context_; | 64 scoped_refptr<DomStorageContext> context_; |
64 AreaMap connections_; | 65 AreaMap connections_; |
65 }; | 66 }; |
66 | 67 |
67 } // namespace dom_storage | 68 } // namespace dom_storage |
68 | 69 |
69 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ | 70 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ |
OLD | NEW |