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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // InterfaceProxy <---------------------- InterfaceProxy | 44 // InterfaceProxy <---------------------- InterfaceProxy |
45 // | | 45 // | |
46 class PPAPI_PROXY_EXPORT Dispatcher : public ProxyChannel { | 46 class PPAPI_PROXY_EXPORT Dispatcher : public ProxyChannel { |
47 public: | 47 public: |
48 virtual ~Dispatcher(); | 48 virtual ~Dispatcher(); |
49 | 49 |
50 // Returns true if the dispatcher is on the plugin side, or false if it's the | 50 // Returns true if the dispatcher is on the plugin side, or false if it's the |
51 // browser side. | 51 // browser side. |
52 virtual bool IsPlugin() const = 0; | 52 virtual bool IsPlugin() const = 0; |
53 | 53 |
| 54 void AddFilter(IPC::Channel::Listener* listener); |
| 55 |
54 VarSerializationRules* serialization_rules() const { | 56 VarSerializationRules* serialization_rules() const { |
55 return serialization_rules_.get(); | 57 return serialization_rules_.get(); |
56 } | 58 } |
57 | 59 |
58 // Returns a non-owning pointer to the interface proxy for the given ID, or | 60 // Returns a non-owning pointer to the interface proxy for the given ID, or |
59 // NULL if the ID isn't found. This will create the proxy if it hasn't been | 61 // NULL if the ID isn't found. This will create the proxy if it hasn't been |
60 // created so far. | 62 // created so far. |
61 InterfaceProxy* GetInterfaceProxy(ApiID id); | 63 InterfaceProxy* GetInterfaceProxy(ApiID id); |
62 | 64 |
63 // Returns the pointer to the IO thread for processing IPC messages. | 65 // Returns the pointer to the IO thread for processing IPC messages. |
(...skipping 25 matching lines...) Expand all Loading... |
89 void SetSerializationRules(VarSerializationRules* var_serialization_rules); | 91 void SetSerializationRules(VarSerializationRules* var_serialization_rules); |
90 | 92 |
91 // Called when an invalid message is received from the remote site. The | 93 // Called when an invalid message is received from the remote site. The |
92 // default implementation does nothing, derived classes can override. | 94 // default implementation does nothing, derived classes can override. |
93 virtual void OnInvalidMessageReceived(); | 95 virtual void OnInvalidMessageReceived(); |
94 | 96 |
95 bool disallow_trusted_interfaces() const { | 97 bool disallow_trusted_interfaces() const { |
96 return disallow_trusted_interfaces_; | 98 return disallow_trusted_interfaces_; |
97 } | 99 } |
98 | 100 |
| 101 protected: |
| 102 std::vector<IPC::Channel::Listener*> filters_; |
| 103 |
99 private: | 104 private: |
100 friend class HostDispatcherTest; | 105 friend class HostDispatcherTest; |
101 friend class PluginDispatcherTest; | 106 friend class PluginDispatcherTest; |
102 | 107 |
103 // Lists all lazily-created interface proxies. | 108 // Lists all lazily-created interface proxies. |
104 scoped_ptr<InterfaceProxy> proxies_[API_ID_COUNT]; | 109 scoped_ptr<InterfaceProxy> proxies_[API_ID_COUNT]; |
105 | 110 |
106 bool disallow_trusted_interfaces_; | 111 bool disallow_trusted_interfaces_; |
107 | 112 |
108 PP_GetInterface_Func local_get_interface_; | 113 PP_GetInterface_Func local_get_interface_; |
109 | 114 |
110 scoped_refptr<VarSerializationRules> serialization_rules_; | 115 scoped_refptr<VarSerializationRules> serialization_rules_; |
111 | 116 |
112 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 117 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
113 }; | 118 }; |
114 | 119 |
115 } // namespace proxy | 120 } // namespace proxy |
116 } // namespace ppapi | 121 } // namespace ppapi |
117 | 122 |
118 #endif // PPAPI_PROXY_DISPATCHER_H_ | 123 #endif // PPAPI_PROXY_DISPATCHER_H_ |
OLD | NEW |