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; |
| 13 |
12 // This class deals with the javascript bindings related to Event objects. | 14 // This class deals with the javascript bindings related to Event objects. |
13 class EventBindings { | 15 class EventBindings { |
14 public: | 16 public: |
15 static const char* kName; // The v8::Extension name, for dependencies. | 17 static const char* kName; // The v8::Extension name, for dependencies. |
16 static v8::Extension* Get(); | 18 static v8::Extension* Get(); |
17 | 19 |
| 20 // Allow RenderThread to be mocked out. |
| 21 static void SetRenderThread(RenderThreadBase* thread); |
| 22 |
18 // Calls the given function in each registered context which is listening | 23 // Calls the given function in each registered context which is listening |
19 // for events. The function can be an object property, ie: | 24 // for events. The function can be an object property, ie: |
20 // "chromium.Event.dispatch_". | 25 // "chromium.Event.dispatch_". |
21 static void CallFunction(const std::string& function_name, int argc, | 26 static void CallFunction(const std::string& function_name, int argc, |
22 v8::Handle<v8::Value>* argv); | 27 v8::Handle<v8::Value>* argv); |
23 }; | 28 }; |
24 | 29 |
25 #endif // CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ | 30 #endif // CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ |
OLD | NEW |