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/renderer_extension_bindings.h" | 5 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 return v8_values; | 187 return v8_values; |
188 } | 188 } |
189 | 189 |
190 } // namespace | 190 } // namespace |
191 | 191 |
192 const char* RendererExtensionBindings::kName = | 192 const char* RendererExtensionBindings::kName = |
193 "chrome/RendererExtensionBindings"; | 193 "chrome/RendererExtensionBindings"; |
194 | 194 |
195 v8::Extension* RendererExtensionBindings::Get() { | 195 v8::Extension* RendererExtensionBindings::Get() { |
196 return new ExtensionImpl(); | 196 static v8::Extension* extension = new ExtensionImpl(); |
| 197 return extension; |
197 } | 198 } |
198 | 199 |
199 void RendererExtensionBindings::Invoke(const std::string& function_name, | 200 void RendererExtensionBindings::Invoke(const std::string& function_name, |
200 const ListValue& args, | 201 const ListValue& args, |
201 RenderView* renderview) { | 202 RenderView* renderview) { |
202 v8::HandleScope handle_scope; | 203 v8::HandleScope handle_scope; |
203 std::vector< v8::Handle<v8::Value> > argv = ListValueToV8(args); | 204 std::vector< v8::Handle<v8::Value> > argv = ListValueToV8(args); |
204 EventBindings::CallFunction(function_name, argv.size(), &argv[0], renderview); | 205 EventBindings::CallFunction(function_name, argv.size(), &argv[0], renderview); |
205 } | 206 } |
OLD | NEW |