| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/miscellaneous_bindings.h" | 5 #include "chrome/renderer/extensions/miscellaneous_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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 public: | 67 public: |
| 68 explicit ExtensionImpl(extensions::Dispatcher* dispatcher) | 68 explicit ExtensionImpl(extensions::Dispatcher* dispatcher) |
| 69 : extensions::ChromeV8Extension(dispatcher) { | 69 : extensions::ChromeV8Extension(dispatcher) { |
| 70 RouteStaticFunction("CloseChannel", &CloseChannel); | 70 RouteStaticFunction("CloseChannel", &CloseChannel); |
| 71 RouteStaticFunction("PortAddRef", &PortAddRef); | 71 RouteStaticFunction("PortAddRef", &PortAddRef); |
| 72 RouteStaticFunction("PortRelease", &PortRelease); | 72 RouteStaticFunction("PortRelease", &PortRelease); |
| 73 RouteStaticFunction("PostMessage", &PostMessage); | 73 RouteStaticFunction("PostMessage", &PostMessage); |
| 74 RouteStaticFunction("BindToGC", &BindToGC); | 74 RouteStaticFunction("BindToGC", &BindToGC); |
| 75 } | 75 } |
| 76 | 76 |
| 77 ~ExtensionImpl() {} | 77 virtual ~ExtensionImpl() {} |
| 78 | 78 |
| 79 // Sends a message along the given channel. | 79 // Sends a message along the given channel. |
| 80 static v8::Handle<v8::Value> PostMessage(const v8::Arguments& args) { | 80 static v8::Handle<v8::Value> PostMessage(const v8::Arguments& args) { |
| 81 content::RenderView* renderview = GetCurrentRenderView(); | 81 content::RenderView* renderview = GetCurrentRenderView(); |
| 82 if (!renderview) | 82 if (!renderview) |
| 83 return v8::Undefined(); | 83 return v8::Undefined(); |
| 84 | 84 |
| 85 if (args.Length() >= 2 && args[0]->IsInt32() && args[1]->IsString()) { | 85 if (args.Length() >= 2 && args[0]->IsInt32() && args[1]->IsString()) { |
| 86 int port_id = args[0]->Int32Value(); | 86 int port_id = args[0]->Int32Value(); |
| 87 if (!HasPortData(port_id)) { | 87 if (!HasPortData(port_id)) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 std::vector<v8::Handle<v8::Value> > arguments; | 305 std::vector<v8::Handle<v8::Value> > arguments; |
| 306 arguments.push_back(v8::Integer::New(port_id)); | 306 arguments.push_back(v8::Integer::New(port_id)); |
| 307 arguments.push_back(v8::Boolean::New(connection_error)); | 307 arguments.push_back(v8::Boolean::New(connection_error)); |
| 308 (*it)->CallChromeHiddenMethod("Port.dispatchOnDisconnect", | 308 (*it)->CallChromeHiddenMethod("Port.dispatchOnDisconnect", |
| 309 arguments.size(), &arguments[0], | 309 arguments.size(), &arguments[0], |
| 310 NULL); | 310 NULL); |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace extensions | 314 } // namespace extensions |
| OLD | NEW |