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_CPP_PRIVATE_VAR_PRIVATE_H_ | 5 #ifndef PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ |
6 #define PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ | 6 #define PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ |
7 | 7 |
8 #include "ppapi/cpp/var.h" | 8 #include "ppapi/cpp/var.h" |
9 | 9 |
10 namespace pp { | 10 namespace pp { |
11 | 11 |
12 class InstancePrivate; | 12 class InstanceHandle; |
13 | 13 |
14 namespace deprecated { | 14 namespace deprecated { |
15 class ScriptableObject; | 15 class ScriptableObject; |
16 } | 16 } |
17 | 17 |
18 // VarPrivate is a version of Var that exposes the private scripting API. | 18 // VarPrivate is a version of Var that exposes the private scripting API. |
19 // It's designed to be mostly interchangable with Var since most callers will | 19 // It's designed to be mostly interchangable with Var since most callers will |
20 // be dealing with Vars from various places. | 20 // be dealing with Vars from various places. |
21 class VarPrivate : public Var { | 21 class VarPrivate : public Var { |
22 public: | 22 public: |
23 VarPrivate() : Var() {} | 23 VarPrivate() : Var() {} |
24 VarPrivate(Null) : Var(Null()) {} | 24 VarPrivate(Null) : Var(Null()) {} |
25 VarPrivate(bool b) : Var(b) {} | 25 VarPrivate(bool b) : Var(b) {} |
26 VarPrivate(int32_t i) : Var(i) {} | 26 VarPrivate(int32_t i) : Var(i) {} |
27 VarPrivate(double d) : Var(d) {} | 27 VarPrivate(double d) : Var(d) {} |
28 VarPrivate(const char* utf8_str) : Var(utf8_str) {} | 28 VarPrivate(const char* utf8_str) : Var(utf8_str) {} |
29 VarPrivate(const std::string& utf8_str) : Var(utf8_str) {} | 29 VarPrivate(const std::string& utf8_str) : Var(utf8_str) {} |
30 VarPrivate(PassRef, PP_Var var) : Var(PassRef(), var) {} | 30 VarPrivate(PassRef, PP_Var var) : Var(PassRef(), var) {} |
31 VarPrivate(DontManage, PP_Var var) : Var(DontManage(), var) {} | 31 VarPrivate(DontManage, PP_Var var) : Var(DontManage(), var) {} |
32 VarPrivate(InstancePrivate* instance, deprecated::ScriptableObject* object); | 32 VarPrivate(const InstanceHandle& instance, |
| 33 deprecated::ScriptableObject* object); |
33 VarPrivate(const Var& other) : Var(other) {} | 34 VarPrivate(const Var& other) : Var(other) {} |
34 | 35 |
35 virtual ~VarPrivate() {} | 36 virtual ~VarPrivate() {} |
36 | 37 |
37 // This assumes the object is of type object. If it's not, it will assert in | 38 // This assumes the object is of type object. If it's not, it will assert in |
38 // debug mode. If it is not an object or not a ScriptableObject type, returns | 39 // debug mode. If it is not an object or not a ScriptableObject type, returns |
39 // NULL. | 40 // NULL. |
40 deprecated::ScriptableObject* AsScriptableObject() const; | 41 deprecated::ScriptableObject* AsScriptableObject() const; |
41 | 42 |
42 bool HasProperty(const Var& name, Var* exception = NULL) const; | 43 bool HasProperty(const Var& name, Var* exception = NULL) const; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 private: | 115 private: |
115 // Prevent an arbitrary pointer argument from being implicitly converted to | 116 // Prevent an arbitrary pointer argument from being implicitly converted to |
116 // a bool at Var construction. If somebody makes such a mistake, (s)he will | 117 // a bool at Var construction. If somebody makes such a mistake, (s)he will |
117 // get a compilation error. | 118 // get a compilation error. |
118 VarPrivate(void* non_scriptable_object_pointer); | 119 VarPrivate(void* non_scriptable_object_pointer); |
119 }; | 120 }; |
120 | 121 |
121 } // namespace pp | 122 } // namespace pp |
122 | 123 |
123 #endif // PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ | 124 #endif // PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ |
OLD | NEW |