| 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 PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Plugin dispatcher IDs will be used to dispatch messages from the browser. | 76 // Plugin dispatcher IDs will be used to dispatch messages from the browser. |
| 77 // Each call to Register() has to be matched with a call to Unregister(). | 77 // Each call to Register() has to be matched with a call to Unregister(). |
| 78 virtual uint32 Register(PluginDispatcher* plugin_dispatcher) = 0; | 78 virtual uint32 Register(PluginDispatcher* plugin_dispatcher) = 0; |
| 79 virtual void Unregister(uint32 plugin_dispatcher_id) = 0; | 79 virtual void Unregister(uint32 plugin_dispatcher_id) = 0; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 // Constructor for the plugin side. The init and shutdown functions will be | 82 // Constructor for the plugin side. The init and shutdown functions will be |
| 83 // will be automatically called when requested by the renderer side. The | 83 // will be automatically called when requested by the renderer side. The |
| 84 // module ID will be set upon receipt of the InitializeModule message. | 84 // module ID will be set upon receipt of the InitializeModule message. |
| 85 // | 85 // |
| 86 // Note about permissions: On the plugin side, the dispatcher and the plugin |
| 87 // run in the same address space (including in nacl). This means that the |
| 88 // permissions here are subject to malicious modification and bypass, and |
| 89 // an exploited or malicious plugin could send any IPC messages and just |
| 90 // bypass the permissions. All permissions must be checked "for realz" in the |
| 91 // host process when receiving messages. We check them on the plugin side |
| 92 // primarily to keep honest plugins honest, especially with respect to |
| 93 // dev interfaces that they "shouldn't" be using. |
| 94 // |
| 86 // You must call InitPluginWithChannel after the constructor. | 95 // You must call InitPluginWithChannel after the constructor. |
| 87 PluginDispatcher(PP_GetInterface_Func get_interface, | 96 PluginDispatcher(PP_GetInterface_Func get_interface, |
| 97 const PpapiPermissions& permissions, |
| 88 bool incognito); | 98 bool incognito); |
| 89 virtual ~PluginDispatcher(); | 99 virtual ~PluginDispatcher(); |
| 90 | 100 |
| 91 // The plugin side maintains a mapping from PP_Instance to Dispatcher so | 101 // The plugin side maintains a mapping from PP_Instance to Dispatcher so |
| 92 // that we can send the messages to the right channel if there are multiple | 102 // that we can send the messages to the right channel if there are multiple |
| 93 // renderers sharing the same plugin. This mapping is maintained by | 103 // renderers sharing the same plugin. This mapping is maintained by |
| 94 // DidCreateInstance/DidDestroyInstance. | 104 // DidCreateInstance/DidDestroyInstance. |
| 95 static PluginDispatcher* GetForInstance(PP_Instance instance); | 105 static PluginDispatcher* GetForInstance(PP_Instance instance); |
| 96 | 106 |
| 97 // Same as GetForInstance but retrieves the instance from the given resource | 107 // Same as GetForInstance but retrieves the instance from the given resource |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // incognito mode. | 201 // incognito mode. |
| 192 bool incognito_; | 202 bool incognito_; |
| 193 | 203 |
| 194 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); | 204 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); |
| 195 }; | 205 }; |
| 196 | 206 |
| 197 } // namespace proxy | 207 } // namespace proxy |
| 198 } // namespace ppapi | 208 } // namespace ppapi |
| 199 | 209 |
| 200 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 210 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| OLD | NEW |