| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 /* | 5 // This file contains the declaration for CppVariant, a type used by C++ classes |
| 6 This file contains the declaration for CppVariant, a type used by C++ classes | 6 // that are to be bound to JavaScript objects. |
| 7 that are to be bound to JavaScript objects. | 7 // |
| 8 | 8 // CppVariant exists primarily as an interface between C++ callers and the |
| 9 CppVariant exists primarily as an interface between C++ callers and the | 9 // corresponding NPVariant type. CppVariant also provides a number of |
| 10 corresponding NPVariant type. CppVariant also provides a number of | 10 // convenience constructors and accessors, so that the NPVariantType values |
| 11 convenience constructors and accessors, so that the NPVariantType values | 11 // don't need to be exposed, and a destructor to free any memory allocated for |
| 12 don't need to be exposed, and a destructor to free any memory allocated for | 12 // string values. |
| 13 string values. | 13 // |
| 14 | 14 // For a usage example, see cpp_binding_example.{h|cc}. |
| 15 For a usage example, see cpp_binding_example.{h|cc}. | |
| 16 */ | |
| 17 | 15 |
| 18 #ifndef WEBKIT_GLUE_CPP_VARIANT_H__ | 16 #ifndef WEBKIT_GLUE_CPP_VARIANT_H__ |
| 19 #define WEBKIT_GLUE_CPP_VARIANT_H__ | 17 #define WEBKIT_GLUE_CPP_VARIANT_H__ |
| 20 | 18 |
| 21 #include <string> | 19 #include <string> |
| 22 #include <vector> | 20 #include <vector> |
| 23 | 21 |
| 24 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
| 25 #include "third_party/npapi/bindings/npruntime.h" | 23 #include "third_party/npapi/bindings/npruntime.h" |
| 26 | 24 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Returns a vector of strings for the specified argument. This is useful | 95 // Returns a vector of strings for the specified argument. This is useful |
| 98 // for converting a JavaScript array of strings into a vector of strings. | 96 // for converting a JavaScript array of strings into a vector of strings. |
| 99 std::vector<std::wstring> ToStringVector() const; | 97 std::vector<std::wstring> ToStringVector() const; |
| 100 | 98 |
| 101 // Invoke method of the given name on an object with the supplied arguments. | 99 // Invoke method of the given name on an object with the supplied arguments. |
| 102 // The first argument should be the object on which the method is to be | 100 // The first argument should be the object on which the method is to be |
| 103 // invoked. Returns whether the method was successfully invoked. If the | 101 // invoked. Returns whether the method was successfully invoked. If the |
| 104 // method was invoked successfully, any return value is stored in the | 102 // method was invoked successfully, any return value is stored in the |
| 105 // CppVariant specified by result. | 103 // CppVariant specified by result. |
| 106 bool Invoke(const std::string& method, const CppVariant* args, | 104 bool Invoke(const std::string& method, const CppVariant* args, |
| 107 uint32 arg_count, CppVariant& result) const; | 105 uint32 arg_count, CppVariant* result) const; |
| 106 |
| 107 // Retrieves the value of a property. Returns whether the property was |
| 108 // found and could be retrieved. If the method was invoked successfully, |
| 109 // the value is stored in the CppVariant specified by result. |
| 110 bool GetProperty(const std::string& property, CppVariant* result) const; |
| 108 }; | 111 }; |
| 109 | 112 |
| 110 #endif // WEBKIT_GLUE_CPP_VARIANT_H__ | 113 #endif // WEBKIT_GLUE_CPP_VARIANT_H__ |
| OLD | NEW |