| 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 WebFrame; |
| 13 | 14 |
| 14 // This class deals with the javascript bindings related to Event objects. | 15 // This class deals with the javascript bindings related to Event objects. |
| 15 class EventBindings { | 16 class EventBindings { |
| 16 public: | 17 public: |
| 17 static const char* kName; // The v8::Extension name, for dependencies. | 18 static const char* kName; // The v8::Extension name, for dependencies. |
| 18 static v8::Extension* Get(); | 19 static v8::Extension* Get(); |
| 19 | 20 |
| 20 // Allow RenderThread to be mocked out. | 21 // Allow RenderThread to be mocked out. |
| 21 static void SetRenderThread(RenderThreadBase* thread); | 22 static void SetRenderThread(RenderThreadBase* thread); |
| 23 static RenderThreadBase* GetRenderThread(); |
| 24 |
| 25 // Notify script that the document object is ready. We don't use the DOM |
| 26 // unload event because that causes Chrome's "sudden termination" to be |
| 27 // disabled for this renderer, meaning we'll slow down shutdown. |
| 28 static void HandleDocumentReady(WebFrame* frame); |
| 29 static void HandleDocumentClose(WebFrame* frame); |
| 22 | 30 |
| 23 // Calls the given function in each registered context which is listening | 31 // Calls the given function in each registered context which is listening |
| 24 // for events. The function can be an object property, ie: | 32 // for events. The function can be an object property, ie: |
| 25 // "chromium.Event.dispatch_". | 33 // "chromium.Event.dispatch_". |
| 26 static void CallFunction(const std::string& function_name, int argc, | 34 static void CallFunction(const std::string& function_name, int argc, |
| 27 v8::Handle<v8::Value>* argv); | 35 v8::Handle<v8::Value>* argv); |
| 28 }; | 36 }; |
| 29 | 37 |
| 30 #endif // CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ | 38 #endif // CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ |
| OLD | NEW |