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_impl.h"
8 #include "webkit/browser/dom_storage/dom_storage_session.h"
10 using dom_storage::DomStorageContext
;
11 using dom_storage::DomStorageSession
;
15 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl(
16 DOMStorageContextImpl
* context
)
17 : session_(new DomStorageSession(context
->context())) {
20 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl(
21 DOMStorageContextImpl
* context
, int64 namepace_id_to_clone
)
22 : session_(DomStorageSession::CloneFrom(context
->context(),
23 namepace_id_to_clone
)) {
26 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl(
27 DOMStorageContextImpl
* context
, const std::string
& persistent_id
)
28 : session_(new DomStorageSession(context
->context(), persistent_id
)) {
31 int64
SessionStorageNamespaceImpl::id() const {
32 return session_
->namespace_id();
35 const std::string
& SessionStorageNamespaceImpl::persistent_id() const {
36 return session_
->persistent_namespace_id();
39 void SessionStorageNamespaceImpl::SetShouldPersist(bool should_persist
) {
40 session_
->SetShouldPersist(should_persist
);
43 bool SessionStorageNamespaceImpl::should_persist() const {
44 return session_
->should_persist();
47 SessionStorageNamespaceImpl
* SessionStorageNamespaceImpl::Clone() {
48 return new SessionStorageNamespaceImpl(session_
->Clone());
51 bool SessionStorageNamespaceImpl::IsFromContext(
52 DOMStorageContextImpl
* context
) {
53 return session_
->IsFromContext(context
->context());
56 SessionStorageNamespaceImpl::SessionStorageNamespaceImpl(
57 DomStorageSession
* clone
)
61 SessionStorageNamespaceImpl::~SessionStorageNamespaceImpl() {
64 } // namespace content