| 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 #include "webkit/plugins/ppapi/ppb_var_deprecated_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_var_deprecated_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "ppapi/c/dev/ppb_var_deprecated.h" | 9 #include "ppapi/c/dev/ppb_var_deprecated.h" |
| 10 #include "ppapi/c/ppb_var.h" | 10 #include "ppapi/c/ppb_var.h" |
| 11 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
| 12 #include "ppapi/shared_impl/ppb_var_shared.h" | 12 #include "ppapi/shared_impl/ppb_var_shared.h" |
| 13 #include "third_party/WebKit/public/web/WebBindings.h" | 13 #include "third_party/WebKit/public/web/WebBindings.h" |
| 14 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 14 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
| 15 #include "webkit/plugins/ppapi/common.h" | 15 #include "webkit/plugins/ppapi/common.h" |
| 16 #include "webkit/plugins/ppapi/host_globals.h" | 16 #include "webkit/plugins/ppapi/host_globals.h" |
| 17 #include "webkit/plugins/ppapi/npapi_glue.h" | 17 #include "webkit/plugins/ppapi/npapi_glue.h" |
| 18 #include "webkit/plugins/ppapi/npobject_var.h" | 18 #include "webkit/plugins/ppapi/npobject_var.h" |
| 19 #include "webkit/plugins/ppapi/plugin_module.h" | 19 #include "webkit/plugins/ppapi/plugin_module.h" |
| 20 #include "webkit/plugins/ppapi/plugin_object.h" | 20 #include "webkit/plugins/ppapi/plugin_object.h" |
| 21 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 21 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" |
| 22 | 22 |
| 23 using ppapi::NPObjectVar; | 23 using ppapi::NPObjectVar; |
| 24 using ppapi::PpapiGlobals; | 24 using ppapi::PpapiGlobals; |
| 25 using ppapi::StringVar; | 25 using ppapi::StringVar; |
| 26 using ppapi::Var; | 26 using ppapi::Var; |
| 27 using WebKit::WebBindings; | 27 using WebKit::WebBindings; |
| 28 | 28 |
| 29 namespace webkit { | 29 namespace webkit { |
| 30 namespace ppapi { | 30 namespace ppapi { |
| 31 | 31 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 ObjectAccessorTryCatch(PP_Var object, PP_Var* exception) | 112 ObjectAccessorTryCatch(PP_Var object, PP_Var* exception) |
| 113 : TryCatch(exception), | 113 : TryCatch(exception), |
| 114 object_(NPObjectVar::FromPPVar(object)) { | 114 object_(NPObjectVar::FromPPVar(object)) { |
| 115 if (!object_.get()) { | 115 if (!object_.get()) { |
| 116 SetException(kInvalidObjectException); | 116 SetException(kInvalidObjectException); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 NPObjectVar* object() { return object_.get(); } | 120 NPObjectVar* object() { return object_.get(); } |
| 121 | 121 |
| 122 PluginInstance* GetPluginInstance() { | 122 PluginInstanceImpl* GetPluginInstance() { |
| 123 return HostGlobals::Get()->GetInstance(object()->pp_instance()); | 123 return HostGlobals::Get()->GetInstance(object()->pp_instance()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 protected: | 126 protected: |
| 127 scoped_refptr<NPObjectVar> object_; | 127 scoped_refptr<NPObjectVar> object_; |
| 128 | 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(ObjectAccessorTryCatch); | 129 DISALLOW_COPY_AND_ASSIGN(ObjectAccessorTryCatch); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 // ObjectAccessiorWithIdentifierTryCatch --------------------------------------- | 132 // ObjectAccessiorWithIdentifierTryCatch --------------------------------------- |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 325 } |
| 326 | 326 |
| 327 PP_Var CallDeprecated(PP_Var var, | 327 PP_Var CallDeprecated(PP_Var var, |
| 328 PP_Var method_name, | 328 PP_Var method_name, |
| 329 uint32_t argc, | 329 uint32_t argc, |
| 330 PP_Var* argv, | 330 PP_Var* argv, |
| 331 PP_Var* exception) { | 331 PP_Var* exception) { |
| 332 ObjectAccessorTryCatch accessor(var, exception); | 332 ObjectAccessorTryCatch accessor(var, exception); |
| 333 if (accessor.has_exception()) | 333 if (accessor.has_exception()) |
| 334 return PP_MakeUndefined(); | 334 return PP_MakeUndefined(); |
| 335 PluginInstance* plugin = accessor.GetPluginInstance(); | 335 PluginInstanceImpl* plugin = accessor.GetPluginInstance(); |
| 336 if (plugin && plugin->IsProcessingUserGesture()) { | 336 if (plugin && plugin->IsProcessingUserGesture()) { |
| 337 WebKit::WebScopedUserGesture user_gesture( | 337 WebKit::WebScopedUserGesture user_gesture( |
| 338 plugin->CurrentUserGestureToken()); | 338 plugin->CurrentUserGestureToken()); |
| 339 return InternalCallDeprecated(&accessor, method_name, argc, argv, | 339 return InternalCallDeprecated(&accessor, method_name, argc, argv, |
| 340 exception); | 340 exception); |
| 341 } | 341 } |
| 342 return InternalCallDeprecated(&accessor, method_name, argc, argv, exception); | 342 return InternalCallDeprecated(&accessor, method_name, argc, argv, exception); |
| 343 } | 343 } |
| 344 | 344 |
| 345 PP_Var Construct(PP_Var var, | 345 PP_Var Construct(PP_Var var, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 if (!object.get()) | 382 if (!object.get()) |
| 383 return false; // Not an object at all. | 383 return false; // Not an object at all. |
| 384 | 384 |
| 385 return PluginObject::IsInstanceOf(object->np_object(), | 385 return PluginObject::IsInstanceOf(object->np_object(), |
| 386 ppp_class, ppp_class_data); | 386 ppp_class, ppp_class_data); |
| 387 } | 387 } |
| 388 | 388 |
| 389 PP_Var CreateObjectDeprecated(PP_Instance pp_instance, | 389 PP_Var CreateObjectDeprecated(PP_Instance pp_instance, |
| 390 const PPP_Class_Deprecated* ppp_class, | 390 const PPP_Class_Deprecated* ppp_class, |
| 391 void* ppp_class_data) { | 391 void* ppp_class_data) { |
| 392 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); | 392 PluginInstanceImpl* instance = HostGlobals::Get()->GetInstance(pp_instance); |
| 393 if (!instance) { | 393 if (!instance) { |
| 394 DLOG(ERROR) << "Create object passed an invalid instance."; | 394 DLOG(ERROR) << "Create object passed an invalid instance."; |
| 395 return PP_MakeNull(); | 395 return PP_MakeNull(); |
| 396 } | 396 } |
| 397 return PluginObject::Create(instance, ppp_class, ppp_class_data); | 397 return PluginObject::Create(instance, ppp_class, ppp_class_data); |
| 398 } | 398 } |
| 399 | 399 |
| 400 PP_Var CreateObjectWithModuleDeprecated(PP_Module pp_module, | 400 PP_Var CreateObjectWithModuleDeprecated(PP_Module pp_module, |
| 401 const PPP_Class_Deprecated* ppp_class, | 401 const PPP_Class_Deprecated* ppp_class, |
| 402 void* ppp_class_data) { | 402 void* ppp_class_data) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 428 &CreateObjectDeprecated, | 428 &CreateObjectDeprecated, |
| 429 &CreateObjectWithModuleDeprecated, | 429 &CreateObjectWithModuleDeprecated, |
| 430 }; | 430 }; |
| 431 | 431 |
| 432 return &var_deprecated_interface; | 432 return &var_deprecated_interface; |
| 433 } | 433 } |
| 434 | 434 |
| 435 } // namespace ppapi | 435 } // namespace ppapi |
| 436 } // namespace webkit | 436 } // namespace webkit |
| 437 | 437 |
| OLD | NEW |