// Copyright © 2010-2014 The CefSharp Project. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. #pragma once #include "Stdafx.h" #include "include/cef_v8.h" #include "JavascriptMethodHandler.h" using namespace CefSharp::Internals; using namespace System::Runtime::Serialization; namespace CefSharp { public ref class JavascriptMethodWrapper { private: MCefRefPtr _javascriptMethodHandler; JavascriptMethod^ _javascriptMethod; int64 _ownerId; Func^ _createBrowserProxyDelegate; internal: MCefRefPtr V8Value; public: JavascriptMethodWrapper(JavascriptMethod^ javascriptMethod, int64 ownerId, Func^ createBrowserProxyDelegate) { _javascriptMethod = javascriptMethod; _ownerId = ownerId; _createBrowserProxyDelegate = createBrowserProxyDelegate; _javascriptMethodHandler = new JavascriptMethodHandler(gcnew Func^, BrowserProcessResponse^>(this, &JavascriptMethodWrapper::Execute)); } ~JavascriptMethodWrapper() { V8Value = nullptr; _javascriptMethodHandler = nullptr; } void Bind(); BrowserProcessResponse^ Execute(array^ parameters); }; }