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