OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * Copyright (C) 2010 Google Inc. All rights reserved. | 6 * Copyright (C) 2010 Google Inc. All rights reserved. |
7 * Copyright (C) 2009 Pawel Hajdan (phajdan.jr@chromium.org) | 7 * Copyright (C) 2009 Pawel Hajdan (phajdan.jr@chromium.org) |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions are | 10 * modification, are permitted provided that the following conditions are |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 and define member variables and methods to be exposed to JS through | 43 and define member variables and methods to be exposed to JS through |
44 that object. | 44 that object. |
45 */ | 45 */ |
46 | 46 |
47 #ifndef CppBoundClass_h | 47 #ifndef CppBoundClass_h |
48 #define CppBoundClass_h | 48 #define CppBoundClass_h |
49 | 49 |
50 #include <map> | 50 #include <map> |
51 #include <vector> | 51 #include <vector> |
52 | 52 |
| 53 #include "base/basictypes.h" |
53 #include "base/memory/scoped_ptr.h" | 54 #include "base/memory/scoped_ptr.h" |
54 #include "content/shell/renderer/test_runner/CppVariant.h" | 55 #include "content/shell/renderer/test_runner/CppVariant.h" |
55 #include "third_party/WebKit/public/platform/WebNonCopyable.h" | |
56 | 56 |
57 namespace blink { | 57 namespace blink { |
58 class WebFrame; | 58 class WebFrame; |
59 class WebString; | 59 class WebString; |
60 } | 60 } |
61 | 61 |
62 namespace WebTestRunner { | 62 namespace WebTestRunner { |
63 | 63 |
64 typedef std::vector<CppVariant> CppArgumentList; | 64 typedef std::vector<CppVariant> CppArgumentList; |
65 | 65 |
66 // CppBoundClass lets you map Javascript method calls and property accesses | 66 // CppBoundClass lets you map Javascript method calls and property accesses |
67 // directly to C++ method calls and CppVariant* variable access. | 67 // directly to C++ method calls and CppVariant* variable access. |
68 class CppBoundClass : public blink::WebNonCopyable { | 68 class CppBoundClass { |
69 public: | 69 public: |
70 class PropertyCallback { | 70 class PropertyCallback { |
71 public: | 71 public: |
72 virtual ~PropertyCallback() { } | 72 virtual ~PropertyCallback() { } |
73 | 73 |
74 // Sets |value| to the value of the property. Returns false in case of | 74 // Sets |value| to the value of the property. Returns false in case of |
75 // failure. |value| is always non-0. | 75 // failure. |value| is always non-0. |
76 virtual bool getValue(CppVariant* result) = 0; | 76 virtual bool getValue(CppVariant* result) = 0; |
77 | 77 |
78 // sets the property value to |value|. Returns false in case of failure. | 78 // 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... |
237 bool getProperty(NPIdentifier, NPVariant* result) const; | 237 bool getProperty(NPIdentifier, NPVariant* result) const; |
238 bool setProperty(NPIdentifier, const NPVariant*); | 238 bool setProperty(NPIdentifier, const NPVariant*); |
239 | 239 |
240 // A lazily-initialized CppVariant representing this class. We retain 1 | 240 // A lazily-initialized CppVariant representing this class. We retain 1 |
241 // reference to this object, and it is released on deletion. | 241 // reference to this object, and it is released on deletion. |
242 CppVariant m_selfVariant; | 242 CppVariant m_selfVariant; |
243 | 243 |
244 // True if our np_object has been bound to a WebFrame, in which case it must | 244 // True if our np_object has been bound to a WebFrame, in which case it must |
245 // be unregistered with V8 when we delete it. | 245 // be unregistered with V8 when we delete it. |
246 bool m_boundToFrame; | 246 bool m_boundToFrame; |
| 247 |
| 248 DISALLOW_COPY_AND_ASSIGN(CppBoundClass); |
247 }; | 249 }; |
248 | 250 |
249 } | 251 } |
250 | 252 |
251 #endif // CppBoundClass_h | 253 #endif // CppBoundClass_h |
OLD | NEW |