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 CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "ppapi/proxy/proxy_channel.h" | 10 #include "ppapi/proxy/proxy_channel.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 namespace content { | 30 namespace content { |
31 | 31 |
32 class PepperPluginDelegateImpl; | 32 class PepperPluginDelegateImpl; |
33 | 33 |
34 // This object is NOT thread-safe. | 34 // This object is NOT thread-safe. |
35 class CONTENT_EXPORT PepperBrokerDispatcherWrapper { | 35 class CONTENT_EXPORT PepperBrokerDispatcherWrapper { |
36 public: | 36 public: |
37 PepperBrokerDispatcherWrapper(); | 37 PepperBrokerDispatcherWrapper(); |
38 ~PepperBrokerDispatcherWrapper(); | 38 ~PepperBrokerDispatcherWrapper(); |
39 | 39 |
40 bool Init(base::ProcessHandle plugin_process_handle, | 40 bool Init(const IPC::ChannelHandle& channel_handle); |
41 const IPC::ChannelHandle& channel_handle); | |
42 | 41 |
43 int32_t SendHandleToBroker(PP_Instance instance, | 42 int32_t SendHandleToBroker(PP_Instance instance, |
44 base::SyncSocket::Handle handle); | 43 base::SyncSocket::Handle handle); |
45 | 44 |
46 private: | 45 private: |
47 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; | 46 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; |
48 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; | 47 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; |
49 }; | 48 }; |
50 | 49 |
51 class PepperBrokerImpl : public webkit::ppapi::PluginDelegate::Broker, | 50 class PepperBrokerImpl : public webkit::ppapi::PluginDelegate::Broker, |
52 public base::RefCountedThreadSafe<PepperBrokerImpl>{ | 51 public base::RefCountedThreadSafe<PepperBrokerImpl>{ |
53 public: | 52 public: |
54 PepperBrokerImpl(webkit::ppapi::PluginModule* plugin_module, | 53 PepperBrokerImpl(webkit::ppapi::PluginModule* plugin_module, |
55 PepperPluginDelegateImpl* delegate_); | 54 PepperPluginDelegateImpl* delegate_); |
56 | 55 |
57 // PepperBroker implementation. | 56 // PepperBroker implementation. |
58 virtual void Connect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; | 57 virtual void Connect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; |
59 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; | 58 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; |
60 | 59 |
61 // Called when the channel to the broker has been established. | 60 // Called when the channel to the broker has been established. |
62 void OnBrokerChannelConnected(base::ProcessHandle broker_process_handle, | 61 void OnBrokerChannelConnected(const IPC::ChannelHandle& channel_handle); |
63 const IPC::ChannelHandle& channel_handle); | |
64 | 62 |
65 // Connects the plugin to the broker via a pipe. | 63 // Connects the plugin to the broker via a pipe. |
66 void ConnectPluginToBroker(webkit::ppapi::PPB_Broker_Impl* client); | 64 void ConnectPluginToBroker(webkit::ppapi::PPB_Broker_Impl* client); |
67 | 65 |
68 // Asynchronously sends a pipe to the broker. | 66 // Asynchronously sends a pipe to the broker. |
69 int32_t SendHandleToBroker(PP_Instance instance, | 67 int32_t SendHandleToBroker(PP_Instance instance, |
70 base::SyncSocket::Handle handle); | 68 base::SyncSocket::Handle handle); |
71 | 69 |
72 protected: | 70 protected: |
73 friend class base::RefCountedThreadSafe<PepperBrokerImpl>; | 71 friend class base::RefCountedThreadSafe<PepperBrokerImpl>; |
(...skipping 14 matching lines...) Expand all Loading... |
88 webkit::ppapi::PluginModule* plugin_module_; | 86 webkit::ppapi::PluginModule* plugin_module_; |
89 | 87 |
90 base::WeakPtr<PepperPluginDelegateImpl> delegate_; | 88 base::WeakPtr<PepperPluginDelegateImpl> delegate_; |
91 | 89 |
92 DISALLOW_COPY_AND_ASSIGN(PepperBrokerImpl); | 90 DISALLOW_COPY_AND_ASSIGN(PepperBrokerImpl); |
93 }; | 91 }; |
94 | 92 |
95 } // namespace content | 93 } // namespace content |
96 | 94 |
97 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_ | 95 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_ |
OLD | NEW |