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

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: rebased 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/miscellaneous_bindings.h ('k') | chrome/renderer/extensions/module_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698