| 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/dom_storage/dom_storage_host.h" | 5 #include "webkit/dom_storage/dom_storage_host.h" |
| 6 | 6 |
| 7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
| 8 #include "webkit/dom_storage/dom_storage_area.h" | 8 #include "webkit/dom_storage/dom_storage_area.h" |
| 9 #include "webkit/dom_storage/dom_storage_context.h" | 9 #include "webkit/dom_storage/dom_storage_context.h" |
| 10 #include "webkit/dom_storage/dom_storage_namespace.h" | 10 #include "webkit/dom_storage/dom_storage_namespace.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 void DomStorageHost::CloseStorageArea(int connection_id) { | 41 void DomStorageHost::CloseStorageArea(int connection_id) { |
| 42 AreaMap::iterator found = connections_.find(connection_id); | 42 AreaMap::iterator found = connections_.find(connection_id); |
| 43 if (found == connections_.end()) | 43 if (found == connections_.end()) |
| 44 return; | 44 return; |
| 45 found->second.namespace_->CloseStorageArea( | 45 found->second.namespace_->CloseStorageArea( |
| 46 found->second.area_); | 46 found->second.area_); |
| 47 connections_.erase(found); | 47 connections_.erase(found); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool DomStorageHost::ExtractAreaValues( |
| 51 int connection_id, ValuesMap* map) { |
| 52 map->clear(); |
| 53 AreaMap::iterator found = connections_.find(connection_id); |
| 54 if (found == connections_.end()) |
| 55 return false; // Indicates the renderer gave us very bad data. |
| 56 found->second.area_->ExtractValues(map); |
| 57 return true; |
| 58 } |
| 59 |
| 50 unsigned DomStorageHost::GetAreaLength(int connection_id) { | 60 unsigned DomStorageHost::GetAreaLength(int connection_id) { |
| 51 DomStorageArea* area = GetOpenArea(connection_id); | 61 DomStorageArea* area = GetOpenArea(connection_id); |
| 52 if (!area) | 62 if (!area) |
| 53 return 0; | 63 return 0; |
| 54 return area->Length(); | 64 return area->Length(); |
| 55 } | 65 } |
| 56 | 66 |
| 57 NullableString16 DomStorageHost::GetAreaKey(int connection_id, unsigned index) { | 67 NullableString16 DomStorageHost::GetAreaKey(int connection_id, unsigned index) { |
| 58 DomStorageArea* area = GetOpenArea(connection_id); | 68 DomStorageArea* area = GetOpenArea(connection_id); |
| 59 if (!area) | 69 if (!area) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return NULL; | 125 return NULL; |
| 116 return found->second.area_; | 126 return found->second.area_; |
| 117 } | 127 } |
| 118 | 128 |
| 119 // NamespaceAndArea | 129 // NamespaceAndArea |
| 120 | 130 |
| 121 DomStorageHost::NamespaceAndArea::NamespaceAndArea() {} | 131 DomStorageHost::NamespaceAndArea::NamespaceAndArea() {} |
| 122 DomStorageHost::NamespaceAndArea::~NamespaceAndArea() {} | 132 DomStorageHost::NamespaceAndArea::~NamespaceAndArea() {} |
| 123 | 133 |
| 124 } // namespace dom_storage | 134 } // namespace dom_storage |
| OLD | NEW |