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 WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_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" |
| 11 #include "content/renderer/pepper/plugin_delegate.h" |
11 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
12 #include "ppapi/c/trusted/ppb_broker_trusted.h" | 13 #include "ppapi/c/trusted/ppb_broker_trusted.h" |
13 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
14 #include "ppapi/shared_impl/tracked_callback.h" | 15 #include "ppapi/shared_impl/tracked_callback.h" |
15 #include "ppapi/thunk/ppb_broker_api.h" | 16 #include "ppapi/thunk/ppb_broker_api.h" |
16 #include "webkit/plugins/ppapi/plugin_delegate.h" | |
17 #include "webkit/plugins/webkit_plugins_export.h" | |
18 | 17 |
19 namespace webkit { | 18 namespace webkit { |
20 namespace ppapi { | 19 namespace ppapi { |
21 | 20 |
22 class WEBKIT_PLUGINS_EXPORT PPB_Broker_Impl | 21 class PPB_Broker_Impl : public ::ppapi::Resource, |
23 : public ::ppapi::Resource, | 22 public ::ppapi::thunk::PPB_Broker_API, |
24 NON_EXPORTED_BASE(public ::ppapi::thunk::PPB_Broker_API), | 23 public base::SupportsWeakPtr<PPB_Broker_Impl> { |
25 public base::SupportsWeakPtr<PPB_Broker_Impl> { | |
26 public: | 24 public: |
27 explicit PPB_Broker_Impl(PP_Instance instance); | 25 explicit PPB_Broker_Impl(PP_Instance instance); |
28 virtual ~PPB_Broker_Impl(); | |
29 | 26 |
30 // Resource override. | 27 // Resource override. |
31 virtual ::ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() OVERRIDE; | 28 virtual ::ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() OVERRIDE; |
32 | 29 |
33 // PPB_BrokerTrusted implementation. | 30 // PPB_BrokerTrusted implementation. |
34 virtual int32_t Connect( | 31 virtual int32_t Connect( |
35 scoped_refptr< ::ppapi::TrackedCallback> connect_callback) OVERRIDE; | 32 scoped_refptr< ::ppapi::TrackedCallback> connect_callback) OVERRIDE; |
36 virtual int32_t GetHandle(int32_t* handle) OVERRIDE; | 33 virtual int32_t GetHandle(int32_t* handle) OVERRIDE; |
37 | 34 |
38 // Returns the URL of the document this plug-in runs in. This is necessary to | 35 // Returns the URL of the document this plug-in runs in. This is necessary to |
39 // decide whether to grant access to the PPAPI broker. | 36 // decide whether to grant access to the PPAPI broker. |
40 GURL GetDocumentUrl(); | 37 GURL GetDocumentUrl(); |
41 | 38 |
42 void BrokerConnected(int32_t handle, int32_t result); | 39 void BrokerConnected(int32_t handle, int32_t result); |
43 | 40 |
44 private: | 41 private: |
| 42 virtual ~PPB_Broker_Impl(); |
45 // PluginDelegate ppapi broker object. | 43 // PluginDelegate ppapi broker object. |
46 // We don't own this pointer but are responsible for calling Disconnect on it. | 44 // We don't own this pointer but are responsible for calling Disconnect on it. |
47 PluginDelegate::Broker* broker_; | 45 PluginDelegate::Broker* broker_; |
48 | 46 |
49 // Callback invoked from BrokerConnected. | 47 // Callback invoked from BrokerConnected. |
50 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; | 48 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; |
51 | 49 |
52 // Pipe handle for the plugin instance to use to communicate with the broker. | 50 // Pipe handle for the plugin instance to use to communicate with the broker. |
53 // Never owned by this object. | 51 // Never owned by this object. |
54 int32_t pipe_handle_; | 52 int32_t pipe_handle_; |
55 | 53 |
56 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl); | 54 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl); |
57 }; | 55 }; |
58 | 56 |
59 } // namespace ppapi | 57 } // namespace ppapi |
60 } // namespace webkit | 58 } // namespace webkit |
61 | 59 |
62 #endif // WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_ | 60 #endif // CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ |
OLD | NEW |