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 #include "chrome/renderer/extensions/event_bindings.h" | 5 #include "chrome/renderer/extensions/event_bindings.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 return v8::Undefined(); | 101 return v8::Undefined(); |
102 } | 102 } |
103 }; | 103 }; |
104 | 104 |
105 } // namespace | 105 } // namespace |
106 | 106 |
107 const char* EventBindings::kName = "chrome/EventBindings"; | 107 const char* EventBindings::kName = "chrome/EventBindings"; |
108 | 108 |
109 v8::Extension* EventBindings::Get() { | 109 v8::Extension* EventBindings::Get() { |
| 110 static v8::Extension* extension = new ExtensionImpl(); |
110 bindings_registered = true; | 111 bindings_registered = true; |
111 return new ExtensionImpl(); | 112 return extension; |
112 } | 113 } |
113 | 114 |
114 // static | 115 // static |
115 void EventBindings::SetRenderThread(RenderThreadBase* thread) { | 116 void EventBindings::SetRenderThread(RenderThreadBase* thread) { |
116 render_thread = thread; | 117 render_thread = thread; |
117 in_unit_tests = true; | 118 in_unit_tests = true; |
118 } | 119 } |
119 | 120 |
120 // static | 121 // static |
121 RenderThreadBase* EventBindings::GetRenderThread() { | 122 RenderThreadBase* EventBindings::GetRenderThread() { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 void EventBindings::CallFunction(const std::string& function_name, | 267 void EventBindings::CallFunction(const std::string& function_name, |
267 int argc, v8::Handle<v8::Value>* argv, | 268 int argc, v8::Handle<v8::Value>* argv, |
268 RenderView* render_view) { | 269 RenderView* render_view) { |
269 for (ContextList::iterator it = GetContexts().begin(); | 270 for (ContextList::iterator it = GetContexts().begin(); |
270 it != GetContexts().end(); ++it) { | 271 it != GetContexts().end(); ++it) { |
271 if (render_view && render_view != (*it)->render_view) | 272 if (render_view && render_view != (*it)->render_view) |
272 continue; | 273 continue; |
273 CallFunctionInContext((*it)->context, function_name, argc, argv); | 274 CallFunctionInContext((*it)->context, function_name, argc, argv); |
274 } | 275 } |
275 } | 276 } |
OLD | NEW |