| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROKER_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_BROKER_DISPATCHER_H_ |
| 6 #define PPAPI_PROXY_BROKER_DISPATCHER_H_ | 6 #define PPAPI_PROXY_BROKER_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/trusted/ppp_broker.h" | 8 #include "ppapi/c/trusted/ppp_broker.h" |
| 9 #include "ppapi/proxy/proxy_channel.h" | 9 #include "ppapi/proxy/proxy_channel.h" |
| 10 | 10 |
| 11 namespace ppapi { | 11 namespace ppapi { |
| 12 namespace proxy { | 12 namespace proxy { |
| 13 | 13 |
| 14 class BrokerDispatcher : public ProxyChannel { | 14 class PPAPI_PROXY_EXPORT BrokerDispatcher : public ProxyChannel { |
| 15 public: | 15 public: |
| 16 virtual ~BrokerDispatcher(); | 16 virtual ~BrokerDispatcher(); |
| 17 | 17 |
| 18 // You must call this function before anything else. Returns true on success. | 18 // You must call this function before anything else. Returns true on success. |
| 19 // The delegate pointer must outlive this class, ownership is not | 19 // The delegate pointer must outlive this class, ownership is not |
| 20 // transferred. | 20 // transferred. |
| 21 virtual bool InitBrokerWithChannel(ProxyChannel::Delegate* delegate, | 21 virtual bool InitBrokerWithChannel(ProxyChannel::Delegate* delegate, |
| 22 const IPC::ChannelHandle& channel_handle, | 22 const IPC::ChannelHandle& channel_handle, |
| 23 bool is_client); | 23 bool is_client); |
| 24 | 24 |
| 25 // IPC::Channel::Listener implementation. | 25 // IPC::Channel::Listener implementation. |
| 26 virtual bool OnMessageReceived(const IPC::Message& msg); | 26 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 27 | 27 |
| 28 protected: | 28 protected: |
| 29 // You must call InitBrokerWithChannel after the constructor. | 29 // You must call InitBrokerWithChannel after the constructor. |
| 30 BrokerDispatcher(base::ProcessHandle remote_process_handle, | 30 BrokerDispatcher(base::ProcessHandle remote_process_handle, |
| 31 PP_ConnectInstance_Func connect_instance); | 31 PP_ConnectInstance_Func connect_instance); |
| 32 | 32 |
| 33 void OnMsgConnectToPlugin(PP_Instance instance, | 33 void OnMsgConnectToPlugin(PP_Instance instance, |
| 34 IPC::PlatformFileForTransit handle); | 34 IPC::PlatformFileForTransit handle); |
| 35 | 35 |
| 36 PP_ConnectInstance_Func connect_instance_; | 36 PP_ConnectInstance_Func connect_instance_; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(BrokerDispatcher); | 39 DISALLOW_COPY_AND_ASSIGN(BrokerDispatcher); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // The dispatcher for the browser side of the broker channel. | 42 // The dispatcher for the browser side of the broker channel. |
| 43 class BrokerHostDispatcher : public BrokerDispatcher { | 43 class PPAPI_PROXY_EXPORT BrokerHostDispatcher : public BrokerDispatcher { |
| 44 public: | 44 public: |
| 45 BrokerHostDispatcher(base::ProcessHandle remote_process_handle); | 45 BrokerHostDispatcher(base::ProcessHandle remote_process_handle); |
| 46 | 46 |
| 47 // IPC::Channel::Listener implementation. | 47 // IPC::Channel::Listener implementation. |
| 48 virtual void OnChannelError(); | 48 virtual void OnChannelError(); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // The dispatcher for the broker side of the broker channel. | 51 // The dispatcher for the broker side of the broker channel. |
| 52 class BrokerSideDispatcher : public BrokerDispatcher { | 52 class PPAPI_PROXY_EXPORT BrokerSideDispatcher : public BrokerDispatcher { |
| 53 public: | 53 public: |
| 54 BrokerSideDispatcher(base::ProcessHandle remote_process_handle, | 54 BrokerSideDispatcher(base::ProcessHandle remote_process_handle, |
| 55 PP_ConnectInstance_Func connect_instance); | 55 PP_ConnectInstance_Func connect_instance); |
| 56 | 56 |
| 57 // IPC::Channel::Listener implementation. | 57 // IPC::Channel::Listener implementation. |
| 58 virtual void OnChannelError(); | 58 virtual void OnChannelError(); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace proxy | 61 } // namespace proxy |
| 62 } // namespace ppapi | 62 } // namespace ppapi |
| 63 | 63 |
| 64 #endif // PPAPI_PROXY_BROKER_DISPATCHER_H_ | 64 #endif // PPAPI_PROXY_BROKER_DISPATCHER_H_ |
| OLD | NEW |