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_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_DISPATCHER_H_ |
6 #define PPAPI_PROXY_DISPATCHER_H_ | 6 #define PPAPI_PROXY_DISPATCHER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // so we don't have to query for each one. We'll pre-create proxies for | 76 // so we don't have to query for each one. We'll pre-create proxies for |
77 // each of the given interfaces. | 77 // each of the given interfaces. |
78 | 78 |
79 // IPC::Listener implementation. | 79 // IPC::Listener implementation. |
80 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 80 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
81 | 81 |
82 PP_GetInterface_Func local_get_interface() const { | 82 PP_GetInterface_Func local_get_interface() const { |
83 return local_get_interface_; | 83 return local_get_interface_; |
84 } | 84 } |
85 | 85 |
| 86 const PpapiPermissions& permissions() const { return permissions_; } |
| 87 |
86 protected: | 88 protected: |
87 explicit Dispatcher(PP_GetInterface_Func local_get_interface); | 89 explicit Dispatcher(PP_GetInterface_Func local_get_interface, |
| 90 const PpapiPermissions& permissions); |
88 | 91 |
89 // Setter for the derived classes to set the appropriate var serialization. | 92 // Setter for the derived classes to set the appropriate var serialization. |
90 // Takes one reference of the given pointer, which must be on the heap. | 93 // Takes one reference of the given pointer, which must be on the heap. |
91 void SetSerializationRules(VarSerializationRules* var_serialization_rules); | 94 void SetSerializationRules(VarSerializationRules* var_serialization_rules); |
92 | 95 |
93 // Called when an invalid message is received from the remote site. The | 96 // Called when an invalid message is received from the remote site. The |
94 // default implementation does nothing, derived classes can override. | 97 // default implementation does nothing, derived classes can override. |
95 virtual void OnInvalidMessageReceived(); | 98 virtual void OnInvalidMessageReceived(); |
96 | 99 |
97 bool disallow_trusted_interfaces() const { | |
98 return disallow_trusted_interfaces_; | |
99 } | |
100 | |
101 protected: | 100 protected: |
102 std::vector<IPC::Listener*> filters_; | 101 std::vector<IPC::Listener*> filters_; |
103 | 102 |
104 private: | 103 private: |
105 friend class HostDispatcherTest; | 104 friend class HostDispatcherTest; |
106 friend class PluginDispatcherTest; | 105 friend class PluginDispatcherTest; |
107 | 106 |
108 // Lists all lazily-created interface proxies. | 107 // Lists all lazily-created interface proxies. |
109 scoped_ptr<InterfaceProxy> proxies_[API_ID_COUNT]; | 108 scoped_ptr<InterfaceProxy> proxies_[API_ID_COUNT]; |
110 | 109 |
111 bool disallow_trusted_interfaces_; | 110 bool disallow_trusted_interfaces_; |
112 | 111 |
113 PP_GetInterface_Func local_get_interface_; | 112 PP_GetInterface_Func local_get_interface_; |
114 | 113 |
115 scoped_refptr<VarSerializationRules> serialization_rules_; | 114 scoped_refptr<VarSerializationRules> serialization_rules_; |
116 | 115 |
| 116 PpapiPermissions permissions_; |
| 117 |
117 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 118 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
118 }; | 119 }; |
119 | 120 |
120 } // namespace proxy | 121 } // namespace proxy |
121 } // namespace ppapi | 122 } // namespace ppapi |
122 | 123 |
123 #endif // PPAPI_PROXY_DISPATCHER_H_ | 124 #endif // PPAPI_PROXY_DISPATCHER_H_ |
OLD | NEW |