| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ppapi/c/pp_completion_callback.h" | 10 #include "ppapi/c/pp_completion_callback.h" |
| 11 #include "ppapi/c/trusted/ppb_broker_trusted.h" | 11 #include "ppapi/c/trusted/ppb_broker_trusted.h" |
| 12 #include "ppapi/thunk/ppb_broker_api.h" | 12 #include "ppapi/thunk/ppb_broker_api.h" |
| 13 #include "webkit/plugins/ppapi/plugin_delegate.h" | 13 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 14 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 14 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 15 #include "webkit/plugins/ppapi/callbacks.h" | 15 #include "webkit/plugins/ppapi/callbacks.h" |
| 16 #include "webkit/plugins/ppapi/resource.h" | 16 #include "webkit/plugins/ppapi/resource.h" |
| 17 | 17 |
| 18 namespace webkit { | 18 namespace webkit { |
| 19 namespace ppapi { | 19 namespace ppapi { |
| 20 | 20 |
| 21 class PluginInstance; | 21 class PluginInstance; |
| 22 | 22 |
| 23 class PPB_Broker_Impl : public Resource, | 23 class PPB_Broker_Impl : public Resource, |
| 24 public ::ppapi::thunk::PPB_Broker_API, | 24 public ::ppapi::thunk::PPB_Broker_API, |
| 25 public base::SupportsWeakPtr<PPB_Broker_Impl> { | 25 public base::SupportsWeakPtr<PPB_Broker_Impl> { |
| 26 public: | 26 public: |
| 27 explicit PPB_Broker_Impl(PluginInstance* instance); | 27 explicit PPB_Broker_Impl(PluginInstance* instance); |
| 28 virtual ~PPB_Broker_Impl(); | 28 virtual ~PPB_Broker_Impl(); |
| 29 | 29 |
| 30 // ResourceObjectBase override. | 30 // Resource override. |
| 31 virtual ::ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() OVERRIDE; | 31 virtual ::ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() OVERRIDE; |
| 32 | 32 |
| 33 // PPB_BrokerTrusted implementation. | 33 // PPB_BrokerTrusted implementation. |
| 34 virtual int32_t Connect(PP_CompletionCallback connect_callback) OVERRIDE; | 34 virtual int32_t Connect(PP_CompletionCallback connect_callback) OVERRIDE; |
| 35 virtual int32_t GetHandle(int32_t* handle) OVERRIDE; | 35 virtual int32_t GetHandle(int32_t* handle) OVERRIDE; |
| 36 | 36 |
| 37 void BrokerConnected(int32_t handle, int32_t result); | 37 void BrokerConnected(int32_t handle, int32_t result); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // PluginDelegate ppapi broker object. | 40 // PluginDelegate ppapi broker object. |
| 41 // We don't own this pointer but are responsible for calling Disconnect on it. | 41 // We don't own this pointer but are responsible for calling Disconnect on it. |
| 42 PluginDelegate::PpapiBroker* broker_; | 42 PluginDelegate::PpapiBroker* broker_; |
| 43 | 43 |
| 44 // Callback invoked from BrokerConnected. | 44 // Callback invoked from BrokerConnected. |
| 45 scoped_refptr<TrackedCompletionCallback> connect_callback_; | 45 scoped_refptr<TrackedCompletionCallback> connect_callback_; |
| 46 | 46 |
| 47 // Pipe handle for the plugin instance to use to communicate with the broker. | 47 // Pipe handle for the plugin instance to use to communicate with the broker. |
| 48 // Never owned by this object. | 48 // Never owned by this object. |
| 49 int32_t pipe_handle_; | 49 int32_t pipe_handle_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl); | 51 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace ppapi | 54 } // namespace ppapi |
| 55 } // namespace webkit | 55 } // namespace webkit |
| 56 | 56 |
| 57 #endif // WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_ | 57 #endif // WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_ |
| OLD | NEW |