| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/renderer_webstoragenamespace_impl.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "content/renderer/renderer_webstoragearea_impl.h" | |
| 9 #include "webkit/dom_storage/dom_storage_types.h" | |
| 10 | |
| 11 using WebKit::WebStorageArea; | |
| 12 using WebKit::WebStorageNamespace; | |
| 13 using WebKit::WebString; | |
| 14 | |
| 15 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl() | |
| 16 : namespace_id_(dom_storage::kLocalStorageNamespaceId) { | |
| 17 } | |
| 18 | |
| 19 RendererWebStorageNamespaceImpl::RendererWebStorageNamespaceImpl( | |
| 20 int64 namespace_id) | |
| 21 : namespace_id_(namespace_id) { | |
| 22 DCHECK_NE(dom_storage::kInvalidSessionStorageNamespaceId, namespace_id); | |
| 23 } | |
| 24 | |
| 25 RendererWebStorageNamespaceImpl::~RendererWebStorageNamespaceImpl() { | |
| 26 } | |
| 27 | |
| 28 WebStorageArea* RendererWebStorageNamespaceImpl::createStorageArea( | |
| 29 const WebString& origin) { | |
| 30 return new RendererWebStorageAreaImpl(namespace_id_, origin); | |
| 31 } | |
| 32 | |
| 33 WebStorageNamespace* RendererWebStorageNamespaceImpl::copy() { | |
| 34 // By returning NULL, we're telling WebKit to lazily fetch it the next time | |
| 35 // session storage is used. In the WebViewClient::createView, we do the | |
| 36 // book-keeping necessary to make it a true copy-on-write despite not doing | |
| 37 // anything here, now. | |
| 38 return NULL; | |
| 39 } | |
| 40 | |
| 41 bool RendererWebStorageNamespaceImpl::isSameNamespace( | |
| 42 const WebStorageNamespace& other) const { | |
| 43 const RendererWebStorageNamespaceImpl* other_impl = | |
| 44 static_cast<const RendererWebStorageNamespaceImpl*>(&other); | |
| 45 return namespace_id_ == other_impl->namespace_id_; | |
| 46 } | |
| OLD | NEW |