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

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

Issue 107083006: More v8-API-related cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/messaging_bindings.h" 5 #include "chrome/renderer/extensions/messaging_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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 externally_connectable->accepts_tls_channel_id) { 282 externally_connectable->accepts_tls_channel_id) {
283 tls_channel_id_value = 283 tls_channel_id_value =
284 v8::String::NewFromUtf8(isolate, 284 v8::String::NewFromUtf8(isolate,
285 tls_channel_id.c_str(), 285 tls_channel_id.c_str(),
286 v8::String::kNormalString, 286 v8::String::kNormalString,
287 tls_channel_id.size()); 287 tls_channel_id.size());
288 } 288 }
289 } 289 }
290 290
291 v8::Handle<v8::Value> arguments[] = { 291 v8::Handle<v8::Value> arguments[] = {
292 v8::Integer::New(target_port_id), 292 v8::Integer::New(isolate, target_port_id),
293 v8::String::NewFromUtf8(isolate, 293 v8::String::NewFromUtf8(isolate,
294 channel_name.c_str(), 294 channel_name.c_str(),
295 v8::String::kNormalString, 295 v8::String::kNormalString,
296 channel_name.size()), 296 channel_name.size()),
297 tab, v8::String::NewFromUtf8(isolate, 297 tab, v8::String::NewFromUtf8(isolate,
298 source_extension_id.c_str(), 298 source_extension_id.c_str(),
299 v8::String::kNormalString, 299 v8::String::kNormalString,
300 source_extension_id.size()), 300 source_extension_id.size()),
301 v8::String::NewFromUtf8(isolate, 301 v8::String::NewFromUtf8(isolate,
302 target_extension_id.c_str(), 302 target_extension_id.c_str(),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 restrict_to_render_view != (*it)->GetRenderView()) { 352 restrict_to_render_view != (*it)->GetRenderView()) {
353 continue; 353 continue;
354 } 354 }
355 355
356 // TODO(kalman): remove when ContextSet::ForEach is available. 356 // TODO(kalman): remove when ContextSet::ForEach is available.
357 if ((*it)->v8_context().IsEmpty()) 357 if ((*it)->v8_context().IsEmpty())
358 continue; 358 continue;
359 359
360 // Check to see whether the context has this port before bothering to create 360 // Check to see whether the context has this port before bothering to create
361 // the message. 361 // the message.
362 v8::Handle<v8::Value> port_id_handle = v8::Integer::New(target_port_id); 362 v8::Handle<v8::Value> port_id_handle =
363 v8::Integer::New(isolate, target_port_id);
363 v8::Handle<v8::Value> has_port = (*it)->module_system()->CallModuleMethod( 364 v8::Handle<v8::Value> has_port = (*it)->module_system()->CallModuleMethod(
364 "messaging", 365 "messaging",
365 "hasPort", 366 "hasPort",
366 1, &port_id_handle); 367 1, &port_id_handle);
367 368
368 CHECK(!has_port.IsEmpty()); 369 CHECK(!has_port.IsEmpty());
369 if (!has_port->BooleanValue()) 370 if (!has_port->BooleanValue())
370 continue; 371 continue;
371 372
372 std::vector<v8::Handle<v8::Value> > arguments; 373 std::vector<v8::Handle<v8::Value> > arguments;
(...skipping 23 matching lines...) Expand all
396 if (restrict_to_render_view && 397 if (restrict_to_render_view &&
397 restrict_to_render_view != (*it)->GetRenderView()) { 398 restrict_to_render_view != (*it)->GetRenderView()) {
398 continue; 399 continue;
399 } 400 }
400 401
401 // TODO(kalman): remove when ContextSet::ForEach is available. 402 // TODO(kalman): remove when ContextSet::ForEach is available.
402 if ((*it)->v8_context().IsEmpty()) 403 if ((*it)->v8_context().IsEmpty())
403 continue; 404 continue;
404 405
405 std::vector<v8::Handle<v8::Value> > arguments; 406 std::vector<v8::Handle<v8::Value> > arguments;
406 arguments.push_back(v8::Integer::New(port_id)); 407 arguments.push_back(v8::Integer::New(isolate, port_id));
407 if (!error_message.empty()) { 408 if (!error_message.empty()) {
408 arguments.push_back( 409 arguments.push_back(
409 v8::String::NewFromUtf8(isolate, error_message.c_str())); 410 v8::String::NewFromUtf8(isolate, error_message.c_str()));
410 } else { 411 } else {
411 arguments.push_back(v8::Null(isolate)); 412 arguments.push_back(v8::Null(isolate));
412 } 413 }
413 (*it)->module_system()->CallModuleMethod("messaging", 414 (*it)->module_system()->CallModuleMethod("messaging",
414 "dispatchOnDisconnect", 415 "dispatchOnDisconnect",
415 &arguments); 416 &arguments);
416 } 417 }
417 } 418 }
418 419
419 } // namespace extensions 420 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/i18n_custom_bindings.cc ('k') | chrome/renderer/extensions/page_actions_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698