| 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_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
| 10 #include "base/sync_socket.h" | 10 #include "base/sync_socket.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const IPC::ChannelHandle& channel_handle); | 36 const IPC::ChannelHandle& channel_handle); |
| 37 | 37 |
| 38 int32_t SendHandleToBroker(PP_Instance instance, | 38 int32_t SendHandleToBroker(PP_Instance instance, |
| 39 base::SyncSocket::Handle handle); | 39 base::SyncSocket::Handle handle); |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; | 42 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; |
| 43 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; | 43 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class PepperBroker : public base::RefCountedThreadSafe<PepperBroker>{ | 46 class PepperBroker : public base::RefCountedThreadSafe<PepperBroker> { |
| 47 public: | 47 public: |
| 48 explicit PepperBroker(PluginModule* plugin_module); | 48 explicit PepperBroker(PluginModule* plugin_module); |
| 49 | 49 |
| 50 // Decrements the references to the broker. | 50 // Decrements the references to the broker. |
| 51 // When there are no more references, this renderer's dispatcher is | 51 // When there are no more references, this renderer's dispatcher is |
| 52 // destroyed, allowing the broker to shutdown if appropriate. | 52 // destroyed, allowing the broker to shutdown if appropriate. |
| 53 // Callers should not reference this object after calling Disconnect(). | 53 // Callers should not reference this object after calling Disconnect(). |
| 54 void Disconnect(PPB_Broker_Impl* client); | 54 void Disconnect(PPB_Broker_Impl* client); |
| 55 | 55 |
| 56 // Adds a pending connection to the broker. Balances out Disconnect() calls. | 56 // Adds a pending connection to the broker. Balances out Disconnect() calls. |
| 57 void AddPendingConnect(PPB_Broker_Impl* client); | 57 void AddPendingConnect(PPB_Broker_Impl* client); |
| 58 | 58 |
| 59 // Called when the channel to the broker has been established. | 59 // Called when the channel to the broker has been established. |
| 60 void OnBrokerChannelConnected(base::ProcessId broker_pid, | 60 void OnBrokerChannelConnected(base::ProcessId broker_pid, |
| 61 const IPC::ChannelHandle& channel_handle); | 61 const IPC::ChannelHandle& channel_handle); |
| 62 | 62 |
| 63 // Called when we know whether permission to access the PPAPI broker was | 63 // Called when we know whether permission to access the PPAPI broker was |
| 64 // granted. | 64 // granted. |
| 65 void OnBrokerPermissionResult(PPB_Broker_Impl* client, | 65 void OnBrokerPermissionResult(PPB_Broker_Impl* client, bool result); |
| 66 bool result); | |
| 67 | 66 |
| 68 private: | 67 private: |
| 69 friend class base::RefCountedThreadSafe<PepperBroker>; | 68 friend class base::RefCountedThreadSafe<PepperBroker>; |
| 70 | 69 |
| 71 struct PendingConnection { | 70 struct PendingConnection { |
| 72 PendingConnection(); | 71 PendingConnection(); |
| 73 ~PendingConnection(); | 72 ~PendingConnection(); |
| 74 | 73 |
| 75 bool is_authorized; | 74 bool is_authorized; |
| 76 base::WeakPtr<PPB_Broker_Impl> client; | 75 base::WeakPtr<PPB_Broker_Impl> client; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 95 // Pointer to the associated plugin module. | 94 // Pointer to the associated plugin module. |
| 96 // Always set and cleared at the same time as the module's pointer to this. | 95 // Always set and cleared at the same time as the module's pointer to this. |
| 97 PluginModule* plugin_module_; | 96 PluginModule* plugin_module_; |
| 98 | 97 |
| 99 DISALLOW_COPY_AND_ASSIGN(PepperBroker); | 98 DISALLOW_COPY_AND_ASSIGN(PepperBroker); |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 } // namespace content | 101 } // namespace content |
| 103 | 102 |
| 104 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ | 103 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ |
| OLD | NEW |