| 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 11 matching lines...) Expand all  Loading... | 
| 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/crypto/WorkerContextCrypto.h" | 32 #include "modules/crypto/WorkerGlobalScopeCrypto.h" | 
| 33 | 33 | 
| 34 #include "core/dom/ScriptExecutionContext.h" | 34 #include "core/dom/ScriptExecutionContext.h" | 
| 35 #include "modules/crypto/WorkerCrypto.h" | 35 #include "modules/crypto/WorkerCrypto.h" | 
| 36 | 36 | 
| 37 namespace WebCore { | 37 namespace WebCore { | 
| 38 | 38 | 
| 39 WorkerContextCrypto::WorkerContextCrypto() | 39 WorkerGlobalScopeCrypto::WorkerGlobalScopeCrypto() | 
| 40 { | 40 { | 
| 41 } | 41 } | 
| 42 | 42 | 
| 43 WorkerContextCrypto::~WorkerContextCrypto() | 43 WorkerGlobalScopeCrypto::~WorkerGlobalScopeCrypto() | 
| 44 { | 44 { | 
| 45 } | 45 } | 
| 46 | 46 | 
| 47 const char* WorkerContextCrypto::supplementName() | 47 const char* WorkerGlobalScopeCrypto::supplementName() | 
| 48 { | 48 { | 
| 49     return "WorkerContextCrypto"; | 49     return "WorkerGlobalScopeCrypto"; | 
| 50 } | 50 } | 
| 51 | 51 | 
| 52 // static | 52 // static | 
| 53 WorkerContextCrypto* WorkerContextCrypto::from(ScriptExecutionContext* context) | 53 WorkerGlobalScopeCrypto* WorkerGlobalScopeCrypto::from(ScriptExecutionContext* c
    ontext) | 
| 54 { | 54 { | 
| 55     WorkerContextCrypto* supplement = static_cast<WorkerContextCrypto*>(Suppleme
    nt<ScriptExecutionContext>::from(context, supplementName())); | 55     WorkerGlobalScopeCrypto* supplement = static_cast<WorkerGlobalScopeCrypto*>(
    Supplement<ScriptExecutionContext>::from(context, supplementName())); | 
| 56     if (!supplement) { | 56     if (!supplement) { | 
| 57         supplement = new WorkerContextCrypto(); | 57         supplement = new WorkerGlobalScopeCrypto(); | 
| 58         provideTo(context, supplementName(), adoptPtr(supplement)); | 58         provideTo(context, supplementName(), adoptPtr(supplement)); | 
| 59     } | 59     } | 
| 60     return supplement; | 60     return supplement; | 
| 61 } | 61 } | 
| 62 | 62 | 
| 63 // static | 63 // static | 
| 64 WorkerCrypto* WorkerContextCrypto::crypto(ScriptExecutionContext* context) | 64 WorkerCrypto* WorkerGlobalScopeCrypto::crypto(ScriptExecutionContext* context) | 
| 65 { | 65 { | 
| 66     return WorkerContextCrypto::from(context)->crypto(); | 66     return WorkerGlobalScopeCrypto::from(context)->crypto(); | 
| 67 } | 67 } | 
| 68 | 68 | 
| 69 WorkerCrypto* WorkerContextCrypto::crypto() const | 69 WorkerCrypto* WorkerGlobalScopeCrypto::crypto() const | 
| 70 { | 70 { | 
| 71     if (!m_crypto) | 71     if (!m_crypto) | 
| 72         m_crypto = WorkerCrypto::create(); | 72         m_crypto = WorkerCrypto::create(); | 
| 73     return m_crypto.get(); | 73     return m_crypto.get(); | 
| 74 } | 74 } | 
| 75 | 75 | 
| 76 } // namespace WebCore | 76 } // namespace WebCore | 
| OLD | NEW | 
|---|