Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / dom_storage / session_storage_namespace_impl.cc
bloba1f7f2dd7f7cc08239fe02fafe91360714a5b9d4
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/browser/dom_storage/session_storage_namespace_impl.h"
7 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
8 #include "content/browser/dom_storage/dom_storage_session.h"
10 namespace content {
12 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl(
13 DOMStorageContextWrapper* context)
14 : session_(new DOMStorageSession(context->context())) {
17 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl(
18 DOMStorageContextWrapper* context, int64 namepace_id_to_clone)
19 : session_(DOMStorageSession::CloneFrom(context->context(),
20 namepace_id_to_clone)) {
23 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl(
24 DOMStorageContextWrapper* context, const std::string& persistent_id)
25 : session_(new DOMStorageSession(context->context(), persistent_id)) {
28 int64 SessionStorageNamespaceImpl::id() const {
29 return session_->namespace_id();
32 const std::string& SessionStorageNamespaceImpl::persistent_id() const {
33 return session_->persistent_namespace_id();
36 void SessionStorageNamespaceImpl::SetShouldPersist(bool should_persist) {
37 session_->SetShouldPersist(should_persist);
40 bool SessionStorageNamespaceImpl::should_persist() const {
41 return session_->should_persist();
44 SessionStorageNamespaceImpl* SessionStorageNamespaceImpl::Clone() {
45 return new SessionStorageNamespaceImpl(session_->Clone());
48 bool SessionStorageNamespaceImpl::IsFromContext(
49 DOMStorageContextWrapper* context) {
50 return session_->IsFromContext(context->context());
53 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl(
54 DOMStorageSession* clone)
55 : session_(clone) {
58 SessionStorageNamespaceImpl::~SessionStorageNamespaceImpl() {
61 } // namespace content