| 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_PPB_BROKER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class PepperBroker; | 26 class PepperBroker; |
| 27 | 27 |
| 28 class PPB_Broker_Impl : public ppapi::Resource, | 28 class PPB_Broker_Impl : public ppapi::Resource, |
| 29 public ppapi::thunk::PPB_Broker_API, | 29 public ppapi::thunk::PPB_Broker_API, |
| 30 public IPC::Listener, | 30 public IPC::Listener, |
| 31 public base::SupportsWeakPtr<PPB_Broker_Impl> { | 31 public base::SupportsWeakPtr<PPB_Broker_Impl> { |
| 32 public: | 32 public: |
| 33 explicit PPB_Broker_Impl(PP_Instance instance); | 33 explicit PPB_Broker_Impl(PP_Instance instance); |
| 34 | 34 |
| 35 // Resource override. | 35 // Resource override. |
| 36 virtual ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() override; | 36 ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() override; |
| 37 | 37 |
| 38 // PPB_BrokerTrusted implementation. | 38 // PPB_BrokerTrusted implementation. |
| 39 virtual int32_t Connect( | 39 int32_t Connect( |
| 40 scoped_refptr<ppapi::TrackedCallback> connect_callback) override; | 40 scoped_refptr<ppapi::TrackedCallback> connect_callback) override; |
| 41 virtual int32_t GetHandle(int32_t* handle) override; | 41 int32_t GetHandle(int32_t* handle) override; |
| 42 | 42 |
| 43 // Returns the URL of the document this plug-in runs in. This is necessary to | 43 // Returns the URL of the document this plug-in runs in. This is necessary to |
| 44 // decide whether to grant access to the PPAPI broker. | 44 // decide whether to grant access to the PPAPI broker. |
| 45 GURL GetDocumentUrl(); | 45 GURL GetDocumentUrl(); |
| 46 | 46 |
| 47 void BrokerConnected(int32_t handle, int32_t result); | 47 void BrokerConnected(int32_t handle, int32_t result); |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 virtual ~PPB_Broker_Impl(); | 50 ~PPB_Broker_Impl() override; |
| 51 | 51 |
| 52 // IPC::Listener implementation. | 52 // IPC::Listener implementation. |
| 53 virtual bool OnMessageReceived(const IPC::Message& message) override; | 53 bool OnMessageReceived(const IPC::Message& message) override; |
| 54 | 54 |
| 55 void OnPpapiBrokerChannelCreated(base::ProcessId broker_pid, | 55 void OnPpapiBrokerChannelCreated(base::ProcessId broker_pid, |
| 56 const IPC::ChannelHandle& handle); | 56 const IPC::ChannelHandle& handle); |
| 57 void OnPpapiBrokerPermissionResult(bool result); | 57 void OnPpapiBrokerPermissionResult(bool result); |
| 58 | 58 |
| 59 // PluginDelegate ppapi broker object. | 59 // PluginDelegate ppapi broker object. |
| 60 // We don't own this pointer but are responsible for calling Disconnect on it. | 60 // We don't own this pointer but are responsible for calling Disconnect on it. |
| 61 PepperBroker* broker_; | 61 PepperBroker* broker_; |
| 62 | 62 |
| 63 // Callback invoked from BrokerConnected. | 63 // Callback invoked from BrokerConnected. |
| 64 scoped_refptr<ppapi::TrackedCallback> connect_callback_; | 64 scoped_refptr<ppapi::TrackedCallback> connect_callback_; |
| 65 | 65 |
| 66 // Pipe handle for the plugin instance to use to communicate with the broker. | 66 // Pipe handle for the plugin instance to use to communicate with the broker. |
| 67 // Never owned by this object. | 67 // Never owned by this object. |
| 68 int32_t pipe_handle_; | 68 int32_t pipe_handle_; |
| 69 | 69 |
| 70 int routing_id_; | 70 int routing_id_; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl); | 72 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace content | 75 } // namespace content |
| 76 | 76 |
| 77 #endif // CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ | 77 #endif // CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ |
| OLD | NEW |