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 #include "webkit/browser/dom_storage/dom_storage_host.h" | 5 #include "webkit/browser/dom_storage/dom_storage_host.h" |
6 | 6 |
7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
8 #include "webkit/browser/dom_storage/dom_storage_area.h" | 8 #include "webkit/browser/dom_storage/dom_storage_area.h" |
9 #include "webkit/browser/dom_storage/dom_storage_context.h" | 9 #include "webkit/browser/dom_storage/dom_storage_context.h" |
10 #include "webkit/browser/dom_storage/dom_storage_namespace.h" | 10 #include "webkit/browser/dom_storage/dom_storage_namespace.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 DomStorageArea* area = GetOpenArea(connection_id); | 77 DomStorageArea* area = GetOpenArea(connection_id); |
78 if (!area) | 78 if (!area) |
79 return 0; | 79 return 0; |
80 return area->Length(); | 80 return area->Length(); |
81 } | 81 } |
82 | 82 |
83 base::NullableString16 DomStorageHost::GetAreaKey(int connection_id, | 83 base::NullableString16 DomStorageHost::GetAreaKey(int connection_id, |
84 unsigned index) { | 84 unsigned index) { |
85 DomStorageArea* area = GetOpenArea(connection_id); | 85 DomStorageArea* area = GetOpenArea(connection_id); |
86 if (!area) | 86 if (!area) |
87 return base::NullableString16(true); | 87 return base::NullableString16(); |
88 return area->Key(index); | 88 return area->Key(index); |
89 } | 89 } |
90 | 90 |
91 base::NullableString16 DomStorageHost::GetAreaItem(int connection_id, | 91 base::NullableString16 DomStorageHost::GetAreaItem(int connection_id, |
92 const base::string16& key) { | 92 const base::string16& key) { |
93 DomStorageArea* area = GetOpenArea(connection_id); | 93 DomStorageArea* area = GetOpenArea(connection_id); |
94 if (!area) | 94 if (!area) |
95 return base::NullableString16(true); | 95 return base::NullableString16(); |
96 return area->GetItem(key); | 96 return area->GetItem(key); |
97 } | 97 } |
98 | 98 |
99 bool DomStorageHost::SetAreaItem( | 99 bool DomStorageHost::SetAreaItem( |
100 int connection_id, const base::string16& key, | 100 int connection_id, const base::string16& key, |
101 const base::string16& value, const GURL& page_url, | 101 const base::string16& value, const GURL& page_url, |
102 base::NullableString16* old_value) { | 102 base::NullableString16* old_value) { |
103 DomStorageArea* area = GetOpenArea(connection_id); | 103 DomStorageArea* area = GetOpenArea(connection_id); |
104 if (!area) { | 104 if (!area) { |
105 // TODO(michaeln): Fix crbug/134003 and return false here. | 105 // TODO(michaeln): Fix crbug/134003 and return false here. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return NULL; | 161 return NULL; |
162 return found->second.namespace_.get(); | 162 return found->second.namespace_.get(); |
163 } | 163 } |
164 | 164 |
165 // NamespaceAndArea | 165 // NamespaceAndArea |
166 | 166 |
167 DomStorageHost::NamespaceAndArea::NamespaceAndArea() {} | 167 DomStorageHost::NamespaceAndArea::NamespaceAndArea() {} |
168 DomStorageHost::NamespaceAndArea::~NamespaceAndArea() {} | 168 DomStorageHost::NamespaceAndArea::~NamespaceAndArea() {} |
169 | 169 |
170 } // namespace dom_storage | 170 } // namespace dom_storage |
OLD | NEW |