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

Side by Side Diff: extensions/renderer/dispatcher.cc

Issue 709933002: Add frameId to MessageSender (extension messaging API) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Generate frameId in browser Created 6 years, 1 month 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
OLDNEW
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/dispatcher.h" 5 #include "extensions/renderer/dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 851
852 MessagingBindings::DeliverMessage(script_context_set_, 852 MessagingBindings::DeliverMessage(script_context_set_,
853 target_port_id, 853 target_port_id,
854 message, 854 message,
855 NULL); // All render views. 855 NULL); // All render views.
856 } 856 }
857 857
858 void Dispatcher::OnDispatchOnConnect( 858 void Dispatcher::OnDispatchOnConnect(
859 int target_port_id, 859 int target_port_id,
860 const std::string& channel_name, 860 const std::string& channel_name,
861 const base::DictionaryValue& source_tab, 861 const ExtensionMsg_TabConnectionInfo& source,
862 const ExtensionMsg_ExternalConnectionInfo& info, 862 const ExtensionMsg_ExternalConnectionInfo& info,
863 const std::string& tls_channel_id) { 863 const std::string& tls_channel_id) {
864 DCHECK(!ContainsKey(port_to_tab_id_map_, target_port_id)); 864 DCHECK(!ContainsKey(port_to_tab_id_map_, target_port_id));
865 DCHECK_EQ(1, target_port_id % 2); // target renderer ports have odd IDs. 865 DCHECK_EQ(1, target_port_id % 2); // target renderer ports have odd IDs.
866 int sender_tab_id = -1; 866 int sender_tab_id = -1;
867 source_tab.GetInteger("id", &sender_tab_id); 867 source.tab.GetInteger("id", &sender_tab_id);
868 port_to_tab_id_map_[target_port_id] = sender_tab_id; 868 port_to_tab_id_map_[target_port_id] = sender_tab_id;
869 869
870 MessagingBindings::DispatchOnConnect(script_context_set_, 870 MessagingBindings::DispatchOnConnect(script_context_set_,
871 target_port_id, 871 target_port_id,
872 channel_name, 872 channel_name,
873 source_tab, 873 source,
874 info, 874 info,
875 tls_channel_id, 875 tls_channel_id,
876 NULL); // All render views. 876 NULL); // All render views.
877 } 877 }
878 878
879 void Dispatcher::OnDispatchOnDisconnect(int port_id, 879 void Dispatcher::OnDispatchOnDisconnect(int port_id,
880 const std::string& error_message) { 880 const std::string& error_message) {
881 MessagingBindings::DispatchOnDisconnect(script_context_set_, 881 MessagingBindings::DispatchOnDisconnect(script_context_set_,
882 port_id, 882 port_id,
883 error_message, 883 error_message,
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 return v8::Handle<v8::Object>(); 1403 return v8::Handle<v8::Object>();
1404 1404
1405 if (bind_name) 1405 if (bind_name)
1406 *bind_name = split.back(); 1406 *bind_name = split.back();
1407 1407
1408 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) 1408 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context))
1409 : bind_object; 1409 : bind_object;
1410 } 1410 }
1411 1411
1412 } // namespace extensions 1412 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698