| 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/support/simple_dom_storage_system.h" | 5 #include "webkit/support/simple_dom_storage_system.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "third_party/WebKit/public/platform/WebStorageArea.h" | 9 #include "third_party/WebKit/public/platform/WebStorageArea.h" |
| 10 #include "third_party/WebKit/public/platform/WebStorageNamespace.h" | 10 #include "third_party/WebKit/public/platform/WebStorageNamespace.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 unsigned SimpleDomStorageSystem::AreaImpl::length() { | 139 unsigned SimpleDomStorageSystem::AreaImpl::length() { |
| 140 if (Host()) | 140 if (Host()) |
| 141 return Host()->GetAreaLength(connection_id_); | 141 return Host()->GetAreaLength(connection_id_); |
| 142 return 0; | 142 return 0; |
| 143 } | 143 } |
| 144 | 144 |
| 145 WebString SimpleDomStorageSystem::AreaImpl::key(unsigned index) { | 145 WebString SimpleDomStorageSystem::AreaImpl::key(unsigned index) { |
| 146 if (Host()) | 146 if (Host()) |
| 147 return Host()->GetAreaKey(connection_id_, index); | 147 return Host()->GetAreaKey(connection_id_, index); |
| 148 return base::NullableString16(true); | 148 return base::NullableString16(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 WebString SimpleDomStorageSystem::AreaImpl::getItem(const WebString& key) { | 151 WebString SimpleDomStorageSystem::AreaImpl::getItem(const WebString& key) { |
| 152 if (Host()) | 152 if (Host()) |
| 153 return Host()->GetAreaItem(connection_id_, key); | 153 return Host()->GetAreaItem(connection_id_, key); |
| 154 return base::NullableString16(true); | 154 return base::NullableString16(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void SimpleDomStorageSystem::AreaImpl::setItem( | 157 void SimpleDomStorageSystem::AreaImpl::setItem( |
| 158 const WebString& key, const WebString& newValue, | 158 const WebString& key, const WebString& newValue, |
| 159 const WebURL& pageUrl, Result& result) { | 159 const WebURL& pageUrl, Result& result) { |
| 160 result = ResultBlockedByQuota; | 160 result = ResultBlockedByQuota; |
| 161 if (!Host()) | 161 if (!Host()) |
| 162 return; | 162 return; |
| 163 | 163 |
| 164 base::AutoReset<AreaImpl*> auto_reset(&parent_->area_being_processed_, this); | 164 base::AutoReset<AreaImpl*> auto_reset(&parent_->area_being_processed_, this); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 old_value); | 234 old_value); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void SimpleDomStorageSystem::OnDomStorageItemRemoved( | 237 void SimpleDomStorageSystem::OnDomStorageItemRemoved( |
| 238 const dom_storage::DomStorageArea* area, | 238 const dom_storage::DomStorageArea* area, |
| 239 const base::string16& key, | 239 const base::string16& key, |
| 240 const base::string16& old_value, | 240 const base::string16& old_value, |
| 241 const GURL& page_url) { | 241 const GURL& page_url) { |
| 242 DispatchDomStorageEvent(area, page_url, | 242 DispatchDomStorageEvent(area, page_url, |
| 243 base::NullableString16(key, false), | 243 base::NullableString16(key, false), |
| 244 base::NullableString16(true), | 244 base::NullableString16(), |
| 245 base::NullableString16(old_value, false)); | 245 base::NullableString16(old_value, false)); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void SimpleDomStorageSystem::OnDomStorageAreaCleared( | 248 void SimpleDomStorageSystem::OnDomStorageAreaCleared( |
| 249 const dom_storage::DomStorageArea* area, | 249 const dom_storage::DomStorageArea* area, |
| 250 const GURL& page_url) { | 250 const GURL& page_url) { |
| 251 DispatchDomStorageEvent(area, page_url, | 251 DispatchDomStorageEvent(area, page_url, |
| 252 base::NullableString16(true), | 252 base::NullableString16(), |
| 253 base::NullableString16(true), | 253 base::NullableString16(), |
| 254 base::NullableString16(true)); | 254 base::NullableString16()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void SimpleDomStorageSystem::DispatchDomStorageEvent( | 257 void SimpleDomStorageSystem::DispatchDomStorageEvent( |
| 258 const dom_storage::DomStorageArea* area, | 258 const dom_storage::DomStorageArea* area, |
| 259 const GURL& page_url, | 259 const GURL& page_url, |
| 260 const base::NullableString16& key, | 260 const base::NullableString16& key, |
| 261 const base::NullableString16& new_value, | 261 const base::NullableString16& new_value, |
| 262 const base::NullableString16& old_value) { | 262 const base::NullableString16& old_value) { |
| 263 DCHECK(area_being_processed_); | 263 DCHECK(area_being_processed_); |
| 264 if (area->namespace_id() == dom_storage::kLocalStorageNamespaceId) { | 264 if (area->namespace_id() == dom_storage::kLocalStorageNamespaceId) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 277 key, | 277 key, |
| 278 old_value, | 278 old_value, |
| 279 new_value, | 279 new_value, |
| 280 area->origin(), | 280 area->origin(), |
| 281 page_url, | 281 page_url, |
| 282 session_namespace_for_event_dispatch, | 282 session_namespace_for_event_dispatch, |
| 283 area_being_processed_, | 283 area_being_processed_, |
| 284 true /* originatedInProcess */); | 284 true /* originatedInProcess */); |
| 285 } | 285 } |
| 286 } | 286 } |
| OLD | NEW |