Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: chrome/renderer/extensions/miscellaneous_bindings.cc

Issue 16032015: Extensions: pass ChromeV8Context around instead of v8::Handle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 return v8::Undefined(); 188 return v8::Undefined();
189 } 189 }
190 }; 190 };
191 191
192 } // namespace 192 } // namespace
193 193
194 namespace extensions { 194 namespace extensions {
195 195
196 ChromeV8Extension* MiscellaneousBindings::Get( 196 ChromeV8Extension* MiscellaneousBindings::Get(
197 Dispatcher* dispatcher, 197 Dispatcher* dispatcher,
198 v8::Handle<v8::Context> context) { 198 ChromeV8Context* context) {
199 return new ExtensionImpl(dispatcher, context); 199 return new ExtensionImpl(dispatcher, context);
200 } 200 }
201 201
202 // static 202 // static
203 void MiscellaneousBindings::DispatchOnConnect( 203 void MiscellaneousBindings::DispatchOnConnect(
204 const ChromeV8ContextSet::ContextSet& contexts, 204 const ChromeV8ContextSet::ContextSet& contexts,
205 int target_port_id, 205 int target_port_id,
206 const std::string& channel_name, 206 const std::string& channel_name,
207 const base::DictionaryValue& source_tab, 207 const base::DictionaryValue& source_tab,
208 const std::string& source_extension_id, 208 const std::string& source_extension_id,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } else { 334 } else {
335 arguments.push_back(v8::Null()); 335 arguments.push_back(v8::Null());
336 } 336 }
337 (*it)->CallChromeHiddenMethod("Port.dispatchOnDisconnect", 337 (*it)->CallChromeHiddenMethod("Port.dispatchOnDisconnect",
338 arguments.size(), &arguments[0], 338 arguments.size(), &arguments[0],
339 NULL); 339 NULL);
340 } 340 }
341 } 341 }
342 342
343 } // namespace extensions 343 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698