OLD | NEW |
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/extensions/api/messaging/message_service.h" | 9 #include "chrome/browser/extensions/api/messaging/message_service.h" |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Only for receivers in an extension process. | 91 // Only for receivers in an extension process. |
92 content::RenderProcessHost* extension_process_; | 92 content::RenderProcessHost* extension_process_; |
93 | 93 |
94 // When the port is used as a sender, this set contains only one element. | 94 // When the port is used as a sender, this set contains only one element. |
95 // If used as a receiver, it may contain any number of frames. | 95 // If used as a receiver, it may contain any number of frames. |
96 // This set is populated before the first message is sent to the destination, | 96 // This set is populated before the first message is sent to the destination, |
97 // and shrinks over time when the port is rejected by the recipient frame, or | 97 // and shrinks over time when the port is rejected by the recipient frame, or |
98 // when the frame is removed or unloaded. | 98 // when the frame is removed or unloaded. |
99 std::set<content::RenderFrameHost*> frames_; | 99 std::set<content::RenderFrameHost*> frames_; |
100 | 100 |
101 // The ID of the tab where the channel was created. This is saved so that any | |
102 // onMessage events can be run in the scope of the tab. | |
103 // Only set on receiver ports (if the opener was a tab). -1 if invalid. | |
104 int opener_tab_id_; | |
105 | |
106 // Whether the renderer acknowledged creation of the port. This is used to | 101 // Whether the renderer acknowledged creation of the port. This is used to |
107 // distinguish abnormal port closure (e.g. no receivers) from explicit port | 102 // distinguish abnormal port closure (e.g. no receivers) from explicit port |
108 // closure (e.g. by the port.disconnect() JavaScript method in the renderer). | 103 // closure (e.g. by the port.disconnect() JavaScript method in the renderer). |
109 bool did_create_port_; | 104 bool did_create_port_; |
110 | 105 |
111 ExtensionHost* background_host_ptr_; // used in IncrementLazyKeepaliveCount | 106 ExtensionHost* background_host_ptr_; // used in IncrementLazyKeepaliveCount |
112 std::unique_ptr<FrameTracker> frame_tracker_; | 107 std::unique_ptr<FrameTracker> frame_tracker_; |
113 | 108 |
114 DISALLOW_COPY_AND_ASSIGN(ExtensionMessagePort); | 109 DISALLOW_COPY_AND_ASSIGN(ExtensionMessagePort); |
115 }; | 110 }; |
116 | 111 |
117 } // namespace extensions | 112 } // namespace extensions |
118 | 113 |
119 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ | 114 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ |
OLD | NEW |