| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/dom_storage/dom_storage_context.h" | 5 #include "webkit/dom_storage/dom_storage_context.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 const std::string& persistent_namespace_id) { | 182 const std::string& persistent_namespace_id) { |
| 183 if (is_shutdown_) | 183 if (is_shutdown_) |
| 184 return; | 184 return; |
| 185 DCHECK(namespace_id != kLocalStorageNamespaceId); | 185 DCHECK(namespace_id != kLocalStorageNamespaceId); |
| 186 DCHECK(namespaces_.find(namespace_id) == namespaces_.end()); | 186 DCHECK(namespaces_.find(namespace_id) == namespaces_.end()); |
| 187 namespaces_[namespace_id] = new DomStorageNamespace( | 187 namespaces_[namespace_id] = new DomStorageNamespace( |
| 188 namespace_id, persistent_namespace_id, task_runner_); | 188 namespace_id, persistent_namespace_id, task_runner_); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void DomStorageContext::DeleteSessionNamespace( | 191 void DomStorageContext::DeleteSessionNamespace( |
| 192 int64 namespace_id) { | 192 int64 namespace_id, bool should_persist_data) { |
| 193 DCHECK_NE(kLocalStorageNamespaceId, namespace_id); | 193 DCHECK_NE(kLocalStorageNamespaceId, namespace_id); |
| 194 // TODO(marja): Protect the sessionStorage data (once it's written on disk). |
| 194 namespaces_.erase(namespace_id); | 195 namespaces_.erase(namespace_id); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void DomStorageContext::CloneSessionNamespace( | 198 void DomStorageContext::CloneSessionNamespace( |
| 198 int64 existing_id, int64 new_id, | 199 int64 existing_id, int64 new_id, |
| 199 const std::string& new_persistent_id) { | 200 const std::string& new_persistent_id) { |
| 200 if (is_shutdown_) | 201 if (is_shutdown_) |
| 201 return; | 202 return; |
| 202 DCHECK_NE(kLocalStorageNamespaceId, existing_id); | 203 DCHECK_NE(kLocalStorageNamespaceId, existing_id); |
| 203 DCHECK_NE(kLocalStorageNamespaceId, new_id); | 204 DCHECK_NE(kLocalStorageNamespaceId, new_id); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 223 FilePath database_file_path = localstorage_directory_.Append( | 224 FilePath database_file_path = localstorage_directory_.Append( |
| 224 DomStorageArea::DatabaseFileNameFromOrigin(origin)); | 225 DomStorageArea::DatabaseFileNameFromOrigin(origin)); |
| 225 file_util::Delete(database_file_path, kNotRecursive); | 226 file_util::Delete(database_file_path, kNotRecursive); |
| 226 file_util::Delete( | 227 file_util::Delete( |
| 227 DomStorageDatabase::GetJournalFilePath(database_file_path), | 228 DomStorageDatabase::GetJournalFilePath(database_file_path), |
| 228 kNotRecursive); | 229 kNotRecursive); |
| 229 } | 230 } |
| 230 } | 231 } |
| 231 | 232 |
| 232 } // namespace dom_storage | 233 } // namespace dom_storage |
| OLD | NEW |