| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/in_process_webkit/dom_storage_context.h" | 5 #include "content/browser/in_process_webkit/dom_storage_context.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 const FilePath::CharType DOMStorageContext::kLocalStorageDirectory[] = | 43 const FilePath::CharType DOMStorageContext::kLocalStorageDirectory[] = |
| 44 FILE_PATH_LITERAL("Local Storage"); | 44 FILE_PATH_LITERAL("Local Storage"); |
| 45 | 45 |
| 46 const FilePath::CharType DOMStorageContext::kLocalStorageExtension[] = | 46 const FilePath::CharType DOMStorageContext::kLocalStorageExtension[] = |
| 47 FILE_PATH_LITERAL(".localstorage"); | 47 FILE_PATH_LITERAL(".localstorage"); |
| 48 | 48 |
| 49 DOMStorageContext::DOMStorageContext( | 49 DOMStorageContext::DOMStorageContext( |
| 50 WebKitContext* webkit_context, | 50 WebKitContext* webkit_context, |
| 51 quota::SpecialStoragePolicy* special_storage_policy) | 51 quota::SpecialStoragePolicy* special_storage_policy, |
| 52 const content::ResourceContext& resource_context) |
| 52 : last_storage_area_id_(0), | 53 : last_storage_area_id_(0), |
| 53 last_session_storage_namespace_id_on_ui_thread_(kLocalStorageNamespaceId), | 54 last_session_storage_namespace_id_on_ui_thread_(kLocalStorageNamespaceId), |
| 54 last_session_storage_namespace_id_on_io_thread_(kLocalStorageNamespaceId), | 55 last_session_storage_namespace_id_on_io_thread_(kLocalStorageNamespaceId), |
| 55 clear_local_state_on_exit_(false), | 56 clear_local_state_on_exit_(false), |
| 56 special_storage_policy_(special_storage_policy) { | 57 special_storage_policy_(special_storage_policy), |
| 58 resource_context_(resource_context) { |
| 57 data_path_ = webkit_context->data_path(); | 59 data_path_ = webkit_context->data_path(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 DOMStorageContext::~DOMStorageContext() { | 62 DOMStorageContext::~DOMStorageContext() { |
| 61 // This should not go away until all DOM Storage message filters have gone | 63 // This should not go away until all DOM Storage message filters have gone |
| 62 // away. And they remove themselves from this list. | 64 // away. And they remove themselves from this list. |
| 63 DCHECK(message_filter_set_.empty()); | 65 DCHECK(message_filter_set_.empty()); |
| 64 | 66 |
| 65 for (StorageNamespaceMap::iterator iter(storage_namespace_map_.begin()); | 67 for (StorageNamespaceMap::iterator iter(storage_namespace_map_.begin()); |
| 66 iter != storage_namespace_map_.end(); ++iter) { | 68 iter != storage_namespace_map_.end(); ++iter) { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 272 } |
| 271 | 273 |
| 272 FilePath DOMStorageContext::GetLocalStorageFilePath( | 274 FilePath DOMStorageContext::GetLocalStorageFilePath( |
| 273 const string16& origin_id) const { | 275 const string16& origin_id) const { |
| 274 FilePath storageDir = data_path_.Append( | 276 FilePath storageDir = data_path_.Append( |
| 275 DOMStorageContext::kLocalStorageDirectory); | 277 DOMStorageContext::kLocalStorageDirectory); |
| 276 FilePath::StringType id = | 278 FilePath::StringType id = |
| 277 webkit_glue::WebStringToFilePathString(origin_id); | 279 webkit_glue::WebStringToFilePathString(origin_id); |
| 278 return storageDir.Append(id.append(kLocalStorageExtension)); | 280 return storageDir.Append(id.append(kLocalStorageExtension)); |
| 279 } | 281 } |
| 282 |
| 283 const content::ResourceContext& DOMStorageContext::GetResourceContext() const { |
| 284 return resource_context_; |
| 285 } |
| OLD | NEW |