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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 g_extension_data.Get().ports.erase(port_id); | 66 g_extension_data.Get().ports.erase(port_id); |
67 } | 67 } |
68 | 68 |
69 const char kPortClosedError[] = "Attempting to use a disconnected port object"; | 69 const char kPortClosedError[] = "Attempting to use a disconnected port object"; |
70 const char kReceivingEndDoesntExistError[] = | 70 const char kReceivingEndDoesntExistError[] = |
71 "Could not establish connection. Receiving end does not exist."; | 71 "Could not establish connection. Receiving end does not exist."; |
72 | 72 |
73 class ExtensionImpl : public extensions::ChromeV8Extension { | 73 class ExtensionImpl : public extensions::ChromeV8Extension { |
74 public: | 74 public: |
75 explicit ExtensionImpl(extensions::Dispatcher* dispatcher, | 75 explicit ExtensionImpl(extensions::Dispatcher* dispatcher, |
76 v8::Handle<v8::Context> context) | 76 extensions::ChromeV8Context* context) |
77 : extensions::ChromeV8Extension(dispatcher, context) { | 77 : extensions::ChromeV8Extension(dispatcher, context) { |
78 RouteFunction("CloseChannel", | 78 RouteFunction("CloseChannel", |
79 base::Bind(&ExtensionImpl::CloseChannel, base::Unretained(this))); | 79 base::Bind(&ExtensionImpl::CloseChannel, base::Unretained(this))); |
80 RouteFunction("PortAddRef", | 80 RouteFunction("PortAddRef", |
81 base::Bind(&ExtensionImpl::PortAddRef, base::Unretained(this))); | 81 base::Bind(&ExtensionImpl::PortAddRef, base::Unretained(this))); |
82 RouteFunction("PortRelease", | 82 RouteFunction("PortRelease", |
83 base::Bind(&ExtensionImpl::PortRelease, base::Unretained(this))); | 83 base::Bind(&ExtensionImpl::PortRelease, base::Unretained(this))); |
84 RouteFunction("PostMessage", | 84 RouteFunction("PostMessage", |
85 base::Bind(&ExtensionImpl::PostMessage, base::Unretained(this))); | 85 base::Bind(&ExtensionImpl::PostMessage, base::Unretained(this))); |
86 RouteFunction("BindToGC", | 86 RouteFunction("BindToGC", |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return v8::Undefined(); | 187 return v8::Undefined(); |
188 } | 188 } |
189 }; | 189 }; |
190 | 190 |
191 } // namespace | 191 } // namespace |
192 | 192 |
193 namespace extensions { | 193 namespace extensions { |
194 | 194 |
195 ChromeV8Extension* MiscellaneousBindings::Get( | 195 ChromeV8Extension* MiscellaneousBindings::Get( |
196 Dispatcher* dispatcher, | 196 Dispatcher* dispatcher, |
197 v8::Handle<v8::Context> context) { | 197 ChromeV8Context* context) { |
198 return new ExtensionImpl(dispatcher, context); | 198 return new ExtensionImpl(dispatcher, context); |
199 } | 199 } |
200 | 200 |
201 // static | 201 // static |
202 void MiscellaneousBindings::DispatchOnConnect( | 202 void MiscellaneousBindings::DispatchOnConnect( |
203 const ChromeV8ContextSet::ContextSet& contexts, | 203 const ChromeV8ContextSet::ContextSet& contexts, |
204 int target_port_id, | 204 int target_port_id, |
205 const std::string& channel_name, | 205 const std::string& channel_name, |
206 const base::DictionaryValue& source_tab, | 206 const base::DictionaryValue& source_tab, |
207 const std::string& source_extension_id, | 207 const std::string& source_extension_id, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } else { | 333 } else { |
334 arguments.push_back(v8::Null()); | 334 arguments.push_back(v8::Null()); |
335 } | 335 } |
336 (*it)->CallChromeHiddenMethod("Port.dispatchOnDisconnect", | 336 (*it)->CallChromeHiddenMethod("Port.dispatchOnDisconnect", |
337 arguments.size(), &arguments[0], | 337 arguments.size(), &arguments[0], |
338 NULL); | 338 NULL); |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 } // namespace extensions | 342 } // namespace extensions |
OLD | NEW |