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" |
11 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 11 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
12 #include "content/renderer/pepper/pepper_try_catch.h" | 12 #include "content/renderer/pepper/pepper_try_catch.h" |
13 #include "content/renderer/pepper/plugin_module.h" | 13 #include "content/renderer/pepper/plugin_module.h" |
14 #include "content/renderer/pepper/plugin_object.h" | 14 #include "content/renderer/pepper/plugin_object.h" |
15 #include "content/renderer/pepper/v8object_var.h" | 15 #include "content/renderer/pepper/v8object_var.h" |
16 #include "ppapi/c/dev/ppb_var_deprecated.h" | 16 #include "ppapi/c/dev/ppb_var_deprecated.h" |
17 #include "ppapi/c/ppb_var.h" | 17 #include "ppapi/c/ppb_var.h" |
18 #include "ppapi/shared_impl/ppb_var_shared.h" | 18 #include "ppapi/shared_impl/ppb_var_shared.h" |
19 #include "third_party/WebKit/public/web/WebDocument.h" | 19 #include "third_party/WebKit/public/web/WebDocument.h" |
20 #include "third_party/WebKit/public/web/WebElement.h" | 20 #include "third_party/WebKit/public/web/WebElement.h" |
21 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 21 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
22 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 22 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 23 #include "third_party/WebKit/public/web/WebPluginScriptForbiddenScope.h" |
23 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 24 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
24 | 25 |
25 using ppapi::V8ObjectVar; | 26 using ppapi::V8ObjectVar; |
26 using ppapi::PpapiGlobals; | 27 using ppapi::PpapiGlobals; |
27 using ppapi::ScopedPPVar; | 28 using ppapi::ScopedPPVar; |
28 using ppapi::ScopedPPVarArray; | 29 using ppapi::ScopedPPVarArray; |
29 using ppapi::StringVar; | 30 using ppapi::StringVar; |
30 using ppapi::Var; | 31 using ppapi::Var; |
31 | 32 |
32 namespace content { | 33 namespace content { |
(...skipping 16 matching lines...) Expand all Loading... |
49 } | 50 } |
50 | 51 |
51 // Check if the object is valid. If it isn't, set an exception and return | 52 // Check if the object is valid. If it isn't, set an exception and return |
52 // false. | 53 // false. |
53 bool IsValid(PP_Var* exception) { | 54 bool IsValid(PP_Var* exception) { |
54 // If we already have an exception, then the call is invalid according to | 55 // If we already have an exception, then the call is invalid according to |
55 // the unittests. | 56 // the unittests. |
56 if (exception && exception->type != PP_VARTYPE_UNDEFINED) | 57 if (exception && exception->type != PP_VARTYPE_UNDEFINED) |
57 return false; | 58 return false; |
58 if (instance_) | 59 if (instance_) |
59 return true; | 60 return !instance_->is_deleted() || |
| 61 !blink::WebPluginScriptForbiddenScope::isForbidden(); |
60 if (exception) | 62 if (exception) |
61 *exception = ppapi::StringVar::StringToPPVar(kInvalidObjectException); | 63 *exception = ppapi::StringVar::StringToPPVar(kInvalidObjectException); |
62 return false; | 64 return false; |
63 } | 65 } |
64 // Lazily grab the object so that the handle is created in the current handle | 66 // Lazily grab the object so that the handle is created in the current handle |
65 // scope. | 67 // scope. |
66 v8::Local<v8::Object> GetObject() { return object_var_->GetHandle(); } | 68 v8::Local<v8::Object> GetObject() { return object_var_->GetHandle(); } |
67 PepperPluginInstanceImpl* instance() { return instance_; } | 69 PepperPluginInstanceImpl* instance() { return instance_; } |
68 V8VarConverter* converter() { return converter_.get(); } | 70 V8VarConverter* converter() { return converter_.get(); } |
69 | 71 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 &CallDeprecated, | 361 &CallDeprecated, |
360 &Construct, | 362 &Construct, |
361 &IsInstanceOfDeprecated, | 363 &IsInstanceOfDeprecated, |
362 &CreateObjectDeprecated, | 364 &CreateObjectDeprecated, |
363 &CreateObjectWithModuleDeprecated, }; | 365 &CreateObjectWithModuleDeprecated, }; |
364 | 366 |
365 return &var_deprecated_interface; | 367 return &var_deprecated_interface; |
366 } | 368 } |
367 | 369 |
368 } // namespace content | 370 } // namespace content |
OLD | NEW |