diff options
author | ddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-16 22:12:45 +0000 |
---|---|---|
committer | ddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-16 22:12:45 +0000 |
commit | e2614c60e3bab6cc1b949ecd8101189d285da17f (patch) | |
tree | f664f4e27974b7dee547aba035abef48e27c167c /ppapi/proxy/broker_dispatcher.h | |
parent | 64a2958841eb968837a90c9a738d9b68e33abb70 (diff) | |
download | chromium_src-e2614c60e3bab6cc1b949ecd8101189d285da17f.zip chromium_src-e2614c60e3bab6cc1b949ecd8101189d285da17f.tar.gz chromium_src-e2614c60e3bab6cc1b949ecd8101189d285da17f.tar.bz2 |
Refactored ppapi Dispatcher to share common code between the plugin and broker dispatchers.
Common code is in DispatcherBase. The base of the dispatcher for plugins remains Dispatcher. The base of the dispatcher for Brokers is BrokerDispatcher.
BUG=none
TEST=ppapi out-of-process plugins
Review URL: http://codereview.chromium.org/6859003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81883 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/broker_dispatcher.h')
-rw-r--r-- | ppapi/proxy/broker_dispatcher.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ppapi/proxy/broker_dispatcher.h b/ppapi/proxy/broker_dispatcher.h new file mode 100644 index 0000000..6b0673b --- /dev/null +++ b/ppapi/proxy/broker_dispatcher.h @@ -0,0 +1,45 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_PROXY_BROKER_DISPATCHER_H_ +#define PPAPI_PROXY_BROKER_DISPATCHER_H_ + +#include "ppapi/c/trusted/ppp_broker.h" +#include "ppapi/proxy/proxy_channel.h" + +namespace pp { +namespace proxy { + +class BrokerDispatcher : public ProxyChannel { + public: + virtual ~BrokerDispatcher(); + + // You must call this function before anything else. Returns true on success. + // The delegate pointer must outlive this class, ownership is not + // transferred. + virtual bool InitBrokerWithChannel(ProxyChannel::Delegate* delegate, + const IPC::ChannelHandle& channel_handle, + bool is_client); + + // Returns true if the dispatcher is on the broker side, or false if it's the + // browser side. + // TODO(ddorwin): Implement. + // virtual bool IsBroker() const = 0; + + // IPC::Channel::Listener implementation. + virtual bool OnMessageReceived(const IPC::Message& msg); + + protected: + // You must call InitBrokerWithChannel after the constructor. + BrokerDispatcher(base::ProcessHandle remote_process_handle, + PP_ConnectInstance_Func connect_instance); + + private: + DISALLOW_COPY_AND_ASSIGN(BrokerDispatcher); +}; + +} // namespace proxy +} // namespace pp + +#endif // PPAPI_PROXY_BROKER_DISPATCHER_H_ |