| 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_HOST_PPAPI_HOST_H_ | 5 #ifndef PPAPI_HOST_PPAPI_HOST_H_ |
| 6 #define PPAPI_HOST_PPAPI_HOST_H_ | 6 #define PPAPI_HOST_PPAPI_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void SendUnsolicitedReply(PP_Resource resource, const IPC::Message& msg); | 62 void SendUnsolicitedReply(PP_Resource resource, const IPC::Message& msg); |
| 63 | 63 |
| 64 // Adds the given host factory filter to the host. The PpapiHost will take | 64 // Adds the given host factory filter to the host. The PpapiHost will take |
| 65 // ownership of the pointer. | 65 // ownership of the pointer. |
| 66 void AddHostFactoryFilter(scoped_ptr<HostFactory> filter); | 66 void AddHostFactoryFilter(scoped_ptr<HostFactory> filter); |
| 67 | 67 |
| 68 // Adds the given message filter to the host. The PpapiHost will take | 68 // Adds the given message filter to the host. The PpapiHost will take |
| 69 // ownership of the pointer. | 69 // ownership of the pointer. |
| 70 void AddInstanceMessageFilter(scoped_ptr<InstanceMessageFilter> filter); | 70 void AddInstanceMessageFilter(scoped_ptr<InstanceMessageFilter> filter); |
| 71 | 71 |
| 72 // Returns null if the resource doesn't exist. |
| 73 host::ResourceHost* GetResourceHost(PP_Resource resource) const; |
| 74 |
| 72 private: | 75 private: |
| 73 friend class InstanceMessageFilter; | 76 friend class InstanceMessageFilter; |
| 74 | 77 |
| 75 void HandleResourceCall( | 78 void HandleResourceCall( |
| 76 const proxy::ResourceMessageCallParams& params, | 79 const proxy::ResourceMessageCallParams& params, |
| 77 const IPC::Message& nested_msg, | 80 const IPC::Message& nested_msg, |
| 78 HostMessageContext* context); | 81 HostMessageContext* context); |
| 79 | 82 |
| 80 // Message handlers. | 83 // Message handlers. |
| 81 void OnHostMsgResourceCall(const proxy::ResourceMessageCallParams& params, | 84 void OnHostMsgResourceCall(const proxy::ResourceMessageCallParams& params, |
| 82 const IPC::Message& nested_msg); | 85 const IPC::Message& nested_msg); |
| 83 void OnHostMsgResourceSyncCall( | 86 void OnHostMsgResourceSyncCall( |
| 84 const proxy::ResourceMessageCallParams& params, | 87 const proxy::ResourceMessageCallParams& params, |
| 85 const IPC::Message& nested_msg, | 88 const IPC::Message& nested_msg, |
| 86 IPC::Message* reply_msg); | 89 IPC::Message* reply_msg); |
| 87 void OnHostMsgResourceCreated(const proxy::ResourceMessageCallParams& param, | 90 void OnHostMsgResourceCreated(const proxy::ResourceMessageCallParams& param, |
| 88 PP_Instance instance, | 91 PP_Instance instance, |
| 89 const IPC::Message& nested_msg); | 92 const IPC::Message& nested_msg); |
| 90 void OnHostMsgResourceDestroyed(PP_Resource resource); | 93 void OnHostMsgResourceDestroyed(PP_Resource resource); |
| 91 | 94 |
| 92 // Returns null if the resource doesn't exist. | |
| 93 host::ResourceHost* GetResourceHost(PP_Resource resource); | |
| 94 | |
| 95 // Non-owning pointer. | 95 // Non-owning pointer. |
| 96 IPC::Sender* sender_; | 96 IPC::Sender* sender_; |
| 97 | 97 |
| 98 PpapiPermissions permissions_; | 98 PpapiPermissions permissions_; |
| 99 | 99 |
| 100 // Filters for resource creation messages. Note that since we don't support | 100 // Filters for resource creation messages. Note that since we don't support |
| 101 // deleting these dynamically we don't need to worry about modifications | 101 // deleting these dynamically we don't need to worry about modifications |
| 102 // during iteration. If we add that capability, this should be replaced with | 102 // during iteration. If we add that capability, this should be replaced with |
| 103 // an ObserverList. | 103 // an ObserverList. |
| 104 ScopedVector<HostFactory> host_factory_filters_; | 104 ScopedVector<HostFactory> host_factory_filters_; |
| 105 | 105 |
| 106 // Filters for instance messages. Note that since we don't support deleting | 106 // Filters for instance messages. Note that since we don't support deleting |
| 107 // these dynamically we don't need to worry about modifications during | 107 // these dynamically we don't need to worry about modifications during |
| 108 // iteration. If we add that capability, this should be replaced with an | 108 // iteration. If we add that capability, this should be replaced with an |
| 109 // ObserverList. | 109 // ObserverList. |
| 110 ScopedVector<InstanceMessageFilter> instance_message_filters_; | 110 ScopedVector<InstanceMessageFilter> instance_message_filters_; |
| 111 | 111 |
| 112 typedef std::map<PP_Resource, linked_ptr<ResourceHost> > ResourceMap; | 112 typedef std::map<PP_Resource, linked_ptr<ResourceHost> > ResourceMap; |
| 113 ResourceMap resources_; | 113 ResourceMap resources_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(PpapiHost); | 115 DISALLOW_COPY_AND_ASSIGN(PpapiHost); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace host | 118 } // namespace host |
| 119 } // namespace ppapi | 119 } // namespace ppapi |
| 120 | 120 |
| 121 #endif // PPAPI_HOST_PPAPIE_HOST_H_ | 121 #endif // PPAPI_HOST_PPAPIE_HOST_H_ |
| OLD | NEW |