| 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/tools/test_shell/simple_dom_storage_system.h" | 5 #include "webkit/tools/test_shell/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/Source/Platform/chromium/public/WebStorageArea.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebStorageArea.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebStorageNamespace
.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebStorageNamespace
.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 result = ResultOK; | 170 result = ResultOK; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void SimpleDomStorageSystem::AreaImpl::removeItem( | 173 void SimpleDomStorageSystem::AreaImpl::removeItem( |
| 174 const WebString& key, const WebURL& pageUrl) { | 174 const WebString& key, const WebURL& pageUrl) { |
| 175 if (!Host()) | 175 if (!Host()) |
| 176 return; | 176 return; |
| 177 | 177 |
| 178 base::AutoReset<AreaImpl*> auto_reset(&parent_->area_being_processed_, this); | 178 base::AutoReset<AreaImpl*> auto_reset(&parent_->area_being_processed_, this); |
| 179 string16 notused; | 179 base::string16 notused; |
| 180 Host()->RemoveAreaItem(connection_id_, key, pageUrl, ¬used); | 180 Host()->RemoveAreaItem(connection_id_, key, pageUrl, ¬used); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void SimpleDomStorageSystem::AreaImpl::clear(const WebURL& pageUrl) { | 183 void SimpleDomStorageSystem::AreaImpl::clear(const WebURL& pageUrl) { |
| 184 if (!Host()) | 184 if (!Host()) |
| 185 return; | 185 return; |
| 186 | 186 |
| 187 base::AutoReset<AreaImpl*> auto_reset(&parent_->area_being_processed_, this); | 187 base::AutoReset<AreaImpl*> auto_reset(&parent_->area_being_processed_, this); |
| 188 Host()->ClearArea(connection_id_, pageUrl); | 188 Host()->ClearArea(connection_id_, pageUrl); |
| 189 } | 189 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 215 } | 215 } |
| 216 | 216 |
| 217 WebStorageNamespace* SimpleDomStorageSystem::CreateSessionStorageNamespace() { | 217 WebStorageNamespace* SimpleDomStorageSystem::CreateSessionStorageNamespace() { |
| 218 int id = context_->AllocateSessionId(); | 218 int id = context_->AllocateSessionId(); |
| 219 context_->CreateSessionNamespace(id, std::string()); | 219 context_->CreateSessionNamespace(id, std::string()); |
| 220 return new NamespaceImpl(weak_factory_.GetWeakPtr(), id); | 220 return new NamespaceImpl(weak_factory_.GetWeakPtr(), id); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void SimpleDomStorageSystem::OnDomStorageItemSet( | 223 void SimpleDomStorageSystem::OnDomStorageItemSet( |
| 224 const dom_storage::DomStorageArea* area, | 224 const dom_storage::DomStorageArea* area, |
| 225 const string16& key, | 225 const base::string16& key, |
| 226 const string16& new_value, | 226 const base::string16& new_value, |
| 227 const NullableString16& old_value, | 227 const NullableString16& old_value, |
| 228 const GURL& page_url) { | 228 const GURL& page_url) { |
| 229 DispatchDomStorageEvent(area, page_url, | 229 DispatchDomStorageEvent(area, page_url, |
| 230 NullableString16(key, false), | 230 NullableString16(key, false), |
| 231 NullableString16(new_value, false), | 231 NullableString16(new_value, false), |
| 232 old_value); | 232 old_value); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void SimpleDomStorageSystem::OnDomStorageItemRemoved( | 235 void SimpleDomStorageSystem::OnDomStorageItemRemoved( |
| 236 const dom_storage::DomStorageArea* area, | 236 const dom_storage::DomStorageArea* area, |
| 237 const string16& key, | 237 const base::string16& key, |
| 238 const string16& old_value, | 238 const base::string16& old_value, |
| 239 const GURL& page_url) { | 239 const GURL& page_url) { |
| 240 DispatchDomStorageEvent(area, page_url, | 240 DispatchDomStorageEvent(area, page_url, |
| 241 NullableString16(key, false), | 241 NullableString16(key, false), |
| 242 NullableString16(true), | 242 NullableString16(true), |
| 243 NullableString16(old_value, false)); | 243 NullableString16(old_value, false)); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void SimpleDomStorageSystem::OnDomStorageAreaCleared( | 246 void SimpleDomStorageSystem::OnDomStorageAreaCleared( |
| 247 const dom_storage::DomStorageArea* area, | 247 const dom_storage::DomStorageArea* area, |
| 248 const GURL& page_url) { | 248 const GURL& page_url) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 275 key, | 275 key, |
| 276 old_value, | 276 old_value, |
| 277 new_value, | 277 new_value, |
| 278 area->origin(), | 278 area->origin(), |
| 279 page_url, | 279 page_url, |
| 280 session_namespace_for_event_dispatch, | 280 session_namespace_for_event_dispatch, |
| 281 area_being_processed_, | 281 area_being_processed_, |
| 282 true /* originatedInProcess */); | 282 true /* originatedInProcess */); |
| 283 } | 283 } |
| 284 } | 284 } |
| OLD | NEW |