| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/in_process_webkit/storage_namespace.h" | 5 #include "chrome/browser/in_process_webkit/storage_namespace.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | 8 #include "chrome/browser/in_process_webkit/dom_storage_context.h" |
| 9 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" | 9 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" |
| 10 #include "chrome/browser/in_process_webkit/storage_area.h" | 10 #include "chrome/browser/in_process_webkit/storage_area.h" |
| 11 #include "webkit/api/public/WebStorageArea.h" | 11 #include "webkit/api/public/WebStorageArea.h" |
| 12 #include "webkit/api/public/WebStorageNamespace.h" | 12 #include "webkit/api/public/WebStorageNamespace.h" |
| 13 #include "webkit/api/public/WebString.h" | 13 #include "webkit/api/public/WebString.h" |
| 14 #include "webkit/glue/webkit_glue.h" | 14 #include "webkit/glue/webkit_glue.h" |
| 15 | 15 |
| 16 using WebKit::WebStorageArea; | 16 using WebKit::WebStorageArea; |
| 17 using WebKit::WebStorageNamespace; | 17 using WebKit::WebStorageNamespace; |
| 18 using WebKit::WebString; | 18 using WebKit::WebString; |
| 19 | 19 |
| 20 /* static */ | 20 /* static */ |
| 21 StorageNamespace* StorageNamespace::CreateLocalStorageNamespace( | 21 StorageNamespace* StorageNamespace::CreateLocalStorageNamespace( |
| 22 DOMStorageContext* dom_storage_context, const FilePath& dir_path) { | 22 DOMStorageContext* dom_storage_context, const FilePath& dir_path) { |
| 23 int64 id = dom_storage_context->kLocalStorageNamespaceId; | 23 int64 id = dom_storage_context->kLocalStorageNamespaceId; |
| 24 DCHECK(!dom_storage_context->GetStorageNamespace(id)); | 24 DCHECK(!dom_storage_context->GetStorageNamespace(id)); |
| 25 WebString path = webkit_glue::FilePathToWebString(dir_path); | 25 WebString path = webkit_glue::FilePathToWebString(dir_path); |
| 26 WebStorageNamespace* web_storage_namespace = | 26 WebStorageNamespace* web_storage_namespace = |
| 27 WebStorageNamespace::createLocalStorageNamespace(path); | 27 WebStorageNamespace::createLocalStorageNamespace(path, |
| 28 kLocalStorageQuota); |
| 28 return new StorageNamespace(dom_storage_context, web_storage_namespace, id, | 29 return new StorageNamespace(dom_storage_context, web_storage_namespace, id, |
| 29 DOM_STORAGE_LOCAL); | 30 DOM_STORAGE_LOCAL); |
| 30 } | 31 } |
| 31 | 32 |
| 32 /* static */ | 33 /* static */ |
| 33 StorageNamespace* StorageNamespace::CreateSessionStorageNamespace( | 34 StorageNamespace* StorageNamespace::CreateSessionStorageNamespace( |
| 34 DOMStorageContext* dom_storage_context) { | 35 DOMStorageContext* dom_storage_context) { |
| 35 int64 id = dom_storage_context->AllocateStorageNamespaceId(); | 36 int64 id = dom_storage_context->AllocateStorageNamespaceId(); |
| 36 DCHECK(!dom_storage_context->GetStorageNamespace(id)); | 37 DCHECK(!dom_storage_context->GetStorageNamespace(id)); |
| 37 WebStorageNamespace* web_storage_namespace = | 38 WebStorageNamespace* web_storage_namespace = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 int64 id = dom_storage_context_->AllocateStorageNamespaceId(); | 87 int64 id = dom_storage_context_->AllocateStorageNamespaceId(); |
| 87 DCHECK(!dom_storage_context_->GetStorageNamespace(id)); | 88 DCHECK(!dom_storage_context_->GetStorageNamespace(id)); |
| 88 WebStorageNamespace* new_storage_namespace = storage_namespace_->copy(); | 89 WebStorageNamespace* new_storage_namespace = storage_namespace_->copy(); |
| 89 return new StorageNamespace(dom_storage_context_, new_storage_namespace, id, | 90 return new StorageNamespace(dom_storage_context_, new_storage_namespace, id, |
| 90 storage_type_); | 91 storage_type_); |
| 91 } | 92 } |
| 92 | 93 |
| 93 void StorageNamespace::Close() { | 94 void StorageNamespace::Close() { |
| 94 storage_namespace_->close(); | 95 storage_namespace_->close(); |
| 95 } | 96 } |
| OLD | NEW |