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 18 matching lines...) Expand all Loading... | |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/crypto/DOMWindowCrypto.h" | 31 #include "modules/crypto/DOMWindowCrypto.h" |
32 | 32 |
33 #include "core/frame/LocalDOMWindow.h" | 33 #include "core/frame/LocalDOMWindow.h" |
34 #include "modules/crypto/Crypto.h" | 34 #include "modules/crypto/Crypto.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 DOMWindowCrypto::DOMWindowCrypto(LocalDOMWindow& window) | 38 DOMWindowCrypto::DOMWindowCrypto(LocalDOMWindow& window) |
39 : ContextClient(window.frame()) {} | 39 : Supplement<LocalDOMWindow>(window) {} |
40 | 40 |
41 const char* DOMWindowCrypto::supplementName() { | 41 const char* DOMWindowCrypto::supplementName() { |
42 return "DOMWindowCrypto"; | 42 return "DOMWindowCrypto"; |
43 } | 43 } |
44 | 44 |
45 DOMWindowCrypto& DOMWindowCrypto::from(LocalDOMWindow& window) { | 45 DOMWindowCrypto& DOMWindowCrypto::from(LocalDOMWindow& window) { |
46 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>( | 46 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>( |
47 Supplement<LocalDOMWindow>::from(window, supplementName())); | 47 Supplement<LocalDOMWindow>::from(window, supplementName())); |
48 if (!supplement) { | 48 if (!supplement) { |
49 supplement = new DOMWindowCrypto(window); | 49 supplement = new DOMWindowCrypto(window); |
50 provideTo(window, supplementName(), supplement); | 50 provideTo(window, supplementName(), supplement); |
51 } | 51 } |
52 return *supplement; | 52 return *supplement; |
53 } | 53 } |
54 | 54 |
55 Crypto* DOMWindowCrypto::crypto(DOMWindow& window) { | 55 Crypto* DOMWindowCrypto::crypto(DOMWindow& window) { |
56 return DOMWindowCrypto::from(toLocalDOMWindow(window)).crypto(); | 56 return DOMWindowCrypto::from(toLocalDOMWindow(window)).crypto(); |
57 } | 57 } |
58 | 58 |
59 Crypto* DOMWindowCrypto::crypto() const { | 59 Crypto* DOMWindowCrypto::crypto() const { |
60 if (!m_crypto && frame()) | 60 if (!m_crypto) |
haraken
2017/01/06 01:40:38
This check won't make much sense. Removed.
| |
61 m_crypto = Crypto::create(); | 61 m_crypto = Crypto::create(); |
62 return m_crypto.get(); | 62 return m_crypto.get(); |
63 } | 63 } |
64 | 64 |
65 DEFINE_TRACE(DOMWindowCrypto) { | 65 DEFINE_TRACE(DOMWindowCrypto) { |
66 visitor->trace(m_crypto); | 66 visitor->trace(m_crypto); |
67 Supplement<LocalDOMWindow>::trace(visitor); | 67 Supplement<LocalDOMWindow>::trace(visitor); |
68 ContextClient::trace(visitor); | |
69 } | 68 } |
70 | 69 |
71 } // namespace blink | 70 } // namespace blink |
OLD | NEW |