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_area.h" | 5 #include "content/browser/in_process_webkit/dom_storage_area.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/in_process_webkit/dom_storage_context.h" | 8 #include "content/browser/in_process_webkit/dom_storage_context.h" |
9 #include "content/browser/in_process_webkit/dom_storage_namespace.h" | 9 #include "content/browser/in_process_webkit/dom_storage_namespace.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 CreateWebStorageAreaIfNecessary(); | 67 CreateWebStorageAreaIfNecessary(); |
68 bool somethingCleared; | 68 bool somethingCleared; |
69 storage_area_->clear(WebURL(), somethingCleared); | 69 storage_area_->clear(WebURL(), somethingCleared); |
70 return somethingCleared; | 70 return somethingCleared; |
71 } | 71 } |
72 | 72 |
73 void DOMStorageArea::PurgeMemory() { | 73 void DOMStorageArea::PurgeMemory() { |
74 storage_area_.reset(); | 74 storage_area_.reset(); |
75 } | 75 } |
76 | 76 |
| 77 void DOMStorageArea::CopyDataTo(DOMStorageArea* other) { |
| 78 for (unsigned i = 0; i < Length(); ++i) { |
| 79 string16 key = Key(i).string(); |
| 80 WebStorageArea::Result result; |
| 81 other->SetItem(key, GetItem(key).string(), &result); |
| 82 } |
| 83 } |
| 84 |
77 void DOMStorageArea::CreateWebStorageAreaIfNecessary() { | 85 void DOMStorageArea::CreateWebStorageAreaIfNecessary() { |
78 if (!storage_area_.get()) | 86 if (!storage_area_.get()) |
79 storage_area_.reset(owner_->CreateWebStorageArea(origin_)); | 87 storage_area_.reset(owner_->CreateWebStorageArea(origin_)); |
80 } | 88 } |
OLD | NEW |