summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 21:48:32 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 21:48:32 +0000
commitf816c01e9c6f6f0365ba80ba3f661e38461a0537 (patch)
tree1f3cd0fdfd2951c10c164c41f8bd209e14c3fc0a /chrome/renderer/extensions
parent49a415c979692c045b25eb4c3e0369a83b5316e6 (diff)
downloadchromium_src-f816c01e9c6f6f0365ba80ba3f661e38461a0537.zip
chromium_src-f816c01e9c6f6f0365ba80ba3f661e38461a0537.tar.gz
chromium_src-f816c01e9c6f6f0365ba80ba3f661e38461a0537.tar.bz2
Add notifications for when V8Proxy creates or destroys a V8 Context.
BUG=no TEST=no Review URL: http://codereview.chromium.org/147124 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19424 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions')
-rw-r--r--chrome/renderer/extensions/event_bindings.cc17
-rw-r--r--chrome/renderer/extensions/event_bindings.h5
2 files changed, 22 insertions, 0 deletions
diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc
index 576beba..7c988e2 100644
--- a/chrome/renderer/extensions/event_bindings.cc
+++ b/chrome/renderer/extensions/event_bindings.cc
@@ -12,6 +12,7 @@
#include "chrome/renderer/js_only_v8_extensions.h"
#include "chrome/renderer/render_thread.h"
#include "grit/renderer_resources.h"
+#include "webkit/glue/webframe.h"
namespace {
@@ -164,6 +165,22 @@ void EventBindings::SetRenderThread(RenderThreadBase* thread) {
render_thread = thread;
}
+// static
+void EventBindings::HandleContextCreated(WebFrame* frame) {
+ v8::HandleScope handle_scope;
+ v8::Local<v8::Context> context = frame->GetScriptContext();
+ DCHECK(!context.IsEmpty());
+ // TODO(mpcomplete): register it
+}
+
+// static
+void EventBindings::HandleContextDestroyed(WebFrame* frame) {
+ v8::HandleScope handle_scope;
+ v8::Local<v8::Context> context = frame->GetScriptContext();
+ DCHECK(!context.IsEmpty());
+ // TODO(mpcomplete): unregister it, dispatch event
+}
+
void EventBindings::CallFunction(const std::string& function_name,
int argc, v8::Handle<v8::Value>* argv) {
for (ContextList::iterator it = GetRegisteredContexts().begin();
diff --git a/chrome/renderer/extensions/event_bindings.h b/chrome/renderer/extensions/event_bindings.h
index 0ca59c0..a026c19 100644
--- a/chrome/renderer/extensions/event_bindings.h
+++ b/chrome/renderer/extensions/event_bindings.h
@@ -10,6 +10,7 @@
#include <string>
class RenderThreadBase;
+class WebFrame;
// This class deals with the javascript bindings related to Event objects.
class EventBindings {
@@ -20,6 +21,10 @@ class EventBindings {
// Allow RenderThread to be mocked out.
static void SetRenderThread(RenderThreadBase* thread);
+ // Handle a script context coming / going away.
+ static void HandleContextCreated(WebFrame* frame);
+ static void HandleContextDestroyed(WebFrame* frame);
+
// Calls the given function in each registered context which is listening
// for events. The function can be an object property, ie:
// "chromium.Event.dispatch_".