mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-03 23:12:42 +00:00
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
// Copyright © 2010-2015 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.
|
|
|
|
#include "stdafx.h"
|
|
#include "JavascriptAsyncMethodHandler.h"
|
|
#include "../CefSharp.Core/Internals/Messaging/Messages.h"
|
|
#include "../CefSharp.Core/Internals/Serialization/Primitives.h"
|
|
#include "Serialization/V8Serialization.h"
|
|
#include "CefBrowserWrapper.h"
|
|
|
|
using namespace CefSharp::Internals::Messaging;
|
|
using namespace CefSharp::Internals::Serialization;
|
|
|
|
namespace CefSharp
|
|
{
|
|
namespace Internals
|
|
{
|
|
namespace Async
|
|
{
|
|
bool JavascriptAsyncMethodHandler::Execute(const CefString& name, CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval, CefString& exception)
|
|
{
|
|
auto request = CefProcessMessage::Create(kJavascriptMethodCallRequest);
|
|
auto argList = request->GetArgumentList();
|
|
auto params = CefListValue::Create();
|
|
for (auto i = 0; i < arguments.size(); i++)
|
|
{
|
|
SerializeV8Object(arguments[i], params, i, _callbackRegistry);
|
|
}
|
|
|
|
SetInt64(_objectId, argList, 0);
|
|
argList->SetString(1, StringUtils::ToNative(_method->JavascriptName));
|
|
argList->SetList(2, params);
|
|
|
|
_browser->SendProcessMessage(CefProcessId::PID_BROWSER, request);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|