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 "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/DOMWindow.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(DOMWindow& 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(DOMWindow& window) |
54 { | 54 { |
55 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(Supplement<DOMWi
ndow>::from(window, supplementName())); | 55 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(Supplement<DOMWi
ndow>::from(window, supplementName())); |
56 if (!supplement) { | 56 if (!supplement) { |
57 supplement = new DOMWindowCrypto(window); | 57 supplement = new DOMWindowCrypto(window); |
58 provideTo(window, supplementName(), adoptPtr(supplement)); | 58 provideTo(window, supplementName(), adoptPtr(supplement)); |
59 } | 59 } |
60 return supplement; | 60 return *supplement; |
61 } | 61 } |
62 | 62 |
63 Crypto* DOMWindowCrypto::crypto(DOMWindow* window) | 63 Crypto* DOMWindowCrypto::crypto(DOMWindow& 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 } // namespace WebCore | 75 } // namespace WebCore |
OLD | NEW |