| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "v8/include/v8.h" | 11 #include "v8/include/v8.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 class RenderThreadBase; | 14 class RenderThreadBase; |
| 15 class RenderView; | 15 class RenderView; |
| 16 | 16 |
| 17 namespace WebKit { | 17 namespace WebKit { |
| 18 class WebFrame; | 18 class WebFrame; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // This class deals with the javascript bindings related to Event objects. | 21 // This class deals with the javascript bindings related to Event objects. |
| 22 class EventBindings { | 22 class EventBindings { |
| 23 public: | 23 public: |
| 24 static const char* kName; // The v8::Extension name, for dependencies. | 24 static const char* kName; // The v8::Extension name, for dependencies. |
| 25 static const char* kTestingExtensionId; |
| 26 |
| 25 static v8::Extension* Get(); | 27 static v8::Extension* Get(); |
| 26 | 28 |
| 27 // Allow RenderThread to be mocked out. | 29 // Allow RenderThread to be mocked out. |
| 28 static void SetRenderThread(RenderThreadBase* thread); | 30 static void SetRenderThread(RenderThreadBase* thread); |
| 29 static RenderThreadBase* GetRenderThread(); | 31 static RenderThreadBase* GetRenderThread(); |
| 30 | 32 |
| 31 // Handle a script context coming / going away. | 33 // Handle a script context coming / going away. |
| 32 static void HandleContextCreated(WebKit::WebFrame* frame, | 34 static void HandleContextCreated(WebKit::WebFrame* frame, |
| 33 bool content_script); | 35 bool content_script); |
| 34 static void HandleContextDestroyed(WebKit::WebFrame* frame); | 36 static void HandleContextDestroyed(WebKit::WebFrame* frame); |
| 35 | 37 |
| 36 // Calls the given function in each registered context which is listening for | 38 // Calls the given function in each registered context which is listening for |
| 37 // events. If render_view is non-NULL, only call the function in contexts | 39 // events. If render_view is non-NULL, only call the function in contexts |
| 38 // belonging to that view. See comments on | 40 // belonging to that view. See comments on |
| 39 // bindings_utils::CallFunctionInContext for more details. | 41 // bindings_utils::CallFunctionInContext for more details. |
| 40 // The called javascript function should not return a value other than | 42 // The called javascript function should not return a value other than |
| 41 // v8::Undefined(). A DCHECK is setup to break if it is otherwise. | 43 // v8::Undefined(). A DCHECK is setup to break if it is otherwise. |
| 42 static void CallFunction(const std::string& function_name, int argc, | 44 static void CallFunction(const std::string& function_name, int argc, |
| 43 v8::Handle<v8::Value>* argv, | 45 v8::Handle<v8::Value>* argv, |
| 44 RenderView* render_view, | 46 RenderView* render_view, |
| 45 bool requires_incognito_access, | 47 bool requires_incognito_access, |
| 46 const GURL& event_url); | 48 const GURL& event_url); |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 #endif // CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ | 51 #endif // CHROME_RENDERER_EXTENSIONS_EVENT_BINDINGS_H_ |
| OLD | NEW |