2018-09-10 02:41:13 +02:00
|
|
|
// Copyright © 2013 The CefSharp Authors. All rights reserved.
|
2014-03-09 13:49:35 +01:00
|
|
|
//
|
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
|
2014-08-27 11:36:45 +10:00
|
|
|
#pragma once
|
|
|
|
|
|
2014-03-09 13:49:35 +01:00
|
|
|
#include "include/cef_browser.h"
|
2014-04-08 19:00:48 +01:00
|
|
|
#include "include/cef_v8.h"
|
2014-03-09 13:49:35 +01:00
|
|
|
|
2014-04-08 19:41:13 +01:00
|
|
|
#include "TypeUtils.h"
|
2014-05-08 20:12:57 +02:00
|
|
|
#include "Stdafx.h"
|
2014-12-04 13:40:41 +10:00
|
|
|
#include "JavascriptRootObjectWrapper.h"
|
2014-04-08 19:41:13 +01:00
|
|
|
|
2021-02-27 12:11:35 +10:00
|
|
|
using namespace CefSharp::BrowserSubprocess::Async;
|
2020-07-18 13:30:54 +10:00
|
|
|
#ifndef NETCOREAPP
|
2014-04-08 19:00:48 +01:00
|
|
|
using namespace System::ServiceModel;
|
2020-07-18 13:30:54 +10:00
|
|
|
#endif
|
2014-03-09 13:49:35 +01:00
|
|
|
using namespace System::Threading;
|
2014-08-29 12:32:52 +10:00
|
|
|
using namespace System::Threading::Tasks;
|
2014-03-09 13:49:35 +01:00
|
|
|
|
|
|
|
|
namespace CefSharp
|
|
|
|
|
{
|
2021-02-27 12:11:35 +10:00
|
|
|
namespace BrowserSubprocess
|
2014-03-09 14:11:37 +01:00
|
|
|
{
|
2021-02-27 12:11:35 +10:00
|
|
|
// "Master class" for wrapping everything that the Cef Subprocess needs
|
|
|
|
|
// for ONE CefBrowser.
|
|
|
|
|
public ref class CefBrowserWrapper
|
2015-07-09 10:55:12 +10:00
|
|
|
{
|
2021-02-27 12:11:35 +10:00
|
|
|
private:
|
|
|
|
|
MCefRefPtr<CefBrowser> _cefBrowser;
|
2015-10-11 20:41:17 +10:00
|
|
|
|
2021-02-27 12:11:35 +10:00
|
|
|
internal:
|
|
|
|
|
//Frame Identifier is used as Key
|
|
|
|
|
property ConcurrentDictionary<int64, JavascriptRootObjectWrapper^>^ JavascriptRootObjectWrappers;
|
2018-09-10 02:41:13 +02:00
|
|
|
|
2021-02-27 12:11:35 +10:00
|
|
|
public:
|
|
|
|
|
CefBrowserWrapper(CefRefPtr<CefBrowser> cefBrowser)
|
|
|
|
|
{
|
2021-09-03 10:51:18 +10:00
|
|
|
_cefBrowser = cefBrowser.get();
|
2021-02-27 12:11:35 +10:00
|
|
|
BrowserId = cefBrowser->GetIdentifier();
|
|
|
|
|
IsPopup = cefBrowser->IsPopup();
|
2015-07-09 10:55:12 +10:00
|
|
|
|
2021-02-27 12:11:35 +10:00
|
|
|
JavascriptRootObjectWrappers = gcnew ConcurrentDictionary<int64, JavascriptRootObjectWrapper^>();
|
|
|
|
|
}
|
2015-07-31 12:22:02 +02:00
|
|
|
|
2021-02-27 12:11:35 +10:00
|
|
|
!CefBrowserWrapper()
|
2015-07-09 10:55:12 +10:00
|
|
|
{
|
2021-02-27 12:11:35 +10:00
|
|
|
_cefBrowser = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~CefBrowserWrapper()
|
|
|
|
|
{
|
|
|
|
|
this->!CefBrowserWrapper();
|
|
|
|
|
|
|
|
|
|
if (JavascriptRootObjectWrappers != nullptr)
|
2015-10-11 20:41:17 +10:00
|
|
|
{
|
2021-02-27 12:11:35 +10:00
|
|
|
for each (KeyValuePair<int64, JavascriptRootObjectWrapper^> entry in JavascriptRootObjectWrappers)
|
|
|
|
|
{
|
|
|
|
|
delete entry.Value;
|
|
|
|
|
}
|
2015-07-28 22:22:30 +10:00
|
|
|
|
2021-02-27 12:11:35 +10:00
|
|
|
JavascriptRootObjectWrappers = nullptr;
|
|
|
|
|
}
|
2015-07-09 10:55:12 +10:00
|
|
|
}
|
2014-09-12 11:12:25 +10:00
|
|
|
|
2021-02-27 12:11:35 +10:00
|
|
|
property int BrowserId;
|
|
|
|
|
property bool IsPopup;
|
2015-05-02 02:36:10 -04:00
|
|
|
|
2020-07-23 07:21:14 +02:00
|
|
|
#ifndef NETCOREAPP
|
2021-02-27 12:11:35 +10:00
|
|
|
// This allows us to create the WCF proxies back to our parent process.
|
|
|
|
|
property ChannelFactory<IBrowserProcess^>^ ChannelFactory;
|
|
|
|
|
// The WCF proxy to the parent process.
|
|
|
|
|
property IBrowserProcess^ BrowserProcess;
|
2020-07-18 13:30:54 +10:00
|
|
|
#endif
|
2021-02-27 12:11:35 +10:00
|
|
|
};
|
|
|
|
|
}
|
2014-03-09 13:49:35 +01:00
|
|
|
}
|