| 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 /* | 5 /* |
| 6 CppBindingExample class: | 6 CppBindingExample class: |
| 7 This provides an example of how to use the CppBoundClass to create methods | 7 This provides an example of how to use the CppBoundClass to create methods |
| 8 and properties that can be exposed to JavaScript by an appropriately built | 8 and properties that can be exposed to JavaScript by an appropriately built |
| 9 embedding client. It is also used by the CppBoundClass unit test. | 9 embedding client. It is also used by the CppBoundClass unit test. |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 example.my_other_value = 2.1; | 27 example.my_other_value = 2.1; |
| 28 document.writeln(example.plus(example.my_value, example.my_other_value)); | 28 document.writeln(example.plus(example.my_value, example.my_other_value)); |
| 29 } | 29 } |
| 30 </script> | 30 </script> |
| 31 */ | 31 */ |
| 32 | 32 |
| 33 #ifndef CPP_BINDING_EXAMPLE_H__ | 33 #ifndef CPP_BINDING_EXAMPLE_H__ |
| 34 #define CPP_BINDING_EXAMPLE_H__ | 34 #define CPP_BINDING_EXAMPLE_H__ |
| 35 | 35 |
| 36 #include "webkit/glue/cpp_bound_class.h" | 36 #include "webkit/glue/cpp_bound_class.h" |
| 37 #include "webkit/glue/webkit_glue_export.h" | |
| 38 | 37 |
| 39 namespace webkit_glue { | 38 namespace webkit_glue { |
| 40 | 39 |
| 41 class CppBindingExample : public CppBoundClass { | 40 class CppBindingExample : public CppBoundClass { |
| 42 public: | 41 public: |
| 43 // The default constructor initializes the property and method lists needed | 42 // The default constructor initializes the property and method lists needed |
| 44 // to bind this class to a JS object. | 43 // to bind this class to a JS object. |
| 45 WEBKIT_GLUE_EXPORT CppBindingExample(); | 44 CppBindingExample(); |
| 46 | 45 |
| 47 // | 46 // |
| 48 // These public member variables and methods implement the methods and | 47 // These public member variables and methods implement the methods and |
| 49 // properties that will be exposed to JavaScript. If needed, the class could | 48 // properties that will be exposed to JavaScript. If needed, the class could |
| 50 // also contain other methods or variables, which will be hidden from JS | 49 // also contain other methods or variables, which will be hidden from JS |
| 51 // as long as they're not mapped in the property and method lists created in | 50 // as long as they're not mapped in the property and method lists created in |
| 52 // the constructor. | 51 // the constructor. |
| 53 // | 52 // |
| 54 // The signatures of any methods to be bound must match | 53 // The signatures of any methods to be bound must match |
| 55 // CppBoundClass::Callback. | 54 // CppBoundClass::Callback. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 void fallbackMethod(const CppArgumentList& args, CppVariant* result); | 73 void fallbackMethod(const CppArgumentList& args, CppVariant* result); |
| 75 | 74 |
| 76 // These properties will also be exposed to JavaScript. | 75 // These properties will also be exposed to JavaScript. |
| 77 CppVariant my_value; | 76 CppVariant my_value; |
| 78 CppVariant my_other_value; | 77 CppVariant my_other_value; |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 } // namespace webkit_glue | 80 } // namespace webkit_glue |
| 82 | 81 |
| 83 #endif // CPP_BINDING_EXAMPLE_H__ | 82 #endif // CPP_BINDING_EXAMPLE_H__ |
| OLD | NEW |