2018-09-10 02:41:13 +02:00
|
|
|
// Copyright © 2014 The CefSharp Authors. All rights reserved.
|
2014-05-08 20:12:57 +02:00
|
|
|
//
|
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
2018-09-10 02:41:13 +02:00
|
|
|
|
2014-05-08 22:21:06 +02:00
|
|
|
#pragma once
|
2014-05-08 20:12:57 +02:00
|
|
|
|
|
|
|
|
#include "Stdafx.h"
|
2014-08-28 15:27:06 +10:00
|
|
|
#include "include/cef_v8.h"
|
|
|
|
|
|
2014-05-08 22:21:06 +02:00
|
|
|
#include "JavascriptMethodHandler.h"
|
2014-05-08 20:12:57 +02:00
|
|
|
|
2014-06-12 04:58:41 +03:00
|
|
|
using namespace System::Runtime::Serialization;
|
2020-07-18 13:30:54 +10:00
|
|
|
using namespace CefSharp::Internals::Wcf;
|
2014-05-08 20:12:57 +02:00
|
|
|
|
|
|
|
|
namespace CefSharp
|
|
|
|
|
{
|
2021-02-27 12:11:35 +10:00
|
|
|
namespace BrowserSubprocess
|
2014-05-08 20:12:57 +02:00
|
|
|
{
|
2021-02-27 12:11:35 +10:00
|
|
|
private ref class JavascriptMethodWrapper
|
2014-05-08 20:12:57 +02:00
|
|
|
{
|
2021-02-27 12:11:35 +10:00
|
|
|
private:
|
|
|
|
|
MCefRefPtr<JavascriptMethodHandler> _javascriptMethodHandler;
|
2023-07-16 06:32:58 +10:00
|
|
|
int64_t _ownerId;
|
2021-02-27 12:11:35 +10:00
|
|
|
String^ _javascriptMethodName;
|
|
|
|
|
IBrowserProcess^ _browserProcess;
|
|
|
|
|
|
|
|
|
|
public:
|
2023-07-16 06:32:58 +10:00
|
|
|
JavascriptMethodWrapper(int64_t ownerId, IBrowserProcess^ browserProcess, JavascriptCallbackRegistry^ callbackRegistry)
|
2021-02-27 12:11:35 +10:00
|
|
|
{
|
|
|
|
|
_ownerId = ownerId;
|
|
|
|
|
_browserProcess = browserProcess;
|
|
|
|
|
_javascriptMethodHandler = new JavascriptMethodHandler(gcnew Func<array<Object^>^, BrowserProcessResponse^>(this, &JavascriptMethodWrapper::Execute), callbackRegistry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
!JavascriptMethodWrapper()
|
|
|
|
|
{
|
|
|
|
|
_javascriptMethodHandler = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~JavascriptMethodWrapper()
|
|
|
|
|
{
|
|
|
|
|
this->!JavascriptMethodWrapper();
|
|
|
|
|
|
|
|
|
|
_browserProcess = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Bind(JavascriptMethod^ javascriptMethod, const CefRefPtr<CefV8Value>& v8Value);
|
|
|
|
|
BrowserProcessResponse^ Execute(array<Object^>^ parameters);
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-07-18 13:30:54 +10:00
|
|
|
}
|