| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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/crypto/DOMWindowCrypto.h" | 32 #include "modules/crypto/DOMWindowCrypto.h" |
| 33 | 33 |
| 34 #include "core/frame/DOMWindow.h" | 34 #include "core/frame/LocalDOMWindow.h" |
| 35 #include "modules/crypto/Crypto.h" | 35 #include "modules/crypto/Crypto.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 DOMWindowCrypto::DOMWindowCrypto(DOMWindow& window) | 39 DOMWindowCrypto::DOMWindowCrypto(LocalDOMWindow& window) |
| 40 : DOMWindowProperty(window.frame()) | 40 : DOMWindowProperty(window.frame()) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 DOMWindowCrypto::~DOMWindowCrypto() | 44 DOMWindowCrypto::~DOMWindowCrypto() |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 const char* DOMWindowCrypto::supplementName() | 48 const char* DOMWindowCrypto::supplementName() |
| 49 { | 49 { |
| 50 return "DOMWindowCrypto"; | 50 return "DOMWindowCrypto"; |
| 51 } | 51 } |
| 52 | 52 |
| 53 DOMWindowCrypto& DOMWindowCrypto::from(DOMWindow& window) | 53 DOMWindowCrypto& DOMWindowCrypto::from(LocalDOMWindow& window) |
| 54 { | 54 { |
| 55 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(WillBeHeapSupple
ment<DOMWindow>::from(window, supplementName())); | 55 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(WillBeHeapSupple
ment<LocalDOMWindow>::from(window, supplementName())); |
| 56 if (!supplement) { | 56 if (!supplement) { |
| 57 supplement = new DOMWindowCrypto(window); | 57 supplement = new DOMWindowCrypto(window); |
| 58 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement)); | 58 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 59 } | 59 } |
| 60 return *supplement; | 60 return *supplement; |
| 61 } | 61 } |
| 62 | 62 |
| 63 Crypto* DOMWindowCrypto::crypto(DOMWindow& window) | 63 Crypto* DOMWindowCrypto::crypto(LocalDOMWindow& window) |
| 64 { | 64 { |
| 65 return DOMWindowCrypto::from(window).crypto(); | 65 return DOMWindowCrypto::from(window).crypto(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 Crypto* DOMWindowCrypto::crypto() const | 68 Crypto* DOMWindowCrypto::crypto() const |
| 69 { | 69 { |
| 70 if (!m_crypto && frame()) | 70 if (!m_crypto && frame()) |
| 71 m_crypto = Crypto::create(); | 71 m_crypto = Crypto::create(); |
| 72 return m_crypto.get(); | 72 return m_crypto.get(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void DOMWindowCrypto::trace(Visitor* visitor) | 75 void DOMWindowCrypto::trace(Visitor* visitor) |
| 76 { | 76 { |
| 77 visitor->trace(m_crypto); | 77 visitor->trace(m_crypto); |
| 78 WillBeHeapSupplement<DOMWindow>::trace(visitor); | 78 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace WebCore | 81 } // namespace WebCore |
| OLD | NEW |