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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "content/renderer/pepper/host_globals.h" | 9 #include "content/renderer/pepper/host_globals.h" |
10 #include "content/renderer/pepper/message_channel.h" | 10 #include "content/renderer/pepper/message_channel.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 if (try_catch.HasException()) | 213 if (try_catch.HasException()) |
214 return PP_MakeUndefined(); | 214 return PP_MakeUndefined(); |
215 | 215 |
216 if (!v8_method_name->IsString()) { | 216 if (!v8_method_name->IsString()) { |
217 try_catch.SetException(kUnableToCallMethodException); | 217 try_catch.SetException(kUnableToCallMethodException); |
218 return PP_MakeUndefined(); | 218 return PP_MakeUndefined(); |
219 } | 219 } |
220 | 220 |
221 v8::Handle<v8::Object> function = accessor.GetObject(); | 221 v8::Handle<v8::Object> function = accessor.GetObject(); |
222 v8::Handle<v8::Object> recv = | 222 v8::Handle<v8::Object> recv = |
223 accessor.instance()->GetContext()->Global(); | 223 accessor.instance()->GetMainWorldContext()->Global(); |
224 if (v8_method_name.As<v8::String>()->Length() != 0) { | 224 if (v8_method_name.As<v8::String>()->Length() != 0) { |
225 function = function->Get(v8_method_name)->ToObject(); | 225 function = function->Get(v8_method_name)->ToObject(); |
226 recv = accessor.GetObject(); | 226 recv = accessor.GetObject(); |
227 } | 227 } |
228 | 228 |
229 if (try_catch.HasException()) | 229 if (try_catch.HasException()) |
230 return PP_MakeUndefined(); | 230 return PP_MakeUndefined(); |
231 | 231 |
232 if (!function->IsFunction()) { | 232 if (!function->IsFunction()) { |
233 try_catch.SetException(kUnableToCallMethodException); | 233 try_catch.SetException(kUnableToCallMethodException); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 283 } |
284 | 284 |
285 bool IsInstanceOfDeprecated(PP_Var var, | 285 bool IsInstanceOfDeprecated(PP_Var var, |
286 const PPP_Class_Deprecated* ppp_class, | 286 const PPP_Class_Deprecated* ppp_class, |
287 void** ppp_class_data) { | 287 void** ppp_class_data) { |
288 scoped_refptr<V8ObjectVar> object(V8ObjectVar::FromPPVar(var)); | 288 scoped_refptr<V8ObjectVar> object(V8ObjectVar::FromPPVar(var)); |
289 if (!object.get()) | 289 if (!object.get()) |
290 return false; // Not an object at all. | 290 return false; // Not an object at all. |
291 | 291 |
292 v8::HandleScope handle_scope(object->instance()->GetIsolate()); | 292 v8::HandleScope handle_scope(object->instance()->GetIsolate()); |
293 v8::Context::Scope context_scope(object->instance()->GetContext()); | 293 v8::Context::Scope context_scope(object->instance()->GetMainWorldContext()); |
294 PluginObject* plugin_object = PluginObject::FromV8Object( | 294 PluginObject* plugin_object = PluginObject::FromV8Object( |
295 object->instance()->GetIsolate(), object->GetHandle()); | 295 object->instance()->GetIsolate(), object->GetHandle()); |
296 if (plugin_object && plugin_object->ppp_class() == ppp_class) { | 296 if (plugin_object && plugin_object->ppp_class() == ppp_class) { |
297 if (ppp_class_data) | 297 if (ppp_class_data) |
298 *ppp_class_data = plugin_object->ppp_class_data(); | 298 *ppp_class_data = plugin_object->ppp_class_data(); |
299 return true; | 299 return true; |
300 } | 300 } |
301 | 301 |
302 return false; | 302 return false; |
303 } | 303 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 &CallDeprecated, | 342 &CallDeprecated, |
343 &Construct, | 343 &Construct, |
344 &IsInstanceOfDeprecated, | 344 &IsInstanceOfDeprecated, |
345 &CreateObjectDeprecated, | 345 &CreateObjectDeprecated, |
346 &CreateObjectWithModuleDeprecated, }; | 346 &CreateObjectWithModuleDeprecated, }; |
347 | 347 |
348 return &var_deprecated_interface; | 348 return &var_deprecated_interface; |
349 } | 349 } |
350 | 350 |
351 } // namespace content | 351 } // namespace content |
OLD | NEW |