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 <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 Singleton<ExtensionData>::get()->ports.erase(port_id); | 56 Singleton<ExtensionData>::get()->ports.erase(port_id); |
57 } | 57 } |
58 | 58 |
59 const char kPortClosedError[] = "Attempting to use a disconnected port object"; | 59 const char kPortClosedError[] = "Attempting to use a disconnected port object"; |
60 const char* kExtensionDeps[] = { EventBindings::kName }; | 60 const char* kExtensionDeps[] = { EventBindings::kName }; |
61 | 61 |
62 class ExtensionImpl : public ExtensionBase { | 62 class ExtensionImpl : public ExtensionBase { |
63 public: | 63 public: |
64 ExtensionImpl() | 64 ExtensionImpl() |
65 : ExtensionBase(RendererExtensionBindings::kName, | 65 : ExtensionBase(RendererExtensionBindings::kName, |
66 GetStringResource<IDR_RENDERER_EXTENSION_BINDINGS_JS>(), | 66 GetStringResource(IDR_RENDERER_EXTENSION_BINDINGS_JS), |
67 arraysize(kExtensionDeps), kExtensionDeps) { | 67 arraysize(kExtensionDeps), kExtensionDeps) { |
68 } | 68 } |
69 ~ExtensionImpl() {} | 69 ~ExtensionImpl() {} |
70 | 70 |
71 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( | 71 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( |
72 v8::Handle<v8::String> name) { | 72 v8::Handle<v8::String> name) { |
73 if (name->Equals(v8::String::New("OpenChannelToExtension"))) { | 73 if (name->Equals(v8::String::New("OpenChannelToExtension"))) { |
74 return v8::FunctionTemplate::New(OpenChannelToExtension); | 74 return v8::FunctionTemplate::New(OpenChannelToExtension); |
75 } else if (name->Equals(v8::String::New("PostMessage"))) { | 75 } else if (name->Equals(v8::String::New("PostMessage"))) { |
76 return v8::FunctionTemplate::New(PostMessage); | 76 return v8::FunctionTemplate::New(PostMessage); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 const GURL& event_url) { | 304 const GURL& event_url) { |
305 v8::HandleScope handle_scope; | 305 v8::HandleScope handle_scope; |
306 std::vector< v8::Handle<v8::Value> > argv = ListValueToV8(args); | 306 std::vector< v8::Handle<v8::Value> > argv = ListValueToV8(args); |
307 EventBindings::CallFunction(extension_id, | 307 EventBindings::CallFunction(extension_id, |
308 function_name, | 308 function_name, |
309 argv.size(), | 309 argv.size(), |
310 &argv[0], | 310 &argv[0], |
311 renderview, | 311 renderview, |
312 event_url); | 312 event_url); |
313 } | 313 } |
OLD | NEW |