| 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 PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_ |
| 6 #define PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_ | 6 #define PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" |
| 9 #include "ppapi/c/ppp_instance.h" | 10 #include "ppapi/c/ppp_instance.h" |
| 10 #include "ppapi/shared_impl/ppapi_shared_export.h" | 11 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 11 | 12 |
| 12 namespace ppapi { | 13 namespace ppapi { |
| 13 | 14 |
| 14 // This exposes the 1.1 interface and forwards it to the 1.0 interface is | 15 // This exposes the 1.1 interface and forwards it to the 1.0 interface is |
| 15 // necessary. | 16 // necessary. |
| 16 struct PPAPI_SHARED_EXPORT PPP_Instance_Combined { | 17 struct PPAPI_SHARED_EXPORT PPP_Instance_Combined { |
| 17 public: | 18 public: |
| 18 explicit PPP_Instance_Combined(const PPP_Instance_1_0& instance_if); | 19 typedef const void*(GetInterfaceFunc)(const char*); |
| 19 explicit PPP_Instance_Combined(const PPP_Instance_1_1& instance_if); | 20 // Create a PPP_Instance_Combined. Uses the given |get_interface_func| to |
| 21 // query the plugin and find the most recent version of the PPP_Instance |
| 22 // interface. |
| 23 static PPP_Instance_Combined* Create( |
| 24 base::Callback<const void*(const char*)> get_plugin_if); |
| 20 | 25 |
| 21 PP_Bool DidCreate(PP_Instance instance, | 26 PP_Bool DidCreate(PP_Instance instance, |
| 22 uint32_t argc, | 27 uint32_t argc, |
| 23 const char* argn[], | 28 const char* argn[], |
| 24 const char* argv[]); | 29 const char* argv[]); |
| 25 void DidDestroy(PP_Instance instance); | 30 void DidDestroy(PP_Instance instance); |
| 26 | 31 |
| 27 // This version of DidChangeView encapsulates all arguments for both 1.0 | 32 // This version of DidChangeView encapsulates all arguments for both 1.0 |
| 28 // and 1.1 versions of this function. Conversion from 1.1 -> 1.0 is easy, | 33 // and 1.1 versions of this function. Conversion from 1.1 -> 1.0 is easy, |
| 29 // but this class doesn't have the necessary context (resource interfaces) | 34 // but this class doesn't have the necessary context (resource interfaces) |
| 30 // to do the conversion, so the caller must do it. | 35 // to do the conversion, so the caller must do it. |
| 31 void DidChangeView(PP_Instance instance, | 36 void DidChangeView(PP_Instance instance, |
| 32 PP_Resource view_changed_resource, | 37 PP_Resource view_changed_resource, |
| 33 const struct PP_Rect* position, | 38 const struct PP_Rect* position, |
| 34 const struct PP_Rect* clip); | 39 const struct PP_Rect* clip); |
| 35 | 40 |
| 36 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus); | 41 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus); |
| 37 PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader); | 42 PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader); |
| 38 | 43 |
| 39 private: | 44 private: |
| 45 explicit PPP_Instance_Combined(const PPP_Instance_1_0& instance_if); |
| 46 explicit PPP_Instance_Combined(const PPP_Instance_1_1& instance_if); |
| 47 |
| 40 // For version 1.0, DidChangeView will be NULL, and DidChangeView_1_0 will | 48 // For version 1.0, DidChangeView will be NULL, and DidChangeView_1_0 will |
| 41 // be set below. | 49 // be set below. |
| 42 PPP_Instance_1_1 instance_1_1_; | 50 PPP_Instance_1_1 instance_1_1_; |
| 43 | 51 |
| 44 // Non-NULL when Instance 1.0 is used. | 52 // Non-NULL when Instance 1.0 is used. |
| 45 void (*did_change_view_1_0_)(PP_Instance instance, | 53 void (*did_change_view_1_0_)(PP_Instance instance, |
| 46 const struct PP_Rect* position, | 54 const struct PP_Rect* position, |
| 47 const struct PP_Rect* clip); | 55 const struct PP_Rect* clip); |
| 48 | 56 |
| 49 DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Combined); | 57 DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Combined); |
| 50 }; | 58 }; |
| 51 | 59 |
| 52 } // namespace ppapi | 60 } // namespace ppapi |
| 53 | 61 |
| 54 #endif // PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_ | 62 #endif // PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_ |
| 55 | 63 |
| OLD | NEW |