2015-06-25 16:56:38 -04:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2015-04-02 09:42:37 -04:00
|
|
|
|
|
|
|
|
#include "UnrealCEFSubProcess.h"
|
|
|
|
|
#include "UnrealCEFSubProcessApp.h"
|
|
|
|
|
|
|
|
|
|
#if WITH_CEF3
|
|
|
|
|
|
|
|
|
|
FUnrealCEFSubProcessApp::FUnrealCEFSubProcessApp()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-30 13:19:56 -04:00
|
|
|
void FUnrealCEFSubProcessApp::OnContextCreated( CefRefPtr<CefBrowser> Browser, CefRefPtr<CefFrame> Frame, CefRefPtr<CefV8Context> Context )
|
2015-04-02 09:42:37 -04:00
|
|
|
{
|
2015-06-25 16:56:38 -04:00
|
|
|
RemoteScripting.OnContextCreated(Browser, Frame, Context);
|
2015-04-02 09:42:37 -04:00
|
|
|
}
|
|
|
|
|
|
2015-06-30 13:19:56 -04:00
|
|
|
void FUnrealCEFSubProcessApp::OnContextReleased( CefRefPtr<CefBrowser> Browser, CefRefPtr<CefFrame> Frame, CefRefPtr<CefV8Context> Context )
|
2015-04-02 09:42:37 -04:00
|
|
|
{
|
2015-06-25 16:56:38 -04:00
|
|
|
RemoteScripting.OnContextReleased(Browser, Frame, Context);
|
2015-04-02 09:42:37 -04:00
|
|
|
}
|
|
|
|
|
|
2015-06-30 13:19:56 -04:00
|
|
|
bool FUnrealCEFSubProcessApp::OnProcessMessageReceived( CefRefPtr<CefBrowser> Browser, CefProcessId SourceProcess, CefRefPtr<CefProcessMessage> Message )
|
2015-04-02 09:42:37 -04:00
|
|
|
{
|
2015-06-25 16:56:38 -04:00
|
|
|
bool Result = false;
|
|
|
|
|
FString MessageName = Message->GetName().ToWString().c_str();
|
|
|
|
|
if (MessageName.StartsWith(TEXT("UE::")))
|
|
|
|
|
{
|
|
|
|
|
Result = RemoteScripting.OnProcessMessageReceived(Browser, SourceProcess, Message);
|
|
|
|
|
}
|
2015-06-30 13:19:56 -04:00
|
|
|
|
2015-06-25 16:56:38 -04:00
|
|
|
return Result;
|
2015-04-02 09:42:37 -04:00
|
|
|
}
|
|
|
|
|
|
2015-06-30 13:19:56 -04:00
|
|
|
void FUnrealCEFSubProcessApp::OnRenderThreadCreated( CefRefPtr<CefListValue> ExtraInfo )
|
2015-06-25 16:56:38 -04:00
|
|
|
{
|
|
|
|
|
for(size_t I=0; I<ExtraInfo->GetSize(); I++)
|
|
|
|
|
{
|
|
|
|
|
if (ExtraInfo->GetType(I) == VTYPE_DICTIONARY)
|
|
|
|
|
{
|
|
|
|
|
CefRefPtr<CefDictionaryValue> Info = ExtraInfo->GetDictionary(I);
|
|
|
|
|
if ( Info->GetType("browser") == VTYPE_INT)
|
|
|
|
|
{
|
|
|
|
|
int32 BrowserID = Info->GetInt("browser");
|
|
|
|
|
CefRefPtr<CefDictionaryValue> Bindings = Info->GetDictionary("bindings");
|
|
|
|
|
RemoteScripting.InitPermanentBindings(BrowserID, Bindings);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-02 09:42:37 -04:00
|
|
|
#endif
|