OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ |
7 | 7 |
8 #include "v8/include/v8.h" | 8 #include "v8/include/v8.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 class RenderThreadBase; | 12 class RenderThreadBase; |
| 13 class RenderView; |
13 class WebFrame; | 14 class WebFrame; |
14 | 15 |
15 // This class deals with the javascript bindings related to Event objects. | 16 // This class deals with the javascript bindings related to Event objects. |
16 class EventBindings { | 17 class EventBindings { |
17 public: | 18 public: |
18 static const char* kName; // The v8::Extension name, for dependencies. | 19 static const char* kName; // The v8::Extension name, for dependencies. |
19 static v8::Extension* Get(); | 20 static v8::Extension* Get(); |
20 | 21 |
21 // Allow RenderThread to be mocked out. | 22 // Allow RenderThread to be mocked out. |
22 static void SetRenderThread(RenderThreadBase* thread); | 23 static void SetRenderThread(RenderThreadBase* thread); |
23 static RenderThreadBase* GetRenderThread(); | 24 static RenderThreadBase* GetRenderThread(); |
24 | 25 |
25 // Handle a script context coming / going away. | 26 // Handle a script context coming / going away. |
26 static void HandleContextCreated(WebFrame* frame); | 27 static void HandleContextCreated(WebFrame* frame, bool contet_script); |
27 static void HandleContextDestroyed(WebFrame* frame); | 28 static void HandleContextDestroyed(WebFrame* frame); |
28 | 29 |
29 // Calls the given function in each registered context which is listening | 30 // Calls the given function in each registered context which is listening for |
30 // for events. See comments on bindings_utils::CallFunctionInContext for | 31 // events. If render_view is non-NULL, only call the function in contexts |
31 // more details. | 32 // belonging to that view. See comments on |
| 33 // bindings_utils::CallFunctionInContext for more details. |
32 static void CallFunction(const std::string& function_name, int argc, | 34 static void CallFunction(const std::string& function_name, int argc, |
33 v8::Handle<v8::Value>* argv); | 35 v8::Handle<v8::Value>* argv, |
| 36 RenderView* render_view); |
34 }; | 37 }; |
35 | 38 |
36 #endif // CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ | 39 #endif // CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ |
OLD | NEW |