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

Side by Side Diff: chrome/browser/debugger/extension_ports_remote_service.h

Issue 8073023: Merge 101221 - Reland 101111 - Only deliver extension messages to contexts that care. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/874/src/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/debugger/extension_ports_remote_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // ExtensionsPorts service: wires extension message ports through the 5 // ExtensionsPorts service: wires extension message ports through the
6 // devtools remote protocol, allowing an external client program to 6 // devtools remote protocol, allowing an external client program to
7 // exchange messages with Chrome extensions. 7 // exchange messages with Chrome extensions.
8 8
9 #ifndef CHROME_BROWSER_DEBUGGER_EXTENSION_PORTS_REMOTE_SERVICE_H_ 9 #ifndef CHROME_BROWSER_DEBUGGER_EXTENSION_PORTS_REMOTE_SERVICE_H_
10 #define CHROME_BROWSER_DEBUGGER_EXTENSION_PORTS_REMOTE_SERVICE_H_ 10 #define CHROME_BROWSER_DEBUGGER_EXTENSION_PORTS_REMOTE_SERVICE_H_
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } Result; 70 } Result;
71 71
72 virtual ~ExtensionPortsRemoteService(); 72 virtual ~ExtensionPortsRemoteService();
73 73
74 // Sends a JSON message with the |response| to the external client. 74 // Sends a JSON message with the |response| to the external client.
75 // |tool| and |destination| are used as the respective header values. 75 // |tool| and |destination| are used as the respective header values.
76 void SendResponse(const base::Value& response, 76 void SendResponse(const base::Value& response,
77 const std::string& tool, 77 const std::string& tool,
78 const std::string& destination); 78 const std::string& destination);
79 79
80 // Handles a message from the ExtensionMessageService. 80 // Handles requests from ExtensionMessageService to invoke specific
81 // JavaScript functions. Currently we only handle the "disconnect" function.
81 void OnExtensionMessageInvoke(const std::string& extension_id, 82 void OnExtensionMessageInvoke(const std::string& extension_id,
82 const std::string& function_name, 83 const std::string& function_name,
83 const base::ListValue& args, 84 const base::ListValue& args,
84 const GURL& event_url); 85 const GURL& event_url);
85 // Handles a message sent from an extension through the 86 // Handles a message sent from an extension through the
86 // ExtensionMessageService, to be passed to the external client. 87 // ExtensionMessageService, to be passed to the external client.
87 void OnExtensionMessage(const std::string& message, int port_id); 88 void OnDeliverMessage(int port_id, const std::string& message);
88 // Handles a disconnect event sent from the ExtensionMessageService. 89 // Handles a disconnect event sent from the ExtensionMessageService.
89 void OnExtensionPortDisconnected(int port_id); 90 void OnExtensionPortDisconnected(int port_id);
90 91
91 // Implementation for the commands we can receive from the external client. 92 // Implementation for the commands we can receive from the external client.
92 // Opens a channel to an extension. 93 // Opens a channel to an extension.
93 void ConnectCommand(base::DictionaryValue* content, 94 void ConnectCommand(base::DictionaryValue* content,
94 base::DictionaryValue* response); 95 base::DictionaryValue* response);
95 // Disconnects a message port. 96 // Disconnects a message port.
96 void DisconnectCommand(int port_id, base::DictionaryValue* response); 97 void DisconnectCommand(int port_id, base::DictionaryValue* response);
97 // Sends a message to an extension through an established message port. 98 // Sends a message to an extension through an established message port.
98 void PostMessageCommand(int port_id, 99 void PostMessageCommand(int port_id,
99 base::DictionaryValue* content, 100 base::DictionaryValue* content,
100 base::DictionaryValue* response); 101 base::DictionaryValue* response);
101 102
102 // The delegate is used to send responses and events back to the 103 // The delegate is used to send responses and events back to the
103 // external client, and to resolve tab IDs. 104 // external client, and to resolve tab IDs.
104 DevToolsProtocolHandler* delegate_; 105 DevToolsProtocolHandler* delegate_;
105 106
106 // Set of message port IDs we successfully opened. 107 // Set of message port IDs we successfully opened.
107 typedef std::set<int> PortIdSet; 108 typedef std::set<int> PortIdSet;
108 PortIdSet openPortIds_; 109 PortIdSet openPortIds_;
109 110
110 scoped_refptr<ExtensionMessageService> service_; 111 scoped_refptr<ExtensionMessageService> service_;
111 112
112 DISALLOW_COPY_AND_ASSIGN(ExtensionPortsRemoteService); 113 DISALLOW_COPY_AND_ASSIGN(ExtensionPortsRemoteService);
113 }; 114 };
114 115
115 #endif // CHROME_BROWSER_DEBUGGER_EXTENSION_PORTS_REMOTE_SERVICE_H_ 116 #endif // CHROME_BROWSER_DEBUGGER_EXTENSION_PORTS_REMOTE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/debugger/extension_ports_remote_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698