Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/messaging_bindings.h" | 5 #include "extensions/renderer/messaging_bindings.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 442 | 442 |
| 443 // static | 443 // static |
| 444 void MessagingBindings::DispatchOnConnect( | 444 void MessagingBindings::DispatchOnConnect( |
| 445 const ScriptContextSet& context_set, | 445 const ScriptContextSet& context_set, |
| 446 int target_port_id, | 446 int target_port_id, |
| 447 const std::string& channel_name, | 447 const std::string& channel_name, |
| 448 const ExtensionMsg_TabConnectionInfo& source, | 448 const ExtensionMsg_TabConnectionInfo& source, |
| 449 const ExtensionMsg_ExternalConnectionInfo& info, | 449 const ExtensionMsg_ExternalConnectionInfo& info, |
| 450 const std::string& tls_channel_id, | 450 const std::string& tls_channel_id, |
| 451 content::RenderFrame* restrict_to_render_frame) { | 451 content::RenderFrame* restrict_to_render_frame) { |
| 452 int routing_id = restrict_to_render_frame | |
| 453 ? restrict_to_render_frame->GetRoutingID() | |
| 454 : MSG_ROUTING_NONE; | |
| 452 bool port_created = false; | 455 bool port_created = false; |
| 453 context_set.ForEach( | 456 context_set.ForEach( |
| 454 info.target_id, restrict_to_render_frame, | 457 info.target_id, restrict_to_render_frame, |
| 455 base::Bind(&DispatchOnConnectToScriptContext, target_port_id, | 458 base::Bind(&DispatchOnConnectToScriptContext, target_port_id, |
| 456 channel_name, &source, info, tls_channel_id, &port_created)); | 459 channel_name, &source, info, tls_channel_id, &port_created)); |
|
Devlin
2016/05/02 13:57:08
Let's add a comment like
// Note: |restrict_to_ren
| |
| 457 | 460 |
| 458 int routing_id = restrict_to_render_frame | |
| 459 ? restrict_to_render_frame->GetRoutingID() | |
| 460 : MSG_ROUTING_NONE; | |
| 461 if (port_created) { | 461 if (port_created) { |
| 462 content::RenderThread::Get()->Send( | 462 content::RenderThread::Get()->Send( |
| 463 new ExtensionHostMsg_OpenMessagePort(routing_id, target_port_id)); | 463 new ExtensionHostMsg_OpenMessagePort(routing_id, target_port_id)); |
| 464 } else { | 464 } else { |
| 465 content::RenderThread::Get()->Send(new ExtensionHostMsg_CloseMessagePort( | 465 content::RenderThread::Get()->Send(new ExtensionHostMsg_CloseMessagePort( |
| 466 routing_id, target_port_id, false)); | 466 routing_id, target_port_id, false)); |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 // static | 470 // static |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 483 const ScriptContextSet& context_set, | 483 const ScriptContextSet& context_set, |
| 484 int port_id, | 484 int port_id, |
| 485 const std::string& error_message, | 485 const std::string& error_message, |
| 486 content::RenderFrame* restrict_to_render_frame) { | 486 content::RenderFrame* restrict_to_render_frame) { |
| 487 context_set.ForEach( | 487 context_set.ForEach( |
| 488 restrict_to_render_frame, | 488 restrict_to_render_frame, |
| 489 base::Bind(&DispatchOnDisconnectToScriptContext, port_id, error_message)); | 489 base::Bind(&DispatchOnDisconnectToScriptContext, port_id, error_message)); |
| 490 } | 490 } |
| 491 | 491 |
| 492 } // namespace extensions | 492 } // namespace extensions |
| OLD | NEW |