Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "modules/storage/StorageNamespace.h" | 26 #include "modules/storage/StorageNamespace.h" |
| 27 | 27 |
| 28 #include "modules/storage/StorageArea.h" | 28 #include "modules/storage/StorageArea.h" |
| 29 #include "platform/weborigin/SecurityOrigin.h" | 29 #include "platform/weborigin/SecurityOrigin.h" |
| 30 #include "public/platform/Platform.h" | 30 #include "public/platform/Platform.h" |
| 31 #include "public/platform/WebSecurityOrigin.h" | |
| 31 #include "public/platform/WebStorageArea.h" | 32 #include "public/platform/WebStorageArea.h" |
| 32 #include "public/platform/WebStorageNamespace.h" | 33 #include "public/platform/WebStorageNamespace.h" |
| 33 #include "wtf/PtrUtil.h" | 34 #include "wtf/PtrUtil.h" |
| 34 #include <memory> | 35 #include <memory> |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 StorageNamespace::StorageNamespace( | 39 StorageNamespace::StorageNamespace( |
| 39 std::unique_ptr<WebStorageNamespace> webStorageNamespace) | 40 std::unique_ptr<WebStorageNamespace> webStorageNamespace) |
| 40 : m_webStorageNamespace(std::move(webStorageNamespace)) {} | 41 : m_webStorageNamespace(std::move(webStorageNamespace)) {} |
| 41 | 42 |
| 42 StorageNamespace::~StorageNamespace() {} | 43 StorageNamespace::~StorageNamespace() {} |
| 43 | 44 |
| 44 StorageArea* StorageNamespace::localStorageArea(SecurityOrigin* origin) { | 45 StorageArea* StorageNamespace::localStorageArea(SecurityOrigin* origin) { |
| 45 ASSERT(isMainThread()); | 46 ASSERT(isMainThread()); |
| 46 static WebStorageNamespace* localStorageNamespace = nullptr; | 47 static WebStorageNamespace* localStorageNamespace = nullptr; |
| 47 if (!localStorageNamespace) | 48 if (!localStorageNamespace) |
| 48 localStorageNamespace = Platform::current()->createLocalStorageNamespace(); | 49 localStorageNamespace = Platform::current()->createLocalStorageNamespace(); |
| 49 return StorageArea::create( | 50 return StorageArea::create( |
| 50 wrapUnique(localStorageNamespace->createStorageArea(origin->toString())), | 51 wrapUnique( |
| 52 localStorageNamespace->createStorageArea(WebSecurityOrigin(origin))), | |
|
esprehn
2016/10/08 03:36:23
Does WebSecurityOrigin not implicitly convert? I t
Charlie Harrison
2016/10/09 02:40:11
No it doesn't implicitly convert. My C++ foo isn't
| |
| 51 LocalStorage); | 53 LocalStorage); |
| 52 } | 54 } |
| 53 | 55 |
| 54 StorageArea* StorageNamespace::storageArea(SecurityOrigin* origin) { | 56 StorageArea* StorageNamespace::storageArea(SecurityOrigin* origin) { |
| 55 return StorageArea::create( | 57 return StorageArea::create( |
| 56 wrapUnique(m_webStorageNamespace->createStorageArea(origin->toString())), | 58 wrapUnique( |
| 59 m_webStorageNamespace->createStorageArea(WebSecurityOrigin(origin))), | |
| 57 SessionStorage); | 60 SessionStorage); |
| 58 } | 61 } |
| 59 | 62 |
| 60 bool StorageNamespace::isSameNamespace( | 63 bool StorageNamespace::isSameNamespace( |
| 61 const WebStorageNamespace& sessionNamespace) const { | 64 const WebStorageNamespace& sessionNamespace) const { |
| 62 return m_webStorageNamespace && | 65 return m_webStorageNamespace && |
| 63 m_webStorageNamespace->isSameNamespace(sessionNamespace); | 66 m_webStorageNamespace->isSameNamespace(sessionNamespace); |
| 64 } | 67 } |
| 65 | 68 |
| 66 } // namespace blink | 69 } // namespace blink |
| OLD | NEW |