| 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 "content/renderer/pepper/ppb_var_deprecated_impl.h" | 5 #include "content/renderer/pepper/ppb_var_deprecated_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 // Lazily grab the object so that the handle is created in the current handle | 69 // Lazily grab the object so that the handle is created in the current handle |
| 70 // scope. | 70 // scope. |
| 71 v8::Local<v8::Object> GetObject() { return object_var_->GetHandle(); } | 71 v8::Local<v8::Object> GetObject() { return object_var_->GetHandle(); } |
| 72 PepperPluginInstanceImpl* instance() { return instance_; } | 72 PepperPluginInstanceImpl* instance() { return instance_; } |
| 73 V8VarConverter* converter() { return converter_.get(); } | 73 V8VarConverter* converter() { return converter_.get(); } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 V8ObjectVar* object_var_; | 76 V8ObjectVar* object_var_; |
| 77 PepperPluginInstanceImpl* instance_; | 77 PepperPluginInstanceImpl* instance_; |
| 78 scoped_ptr<V8VarConverter> converter_; | 78 std::unique_ptr<V8VarConverter> converter_; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 bool IsValidIdentifer(PP_Var identifier, PP_Var* exception) { | 81 bool IsValidIdentifer(PP_Var identifier, PP_Var* exception) { |
| 82 if (identifier.type == PP_VARTYPE_INT32 || | 82 if (identifier.type == PP_VARTYPE_INT32 || |
| 83 identifier.type == PP_VARTYPE_STRING) { | 83 identifier.type == PP_VARTYPE_STRING) { |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 if (exception) | 86 if (exception) |
| 87 *exception = ppapi::StringVar::StringToPPVar(kInvalidIdentifierException); | 87 *exception = ppapi::StringVar::StringToPPVar(kInvalidIdentifierException); |
| 88 return false; | 88 return false; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 | 247 |
| 248 if (try_catch.HasException()) | 248 if (try_catch.HasException()) |
| 249 return PP_MakeUndefined(); | 249 return PP_MakeUndefined(); |
| 250 | 250 |
| 251 if (!function->IsFunction()) { | 251 if (!function->IsFunction()) { |
| 252 try_catch.SetException(kUnableToCallMethodException); | 252 try_catch.SetException(kUnableToCallMethodException); |
| 253 return PP_MakeUndefined(); | 253 return PP_MakeUndefined(); |
| 254 } | 254 } |
| 255 | 255 |
| 256 scoped_ptr<v8::Local<v8::Value>[] > converted_args( | 256 std::unique_ptr<v8::Local<v8::Value>[]> converted_args( |
| 257 new v8::Local<v8::Value>[argc]); | 257 new v8::Local<v8::Value>[argc]); |
| 258 for (uint32_t i = 0; i < argc; ++i) { | 258 for (uint32_t i = 0; i < argc; ++i) { |
| 259 converted_args[i] = try_catch.ToV8(argv[i]); | 259 converted_args[i] = try_catch.ToV8(argv[i]); |
| 260 if (try_catch.HasException()) | 260 if (try_catch.HasException()) |
| 261 return PP_MakeUndefined(); | 261 return PP_MakeUndefined(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 blink::WebPluginContainer* container = accessor.instance()->container(); | 264 blink::WebPluginContainer* container = accessor.instance()->container(); |
| 265 blink::WebLocalFrame* frame = NULL; | 265 blink::WebLocalFrame* frame = NULL; |
| 266 if (container) | 266 if (container) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 &CallDeprecated, | 364 &CallDeprecated, |
| 365 &Construct, | 365 &Construct, |
| 366 &IsInstanceOfDeprecated, | 366 &IsInstanceOfDeprecated, |
| 367 &CreateObjectDeprecated, | 367 &CreateObjectDeprecated, |
| 368 &CreateObjectWithModuleDeprecated, }; | 368 &CreateObjectWithModuleDeprecated, }; |
| 369 | 369 |
| 370 return &var_deprecated_interface; | 370 return &var_deprecated_interface; |
| 371 } | 371 } |
| 372 | 372 |
| 373 } // namespace content | 373 } // namespace content |
| OLD | NEW |