| 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 27 matching lines...) Expand all Loading... |
| 38 // - CppBoundClass has then overridden invoke() to look up the function | 38 // - CppBoundClass has then overridden invoke() to look up the function |
| 39 // name in its internal map of methods, and then calls the appropriate | 39 // name in its internal map of methods, and then calls the appropriate |
| 40 // method. | 40 // method. |
| 41 | 41 |
| 42 #include "CppBoundClass.h" | 42 #include "CppBoundClass.h" |
| 43 | 43 |
| 44 #include "TestCommon.h" | 44 #include "TestCommon.h" |
| 45 #include "public/platform/WebString.h" | 45 #include "public/platform/WebString.h" |
| 46 #include "public/web/WebBindings.h" | 46 #include "public/web/WebBindings.h" |
| 47 #include "public/web/WebFrame.h" | 47 #include "public/web/WebFrame.h" |
| 48 #include <memory> | |
| 49 | 48 |
| 50 using namespace blink; | 49 using namespace blink; |
| 51 using namespace std; | 50 using namespace std; |
| 52 | 51 |
| 53 namespace WebTestRunner { | 52 namespace WebTestRunner { |
| 54 | 53 |
| 55 namespace { | 54 namespace { |
| 56 | 55 |
| 57 class CppVariantPropertyCallback : public CppBoundClass::PropertyCallback { | 56 class CppVariantPropertyCallback : public CppBoundClass::PropertyCallback { |
| 58 public: | 57 public: |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 void CppBoundClass::bindToJavascript(WebFrame* frame, const WebString& classname
) | 349 void CppBoundClass::bindToJavascript(WebFrame* frame, const WebString& classname
) |
| 351 { | 350 { |
| 352 // BindToWindowObject will take its own reference to the NPObject, and clean | 351 // BindToWindowObject will take its own reference to the NPObject, and clean |
| 353 // up after itself. It will also (indirectly) register the object with V8, | 352 // up after itself. It will also (indirectly) register the object with V8, |
| 354 // so we must remember this so we can unregister it when we're destroyed. | 353 // so we must remember this so we can unregister it when we're destroyed. |
| 355 frame->bindToWindowObject(classname, NPVARIANT_TO_OBJECT(*getAsCppVariant())
, 0); | 354 frame->bindToWindowObject(classname, NPVARIANT_TO_OBJECT(*getAsCppVariant())
, 0); |
| 356 m_boundToFrame = true; | 355 m_boundToFrame = true; |
| 357 } | 356 } |
| 358 | 357 |
| 359 } | 358 } |
| OLD | NEW |