| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. | 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its | 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from | 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. | 16 * this software without specific prior written permission. |
| 17 * | 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "modules/quota/DOMWindowQuota.h" | 32 #include "modules/crypto/DOMWindowCrypto.h" |
| 33 | 33 |
| 34 #include "core/dom/Document.h" | |
| 35 #include "core/page/DOMWindow.h" | 34 #include "core/page/DOMWindow.h" |
| 36 #include "core/page/Frame.h" | 35 #include "core/page/Frame.h" |
| 37 #include "core/page/PageConsole.h" | 36 #include "modules/crypto/Crypto.h" |
| 38 #include "modules/quota/StorageInfo.h" | |
| 39 #include "wtf/PassRefPtr.h" | |
| 40 | 37 |
| 41 namespace WebCore { | 38 namespace WebCore { |
| 42 | 39 |
| 43 DOMWindowQuota::DOMWindowQuota(DOMWindow* window) | 40 DOMWindowCrypto::DOMWindowCrypto(DOMWindow* window) |
| 44 : DOMWindowProperty(window->frame()) | 41 : DOMWindowProperty(window->frame()) |
| 45 { | 42 { |
| 46 } | 43 } |
| 47 | 44 |
| 48 DOMWindowQuota::~DOMWindowQuota() | 45 DOMWindowCrypto::~DOMWindowCrypto() |
| 49 { | 46 { |
| 50 } | 47 } |
| 51 | 48 |
| 52 const char* DOMWindowQuota::supplementName() | 49 const char* DOMWindowCrypto::supplementName() |
| 53 { | 50 { |
| 54 return "DOMWindowQuota"; | 51 return "DOMWindowCrypto"; |
| 55 } | 52 } |
| 56 | 53 |
| 57 // static | 54 // static |
| 58 DOMWindowQuota* DOMWindowQuota::from(DOMWindow* window) | 55 DOMWindowCrypto* DOMWindowCrypto::from(DOMWindow* window) |
| 59 { | 56 { |
| 60 DOMWindowQuota* supplement = static_cast<DOMWindowQuota*>(Supplement<DOMWind
ow>::from(window, supplementName())); | 57 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(Supplement<DOMWi
ndow>::from(window, supplementName())); |
| 61 if (!supplement) { | 58 if (!supplement) { |
| 62 supplement = new DOMWindowQuota(window); | 59 supplement = new DOMWindowCrypto(window); |
| 63 provideTo(window, supplementName(), adoptPtr(supplement)); | 60 provideTo(window, supplementName(), adoptPtr(supplement)); |
| 64 } | 61 } |
| 65 return supplement; | 62 return supplement; |
| 66 } | 63 } |
| 67 | 64 |
| 68 // static | 65 // static |
| 69 StorageInfo* DOMWindowQuota::webkitStorageInfo(DOMWindow* window) | 66 Crypto* DOMWindowCrypto::crypto(DOMWindow* window) |
| 70 { | 67 { |
| 71 return DOMWindowQuota::from(window)->webkitStorageInfo(); | 68 return DOMWindowCrypto::from(window)->crypto(); |
| 72 } | 69 } |
| 73 | 70 |
| 74 StorageInfo* DOMWindowQuota::webkitStorageInfo() const | 71 Crypto* DOMWindowCrypto::crypto() const |
| 75 { | 72 { |
| 76 if (!m_storageInfo && frame()) | 73 if (!m_crypto && frame()) |
| 77 m_storageInfo = StorageInfo::create(); | 74 m_crypto = Crypto::create(); |
| 78 return m_storageInfo.get(); | 75 return m_crypto.get(); |
| 79 } | 76 } |
| 80 | 77 |
| 81 } // namespace WebCore | 78 } // namespace WebCore |
| OLD | NEW |