| 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_MESSAGE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_MESSAGE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_MESSAGE_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_MESSAGE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const std::string& channel_name); | 71 const std::string& channel_name); |
| 72 | 72 |
| 73 // Same as above, but opens a channel to the tab with the given ID. Messages | 73 // Same as above, but opens a channel to the tab with the given ID. Messages |
| 74 // are restricted to that tab, so if there are multiple tabs in that process, | 74 // are restricted to that tab, so if there are multiple tabs in that process, |
| 75 // only the targeted tab will receive messages. | 75 // only the targeted tab will receive messages. |
| 76 void OpenChannelToTab( | 76 void OpenChannelToTab( |
| 77 int source_process_id, int source_routing_id, int receiver_port_id, | 77 int source_process_id, int source_routing_id, int receiver_port_id, |
| 78 int tab_id, const std::string& extension_id, | 78 int tab_id, const std::string& extension_id, |
| 79 const std::string& channel_name); | 79 const std::string& channel_name); |
| 80 | 80 |
| 81 void OpenChannelToNativeApp( |
| 82 int source_process_id, int source_routing_id, int receiver_port_id, |
| 83 const std::string& source_extension_id, |
| 84 const std::string& native_app_name, |
| 85 const std::string& channel_name, |
| 86 const std::string& connect_message); |
| 87 void OpenChannelToNativeAppOnFileThread( |
| 88 int receiver_port_id, |
| 89 const std::string& native_app_name, |
| 90 const std::string& channel_name, |
| 91 const std::string& connect_message, |
| 92 MessageChannel* channel, |
| 93 const std::string& tab_json); |
| 94 |
| 81 // Closes the message channel associated with the given port, and notifies | 95 // Closes the message channel associated with the given port, and notifies |
| 82 // the other side. | 96 // the other side. |
| 83 void CloseChannel(int port_id, bool connection_error); | 97 void CloseChannel(int port_id, bool connection_error); |
| 84 | 98 |
| 85 // Sends a message from a renderer to the given port. | 99 // Sends a message from a renderer to the given port. |
| 86 void PostMessageFromRenderer(int port_id, const std::string& message); | 100 void PostMessageFromRenderer(int port_id, const std::string& message); |
| 87 | 101 |
| 88 private: | 102 private: |
| 89 friend class MockMessageService; | 103 friend class MockMessageService; |
| 90 struct OpenChannelParams; | 104 struct OpenChannelParams; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 157 |
| 144 // Weak pointer. Guaranteed to outlive this class. | 158 // Weak pointer. Guaranteed to outlive this class. |
| 145 LazyBackgroundTaskQueue* lazy_background_task_queue_; | 159 LazyBackgroundTaskQueue* lazy_background_task_queue_; |
| 146 | 160 |
| 147 DISALLOW_COPY_AND_ASSIGN(MessageService); | 161 DISALLOW_COPY_AND_ASSIGN(MessageService); |
| 148 }; | 162 }; |
| 149 | 163 |
| 150 } // namespace extensions | 164 } // namespace extensions |
| 151 | 165 |
| 152 #endif // CHROME_BROWSER_EXTENSIONS_MESSAGE_SERVICE_H_ | 166 #endif // CHROME_BROWSER_EXTENSIONS_MESSAGE_SERVICE_H_ |
| OLD | NEW |