OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Pawel Hajdan (phajdan.jr@chromium.org) | 3 * Copyright (C) 2009 Pawel Hajdan (phajdan.jr@chromium.org) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 26 matching lines...) Expand all Loading... |
37 Subclasses should define the constructor to build the property and method | 37 Subclasses should define the constructor to build the property and method |
38 lists needed to bind this class to a JS object. They should also declare | 38 lists needed to bind this class to a JS object. They should also declare |
39 and define member variables and methods to be exposed to JS through | 39 and define member variables and methods to be exposed to JS through |
40 that object. | 40 that object. |
41 */ | 41 */ |
42 | 42 |
43 #ifndef CppBoundClass_h | 43 #ifndef CppBoundClass_h |
44 #define CppBoundClass_h | 44 #define CppBoundClass_h |
45 | 45 |
46 #include "CppVariant.h" | 46 #include "CppVariant.h" |
| 47 #include "public/platform/WebNonCopyable.h" |
47 #include <map> | 48 #include <map> |
48 #include <memory> | 49 #include <memory> |
49 #include <vector> | 50 #include <vector> |
50 | 51 |
51 namespace WebKit { | 52 namespace WebKit { |
52 class WebFrame; | 53 class WebFrame; |
53 class WebString; | 54 class WebString; |
54 } | 55 } |
55 | 56 |
56 namespace WebTestRunner { | 57 namespace WebTestRunner { |
57 | 58 |
58 typedef std::vector<CppVariant> CppArgumentList; | 59 typedef std::vector<CppVariant> CppArgumentList; |
59 | 60 |
60 // CppBoundClass lets you map Javascript method calls and property accesses | 61 // CppBoundClass lets you map Javascript method calls and property accesses |
61 // directly to C++ method calls and CppVariant* variable access. | 62 // directly to C++ method calls and CppVariant* variable access. |
62 class CppBoundClass { | 63 class CppBoundClass : public WebKit::WebNonCopyable { |
63 public: | 64 public: |
64 class PropertyCallback { | 65 class PropertyCallback { |
65 public: | 66 public: |
66 virtual ~PropertyCallback() { } | 67 virtual ~PropertyCallback() { } |
67 | 68 |
68 // Sets |value| to the value of the property. Returns false in case of | 69 // Sets |value| to the value of the property. Returns false in case of |
69 // failure. |value| is always non-0. | 70 // failure. |value| is always non-0. |
70 virtual bool getValue(CppVariant* result) = 0; | 71 virtual bool getValue(CppVariant* result) = 0; |
71 | 72 |
72 // sets the property value to |value|. Returns false in case of failure. | 73 // sets the property value to |value|. Returns false in case of failure. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 bool getProperty(NPIdentifier, NPVariant* result) const; | 232 bool getProperty(NPIdentifier, NPVariant* result) const; |
232 bool setProperty(NPIdentifier, const NPVariant*); | 233 bool setProperty(NPIdentifier, const NPVariant*); |
233 | 234 |
234 // A lazily-initialized CppVariant representing this class. We retain 1 | 235 // A lazily-initialized CppVariant representing this class. We retain 1 |
235 // reference to this object, and it is released on deletion. | 236 // reference to this object, and it is released on deletion. |
236 CppVariant m_selfVariant; | 237 CppVariant m_selfVariant; |
237 | 238 |
238 // True if our np_object has been bound to a WebFrame, in which case it must | 239 // True if our np_object has been bound to a WebFrame, in which case it must |
239 // be unregistered with V8 when we delete it. | 240 // be unregistered with V8 when we delete it. |
240 bool m_boundToFrame; | 241 bool m_boundToFrame; |
241 | |
242 private: | |
243 CppBoundClass(CppBoundClass&); | |
244 CppBoundClass& operator=(const CppBoundClass&); | |
245 }; | 242 }; |
246 | 243 |
247 } | 244 } |
248 | 245 |
249 #endif // CppBoundClass_h | 246 #endif // CppBoundClass_h |
OLD | NEW |