Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: Source/modules/crypto/WorkerContextCrypto.cpp

Issue 16820007: Expose crypto.getRandomValues() to workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/crypto/WorkerContextCrypto.cpp
diff --git a/Source/modules/crypto/DOMWindowCrypto.cpp b/Source/modules/crypto/WorkerContextCrypto.cpp
similarity index 66%
copy from Source/modules/crypto/DOMWindowCrypto.cpp
copy to Source/modules/crypto/WorkerContextCrypto.cpp
index 237c298876451ce2a910a4969e8e153aaa23ff93..65b8322ef04007630bf2031b67c824a48a3b5a7f 100644
--- a/Source/modules/crypto/DOMWindowCrypto.cpp
+++ b/Source/modules/crypto/WorkerContextCrypto.cpp
@@ -29,49 +29,47 @@
*/
#include "config.h"
-#include "modules/crypto/DOMWindowCrypto.h"
+#include "modules/crypto/WorkerContextCrypto.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "modules/crypto/Crypto.h"
+#include "core/dom/ScriptExecutionContext.h"
+#include "modules/crypto/WorkerCrypto.h"
namespace WebCore {
-DOMWindowCrypto::DOMWindowCrypto(DOMWindow* window)
- : DOMWindowProperty(window->frame())
+WorkerContextCrypto::WorkerContextCrypto()
{
}
-DOMWindowCrypto::~DOMWindowCrypto()
+WorkerContextCrypto::~WorkerContextCrypto()
{
}
-const char* DOMWindowCrypto::supplementName()
+const char* WorkerContextCrypto::supplementName()
{
- return "DOMWindowCrypto";
+ return "WorkerContextCrypto";
}
// static
-DOMWindowCrypto* DOMWindowCrypto::from(DOMWindow* window)
+WorkerContextCrypto* WorkerContextCrypto::from(ScriptExecutionContext* context)
{
- DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(Supplement<DOMWindow>::from(window, supplementName()));
+ WorkerContextCrypto* supplement = static_cast<WorkerContextCrypto*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
if (!supplement) {
- supplement = new DOMWindowCrypto(window);
- provideTo(window, supplementName(), adoptPtr(supplement));
+ supplement = new WorkerContextCrypto();
+ provideTo(context, supplementName(), adoptPtr(supplement));
}
return supplement;
}
// static
-Crypto* DOMWindowCrypto::crypto(DOMWindow* window)
+WorkerCrypto* WorkerContextCrypto::crypto(ScriptExecutionContext* context)
{
- return DOMWindowCrypto::from(window)->crypto();
+ return WorkerContextCrypto::from(context)->crypto();
}
-Crypto* DOMWindowCrypto::crypto() const
+WorkerCrypto* WorkerContextCrypto::crypto() const
{
- if (!m_crypto && frame())
- m_crypto = Crypto::create();
+ if (!m_crypto)
+ m_crypto = WorkerCrypto::create();
return m_crypto.get();
}

Powered by Google App Engine
This is Rietveld 408576698