Refactor android test results logging.
[chromium-blink-merge.git] / ppapi / proxy / broker_dispatcher.h
blobde83b2b1e14bf0dc9e46efe2e4fddb0d420e196f
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
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_BROKER_DISPATCHER_H_
6 #define PPAPI_PROXY_BROKER_DISPATCHER_H_
8 #include "base/compiler_specific.h"
9 #include "ppapi/c/trusted/ppp_broker.h"
10 #include "ppapi/proxy/proxy_channel.h"
12 namespace ppapi {
13 namespace proxy {
15 class PPAPI_PROXY_EXPORT BrokerDispatcher : public ProxyChannel {
16 public:
17 virtual ~BrokerDispatcher();
19 // You must call this function before anything else. Returns true on success.
20 // The delegate pointer must outlive this class, ownership is not
21 // transferred.
22 virtual bool InitBrokerWithChannel(ProxyChannel::Delegate* delegate,
23 const IPC::ChannelHandle& channel_handle,
24 bool is_client);
26 // IPC::Listener implementation.
27 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
29 protected:
30 // You must call InitBrokerWithChannel after the constructor.
31 explicit BrokerDispatcher(PP_ConnectInstance_Func connect_instance);
33 void OnMsgConnectToPlugin(PP_Instance instance,
34 IPC::PlatformFileForTransit handle,
35 int32_t* result);
37 PP_ConnectInstance_Func connect_instance_;
39 private:
40 DISALLOW_COPY_AND_ASSIGN(BrokerDispatcher);
43 // The dispatcher for the browser side of the broker channel.
44 class PPAPI_PROXY_EXPORT BrokerHostDispatcher : public BrokerDispatcher {
45 public:
46 BrokerHostDispatcher();
48 // IPC::Listener implementation.
49 virtual void OnChannelError() OVERRIDE;
52 // The dispatcher for the broker side of the broker channel.
53 class PPAPI_PROXY_EXPORT BrokerSideDispatcher : public BrokerDispatcher {
54 public:
55 explicit BrokerSideDispatcher(PP_ConnectInstance_Func connect_instance);
57 // IPC::Listener implementation.
58 virtual void OnChannelError() OVERRIDE;
61 } // namespace proxy
62 } // namespace ppapi
64 #endif // PPAPI_PROXY_BROKER_DISPATCHER_H_