OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // |delegate| (never NULL) is the protocol handler instance which | 38 // |delegate| (never NULL) is the protocol handler instance which |
39 // dispatches messages to this service. | 39 // dispatches messages to this service. |
40 // The ownership of |delegate| is NOT transferred to this class. | 40 // The ownership of |delegate| is NOT transferred to this class. |
41 explicit ExtensionPortsRemoteService(DevToolsProtocolHandler* delegate); | 41 explicit ExtensionPortsRemoteService(DevToolsProtocolHandler* delegate); |
42 | 42 |
43 // DevToolsRemoteListener methods: | 43 // DevToolsRemoteListener methods: |
44 | 44 |
45 // Processes |message| from the external client (where the tool is | 45 // Processes |message| from the external client (where the tool is |
46 // "ExtensionPorts"). | 46 // "ExtensionPorts"). |
47 virtual void HandleMessage(const DevToolsRemoteMessage& message); | 47 virtual void HandleMessage(const DevToolsRemoteMessage& message) OVERRIDE; |
48 | 48 |
49 // Gets invoked on the external client socket connection loss. | 49 // Gets invoked on the external client socket connection loss. |
50 // Closes open message ports. | 50 // Closes open message ports. |
51 virtual void OnConnectionLost(); | 51 virtual void OnConnectionLost() OVERRIDE; |
52 | 52 |
53 // IPC::Message::Sender methods: | 53 // IPC::Message::Sender methods: |
54 | 54 |
55 // This is the callback through which the ExtensionMessageService | 55 // This is the callback through which the ExtensionMessageService |
56 // passes us messages from extensions as well as disconnect events. | 56 // passes us messages from extensions as well as disconnect events. |
57 virtual bool Send(IPC::Message* msg); | 57 virtual bool Send(IPC::Message* msg) OVERRIDE; |
58 | 58 |
59 private: | 59 private: |
60 // Operation result returned in the "result" field in messages sent | 60 // Operation result returned in the "result" field in messages sent |
61 // to the external client. | 61 // to the external client. |
62 typedef enum { | 62 typedef enum { |
63 RESULT_OK = 0, | 63 RESULT_OK = 0, |
64 RESULT_UNKNOWN_COMMAND, | 64 RESULT_UNKNOWN_COMMAND, |
65 RESULT_NO_SERVICE, | 65 RESULT_NO_SERVICE, |
66 RESULT_PARAMETER_ERROR, | 66 RESULT_PARAMETER_ERROR, |
67 RESULT_UNKNOWN_PORT, | 67 RESULT_UNKNOWN_PORT, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Set of message port IDs we successfully opened. | 107 // Set of message port IDs we successfully opened. |
108 typedef std::set<int> PortIdSet; | 108 typedef std::set<int> PortIdSet; |
109 PortIdSet openPortIds_; | 109 PortIdSet openPortIds_; |
110 | 110 |
111 scoped_refptr<ExtensionMessageService> service_; | 111 scoped_refptr<ExtensionMessageService> service_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(ExtensionPortsRemoteService); | 113 DISALLOW_COPY_AND_ASSIGN(ExtensionPortsRemoteService); |
114 }; | 114 }; |
115 | 115 |
116 #endif // CHROME_BROWSER_DEBUGGER_EXTENSION_PORTS_REMOTE_SERVICE_H_ | 116 #endif // CHROME_BROWSER_DEBUGGER_EXTENSION_PORTS_REMOTE_SERVICE_H_ |
OLD | NEW |