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 "base/process.h" |
9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
10 #include "ppapi/proxy/proxy_channel.h" | 11 #include "ppapi/proxy/proxy_channel.h" |
11 #include "webkit/plugins/ppapi/plugin_delegate.h" | 12 #include "webkit/plugins/ppapi/plugin_delegate.h" |
12 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 13 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
13 | 14 |
14 namespace IPC { | 15 namespace IPC { |
15 struct ChannelHandle; | 16 struct ChannelHandle; |
16 } | 17 } |
17 | 18 |
18 namespace ppapi { | 19 namespace ppapi { |
(...skipping 11 matching lines...) Expand all Loading... |
30 namespace content { | 31 namespace content { |
31 | 32 |
32 class PepperPluginDelegateImpl; | 33 class PepperPluginDelegateImpl; |
33 | 34 |
34 // This object is NOT thread-safe. | 35 // This object is NOT thread-safe. |
35 class CONTENT_EXPORT PepperBrokerDispatcherWrapper { | 36 class CONTENT_EXPORT PepperBrokerDispatcherWrapper { |
36 public: | 37 public: |
37 PepperBrokerDispatcherWrapper(); | 38 PepperBrokerDispatcherWrapper(); |
38 ~PepperBrokerDispatcherWrapper(); | 39 ~PepperBrokerDispatcherWrapper(); |
39 | 40 |
40 bool Init(const IPC::ChannelHandle& channel_handle); | 41 bool Init(base::ProcessId broker_pid, |
| 42 const IPC::ChannelHandle& channel_handle); |
41 | 43 |
42 int32_t SendHandleToBroker(PP_Instance instance, | 44 int32_t SendHandleToBroker(PP_Instance instance, |
43 base::SyncSocket::Handle handle); | 45 base::SyncSocket::Handle handle); |
44 | 46 |
45 private: | 47 private: |
46 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; | 48 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; |
47 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; | 49 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; |
48 }; | 50 }; |
49 | 51 |
50 class PepperBrokerImpl : public webkit::ppapi::PluginDelegate::Broker, | 52 class PepperBrokerImpl : public webkit::ppapi::PluginDelegate::Broker, |
51 public base::RefCountedThreadSafe<PepperBrokerImpl>{ | 53 public base::RefCountedThreadSafe<PepperBrokerImpl>{ |
52 public: | 54 public: |
53 PepperBrokerImpl(webkit::ppapi::PluginModule* plugin_module, | 55 PepperBrokerImpl(webkit::ppapi::PluginModule* plugin_module, |
54 PepperPluginDelegateImpl* delegate_); | 56 PepperPluginDelegateImpl* delegate_); |
55 | 57 |
56 // webkit::ppapi::PluginDelegate::Broker implementation. | 58 // webkit::ppapi::PluginDelegate::Broker implementation. |
57 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; | 59 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; |
58 | 60 |
59 // Adds a pending connection to the broker. Balances out Disconnect() calls. | 61 // Adds a pending connection to the broker. Balances out Disconnect() calls. |
60 void AddPendingConnect(webkit::ppapi::PPB_Broker_Impl* client); | 62 void AddPendingConnect(webkit::ppapi::PPB_Broker_Impl* client); |
61 | 63 |
62 // Called when the channel to the broker has been established. | 64 // Called when the channel to the broker has been established. |
63 void OnBrokerChannelConnected(const IPC::ChannelHandle& channel_handle); | 65 void OnBrokerChannelConnected(base::ProcessId broker_pid, |
| 66 const IPC::ChannelHandle& channel_handle); |
64 | 67 |
65 // Called when we know whether permission to access the PPAPI broker was | 68 // Called when we know whether permission to access the PPAPI broker was |
66 // granted. | 69 // granted. |
67 void OnBrokerPermissionResult(webkit::ppapi::PPB_Broker_Impl* client, | 70 void OnBrokerPermissionResult(webkit::ppapi::PPB_Broker_Impl* client, |
68 bool result); | 71 bool result); |
69 | 72 |
70 private: | 73 private: |
71 friend class base::RefCountedThreadSafe<PepperBrokerImpl>; | 74 friend class base::RefCountedThreadSafe<PepperBrokerImpl>; |
72 | 75 |
73 struct PendingConnection { | 76 struct PendingConnection { |
(...skipping 26 matching lines...) Expand all Loading... |
100 webkit::ppapi::PluginModule* plugin_module_; | 103 webkit::ppapi::PluginModule* plugin_module_; |
101 | 104 |
102 base::WeakPtr<PepperPluginDelegateImpl> delegate_; | 105 base::WeakPtr<PepperPluginDelegateImpl> delegate_; |
103 | 106 |
104 DISALLOW_COPY_AND_ASSIGN(PepperBrokerImpl); | 107 DISALLOW_COPY_AND_ASSIGN(PepperBrokerImpl); |
105 }; | 108 }; |
106 | 109 |
107 } // namespace content | 110 } // namespace content |
108 | 111 |
109 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_ | 112 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_ |
OLD | NEW |