Make USB permissions work in the new permission message system
[chromium-blink-merge.git] / content / renderer / dom_storage / webstoragenamespace_impl.cc
blob531263d6f84e18dbf695ceb8b5af4338a1b9a757
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
3 // found in the LICENSE file.
5 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
7 #include "base/logging.h"
8 #include "content/common/dom_storage/dom_storage_types.h"
9 #include "content/renderer/dom_storage/webstoragearea_impl.h"
10 #include "third_party/WebKit/public/platform/WebString.h"
11 #include "url/gurl.h"
13 using blink::WebStorageArea;
14 using blink::WebStorageNamespace;
15 using blink::WebString;
17 namespace content {
19 WebStorageNamespaceImpl::WebStorageNamespaceImpl()
20 : namespace_id_(kLocalStorageNamespaceId) {
23 WebStorageNamespaceImpl::WebStorageNamespaceImpl(
24 int64 namespace_id)
25 : namespace_id_(namespace_id) {
26 DCHECK_NE(kInvalidSessionStorageNamespaceId, namespace_id);
29 WebStorageNamespaceImpl::~WebStorageNamespaceImpl() {
32 WebStorageArea* WebStorageNamespaceImpl::createStorageArea(
33 const WebString& origin) {
34 return new WebStorageAreaImpl(namespace_id_, GURL(origin));
37 WebStorageNamespace* WebStorageNamespaceImpl::copy() {
38 // By returning NULL, we're telling WebKit to lazily fetch it the next time
39 // session storage is used. In the WebViewClient::createView, we do the
40 // book-keeping necessary to make it a true copy-on-write despite not doing
41 // anything here, now.
42 return NULL;
45 bool WebStorageNamespaceImpl::isSameNamespace(
46 const WebStorageNamespace& other) const {
47 const WebStorageNamespaceImpl* other_impl =
48 static_cast<const WebStorageNamespaceImpl*>(&other);
49 return namespace_id_ == other_impl->namespace_id_;
52 } // namespace content