diff --git a/Build.bat b/Build.bat
new file mode 100644
index 000000000..b1edbcf23
--- /dev/null
+++ b/Build.bat
@@ -0,0 +1,3 @@
+SET ThisScriptsDirectory=%~dp0
+SET PowerShellScriptPath=%ThisScriptsDirectory%Build.ps1
+PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%PowerShellScriptPath%""' -Verb RunAs}";
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 95dcba95d..0eefda7fa 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -18,7 +18,7 @@ Thanks for your interest in contributing to the project! Please follow these sim
`CefSharp` simply takes the building blocks provided by `Cef` and attempts to provide a usable '.Net' implementation.
The upstream [`CEF` forum](http://magpcss.org/ceforum/) is a valuable resource, if your issues seems fairly low level, then please conduct some research before posting.
-It maybe helpful to run the `cefclient` application and compare output with `CefSharp`. The `WinForms` and `WPF` versions use two different rendering modes, `WPF` uses Offscreen Rendering (`OSR`).
+It maybe helpful to run the `cefclient` application and compare output with `CefSharp`. The `WinForms` and `WPF` versions use two different rendering modes, `WPF` uses Offscreen Rendering (`OSR`). `OffScreen` also uses `OSR` mode.
- Download **Test App** from http://cefbuilds.com
- To compare with WPF run `cefclient --multi-threaded-message-loop --off-screen-rendering-enabled`
@@ -44,6 +44,7 @@ Your bug report should **always follow this template**:
- **What is the expected output? What do you see instead?**
- **What steps will reproduce the problem?**
+- **Are you using `WinForms`, `WPF` or `OffScreen`?**
- **What version of the product are you using? On what operating system? x86 or x64?**
- What version are you using? Nuget? CI Nuget? build from a branch? If so which branch?
- Win7, Win 8, etc?
@@ -84,4 +85,4 @@ Pull requests are **awesome**. If you're looking to raise a PR for something whi
- Max number of columns are 132, please format your code accordingly
- Please don't add #Regions to the code
- When adding new files, please prepend the standard license disclaimer (just copy and paste from another source file)
-- Do your best to follow these guidelines but don't be afraid to make mistakes when trying to apply them. We are all novices in the beginning.
\ No newline at end of file
+- Do your best to follow these guidelines but don't be afraid to make mistakes when trying to apply them. We are all novices in the beginning.
diff --git a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj
index d8142b3f9..e5c528b23 100644
--- a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj
+++ b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj
@@ -1,6 +1,6 @@
-
+
Debug
@@ -66,7 +66,7 @@
- 03744085
+ 4664bbc5
true
@@ -198,6 +198,6 @@
This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
\ No newline at end of file
diff --git a/CefSharp.BrowserSubprocess.Core/packages.config b/CefSharp.BrowserSubprocess.Core/packages.config
index faf0feb53..337c7a6c1 100644
--- a/CefSharp.BrowserSubprocess.Core/packages.config
+++ b/CefSharp.BrowserSubprocess.Core/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/CefSharp.Core/BrowserSettings.h b/CefSharp.Core/BrowserSettings.h
index dc9964d9c..9b9060e77 100644
--- a/CefSharp.Core/BrowserSettings.h
+++ b/CefSharp.Core/BrowserSettings.h
@@ -71,13 +71,15 @@ namespace CefSharp
public ref class BrowserSettings
{
+ private:
+ bool _isFinalized;
internal:
CefBrowserSettings* _browserSettings;
public:
- BrowserSettings() : _browserSettings(new CefBrowserSettings()) { }
- !BrowserSettings() { delete _browserSettings; }
- ~BrowserSettings() { delete _browserSettings; }
+ BrowserSettings() : _browserSettings(new CefBrowserSettings()), _isFinalized(false) { }
+ !BrowserSettings() { delete _browserSettings; _isFinalized = true; }
+ ~BrowserSettings() { if (!_isFinalized) this->!BrowserSettings(); }
// CefBrowserSettings is private causing whole field to be private
// exposing void* as a workaround
diff --git a/CefSharp.Core/Cef.h b/CefSharp.Core/Cef.h
index c8f2c6bda..d5ff05a07 100644
--- a/CefSharp.Core/Cef.h
+++ b/CefSharp.Core/Cef.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include "Internals/CefSharpApp.h"
#include "Internals/CookieVisitor.h"
@@ -168,6 +169,94 @@ namespace CefSharp
return success;
}
+ /// Add an entry to the cross-origin whitelist.
+ /// The origin allowed to be accessed by the target protocol/domain.
+ /// The target protocol allowed to access the source origin.
+ /// The optional target domain allowed to access the source origin.
+ /// If set to true would allow a blah.example.com if the
+ /// URL (like http://www.example.com) will be allowed access to
+ /// all resources hosted on the specified and .
+ /// If is non-empty and if false only
+ /// exact domain matches will be allowed. If contains a top-
+ /// level domain component (like "example.com") and is
+ /// true sub-domain matches will be allowed. If is empty and
+ /// "/> if true all domains and IP addresses will be
+ /// allowed.
+ //
+ /// This method cannot be used to bypass the restrictions on local or display
+ /// isolated schemes. See the comments on for more
+ /// information.
+ ///
+ /// This function may be called on any thread. Returns false if
+ /// is invalid or the whitelist cannot be accessed.
+ ///
+ static bool AddCrossOriginWhitelistEntry(
+ String^ sourceOrigin,
+ String^ targetProtocol,
+ String^ targetDomain,
+ bool allowTargetSubdomains)
+ {
+ return CefAddCrossOriginWhitelistEntry(
+ StringUtils::ToNative(sourceOrigin),
+ StringUtils::ToNative(targetProtocol),
+ StringUtils::ToNative(targetDomain),
+ allowTargetSubdomains);
+ }
+
+ /// Remove entry from cross-origin whitelist
+ /// The origin allowed to be accessed by the target protocol/domain.
+ /// The target protocol allowed to access the source origin.
+ /// The optional target domain allowed to access the source origin.
+ /// If set to true would allow a blah.example.com if the
+ /// is invalid or the whitelist cannot be accessed.
+ ///
+ static bool RemoveCrossOriginWhitelistEntry(String^ sourceOrigin,
+ String^ targetProtocol,
+ String^ targetDomain,
+ bool allowTargetSubdomains)
+
+ {
+ return CefRemoveCrossOriginWhitelistEntry(
+ StringUtils::ToNative(sourceOrigin),
+ StringUtils::ToNative(targetProtocol),
+ StringUtils::ToNative(targetDomain),
+ allowTargetSubdomains);
+ }
+
+ /// Remove all entries from the cross-origin access whitelist.
+ ///
+ /// Remove all entries from the cross-origin access whitelist. Returns false if
+ /// the whitelist cannot be accessed.
+ ///
+ static bool ClearCrossOriginWhitelist()
+ {
+ return CefClearCrossOriginWhitelist();
+ }
+
/// Visits all cookies using the provided Cookie Visitor. The returned cookies are sorted by longest path, then by earliest creation date.
/// A user-provided Cookie Visitor implementation.
/// Returns false if the CookieManager is not available; otherwise, true.
@@ -258,9 +347,9 @@ namespace CefSharp
/// characters (e.g. the ';' character is disallowed within the cookie value attribute) and will return false without setting
/// the cookie if such characters are found.
/// The cookie URL
+ /// The cookie domain.
/// The cookie name.
/// The cookie value.
- /// The cookie domain.
/// The DateTime when the cookie will be treated as expired.
/// false if the cookie cannot be set (e.g. if illegal charecters such as ';' are used); otherwise true.
static bool SetCookie(String^ url, String^ domain, String^ name, String^ value, DateTime expires)
@@ -348,5 +437,14 @@ namespace CefSharp
IsInitialized = false;
}
}
+
+ ///
+ /// Clear all registered scheme handler factories.
+ ///
+ /// Returns false on error.
+ static bool ClearSchemeHandlerFactories()
+ {
+ return CefClearSchemeHandlerFactories();
+ }
};
}
diff --git a/CefSharp.Core/CefSharp.Core.vcxproj b/CefSharp.Core/CefSharp.Core.vcxproj
index eb86525a6..6f10b405c 100644
--- a/CefSharp.Core/CefSharp.Core.vcxproj
+++ b/CefSharp.Core/CefSharp.Core.vcxproj
@@ -1,6 +1,6 @@
-
+
Debug
@@ -66,7 +66,7 @@
<_ProjectFileVersion>11.0.51106.1
- 6edfce21
+ 84bd8e6a
bin\$(Configuration)\
@@ -225,6 +225,7 @@
+
@@ -257,6 +258,7 @@
+
@@ -283,6 +285,6 @@
This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
\ No newline at end of file
diff --git a/CefSharp.Core/CefSharp.Core.vcxproj.filters b/CefSharp.Core/CefSharp.Core.vcxproj.filters
index 89770fcb7..65c5e8ad7 100644
--- a/CefSharp.Core/CefSharp.Core.vcxproj.filters
+++ b/CefSharp.Core/CefSharp.Core.vcxproj.filters
@@ -53,6 +53,9 @@
Source Files
+
+ Source Files
+
@@ -133,6 +136,9 @@
Header Files
+
+ Header Files
+
diff --git a/CefSharp.Core/Internals/CefDragDataWrapper.h b/CefSharp.Core/Internals/CefDragDataWrapper.h
index 4a4f6d402..b94730e4e 100644
--- a/CefSharp.Core/Internals/CefDragDataWrapper.h
+++ b/CefSharp.Core/Internals/CefDragDataWrapper.h
@@ -41,6 +41,24 @@ namespace CefSharp
virtual property bool IsFragment;
virtual property bool IsLink;
+ ///
+ // Create a new CefDragData object.
+ ///
+ /*--cef()--*/
+ static CefDragDataWrapper^ Create()
+ {
+ CefRefPtr cefDragData = CefDragData::Create();
+ return gcnew CefDragDataWrapper(cefDragData);
+ }
+
+ virtual property CefRefPtr* InternalDragData
+ {
+ CefRefPtr* get()
+ {
+ return new CefRefPtr(_wrappedDragData.get());
+ }
+ }
+
//TODO: Vector is a pointer, so can potentially be updated (items may be possibly removed)
virtual property IList^ FileNames
{
diff --git a/CefSharp.Core/Internals/CefSharpApp.h b/CefSharp.Core/Internals/CefSharpApp.h
index bd675a223..1237a1941 100644
--- a/CefSharp.Core/Internals/CefSharpApp.h
+++ b/CefSharp.Core/Internals/CefSharpApp.h
@@ -7,6 +7,7 @@
#include "include/cef_app.h"
#include "CefSettings.h"
#include "SchemeHandlerWrapper.h"
+#include "SchemeHandlerFactoryWrapper.h"
namespace CefSharp
{
@@ -56,7 +57,7 @@ namespace CefSharp
// when the process is shutting down.
// TOOD: Consider adding error handling here. But where do we report any errors that may have occurred?
- registrar->AddCustomScheme(StringUtils::ToNative(cefCustomScheme->SchemeName), cefCustomScheme->IsStandard, false, false);
+ registrar->AddCustomScheme(StringUtils::ToNative(cefCustomScheme->SchemeName), cefCustomScheme->IsStandard, cefCustomScheme->IsLocal, cefCustomScheme->IsDisplayIsolated);
}
};
diff --git a/CefSharp.Core/Internals/ClientAdapter.cpp b/CefSharp.Core/Internals/ClientAdapter.cpp
index 860ca3683..5c3df65cd 100644
--- a/CefSharp.Core/Internals/ClientAdapter.cpp
+++ b/CefSharp.Core/Internals/ClientAdapter.cpp
@@ -569,5 +569,32 @@ namespace CefSharp
return handler->OnDragEnter(_browserControl, dragDataWrapper, (CefSharp::DragOperationsMask)mask);
}
+
+ bool ClientAdapter::OnRequestGeolocationPermission(CefRefPtr browser, const CefString& requesting_url, int request_id, CefRefPtr callback)
+ {
+ IGeolocationHandler^ handler = _browserControl->GeolocationHandler;
+ if (handler == nullptr)
+ {
+ // Default deny, as CEF does.
+ return false;
+ }
+
+ if (handler->OnRequestGeolocationPermission(_browserControl, StringUtils::ToClr(requesting_url), request_id))
+ {
+ callback->Continue(true);
+ return true;
+ }
+
+ return false;
+ }
+
+ void ClientAdapter::OnCancelGeolocationPermission(CefRefPtr browser, const CefString& requesting_url, int request_id)
+ {
+ IGeolocationHandler^ handler = _browserControl->GeolocationHandler;
+ if (handler != nullptr)
+ {
+ handler->OnCancelGeolocationPermission(_browserControl, StringUtils::ToClr(requesting_url), request_id);
+ }
+ }
}
}
diff --git a/CefSharp.Core/Internals/ClientAdapter.h b/CefSharp.Core/Internals/ClientAdapter.h
index d4356a238..25d022180 100644
--- a/CefSharp.Core/Internals/ClientAdapter.h
+++ b/CefSharp.Core/Internals/ClientAdapter.h
@@ -15,8 +15,6 @@ using namespace System;
namespace CefSharp
{
- ref class ManagedCefBrowserAdapter;
-
namespace Internals
{
private class ClientAdapter : public CefClient,
@@ -29,7 +27,8 @@ namespace CefSharp
public CefKeyboardHandler,
public CefJSDialogHandler,
public CefDialogHandler,
- public CefDragHandler
+ public CefDragHandler,
+ public CefGeolocationHandler
{
private:
CriticalSection _syncRoot;
@@ -75,6 +74,7 @@ namespace CefSharp
virtual CefRefPtr GetJSDialogHandler() OVERRIDE{ return this; }
virtual CefRefPtr GetDialogHandler() OVERRIDE{ return this; }
virtual CefRefPtr GetDragHandler() OVERRIDE{ return this; }
+ virtual CefRefPtr GetGeolocationHandler() OVERRIDE{ return this; }
// CefLifeSpanHandler
virtual DECL bool OnBeforePopup(CefRefPtr browser, CefRefPtr frame,
@@ -136,6 +136,11 @@ namespace CefSharp
//CefDragHandler
virtual DECL bool OnDragEnter(CefRefPtr browser, CefRefPtr dragData, DragOperationsMask mask) OVERRIDE;
+ //CefGeolocationHandler
+ virtual DECL bool OnRequestGeolocationPermission(CefRefPtr browser, const CefString& requesting_url, int request_id,
+ CefRefPtr callback) OVERRIDE;
+ virtual DECL void OnCancelGeolocationPermission(CefRefPtr browser, const CefString& requesting_url, int request_id) OVERRIDE;
+
IMPLEMENT_REFCOUNTING(ClientAdapter);
};
}
diff --git a/CefSharp.Core/Internals/RenderClientAdapter.h b/CefSharp.Core/Internals/RenderClientAdapter.h
index 79ed98c4e..a031b8b97 100644
--- a/CefSharp.Core/Internals/RenderClientAdapter.h
+++ b/CefSharp.Core/Internals/RenderClientAdapter.h
@@ -39,12 +39,12 @@ namespace CefSharp
_renderWebBrowser = nullptr;
_webBrowserInternal = nullptr;
- DisposeBitmapInfo(_mainBitmapInfo);
+ ReleaseBitmapHandlers(_mainBitmapInfo);
delete _mainBitmapInfo;
_mainBitmapInfo = nullptr;
- DisposeBitmapInfo(_popupBitmapInfo);
+ ReleaseBitmapHandlers(_popupBitmapInfo);
delete _popupBitmapInfo;
_popupBitmapInfo = nullptr;
@@ -92,14 +92,54 @@ namespace CefSharp
lock l(bitmapInfo->BitmapLock);
- auto fileMappingHandle = (HANDLE)bitmapInfo->FileMappingHandle;
+ if(bitmapInfo->DirtyRectSupport)
+ {
+ //NOTE: According to https://bitbucket.org/chromiumembedded/branches-2171-cef3/commits/ce984ddff3268a50cf9967487327e1257015b98c
+ // There is only one rect now that's a union of all dirty regions. API Still passes in a vector
+
+ CefRect r = dirtyRects.front();
+ bitmapInfo->DirtyRect = CefDirtyRect(r.x, r.y, r.width, r.height);
+ }
+
auto backBufferHandle = (HANDLE)bitmapInfo->BackBufferHandle;
- SetBufferHelper(bitmapInfo, width, height, &fileMappingHandle,
- &backBufferHandle, buffer);
+ if (backBufferHandle == NULL || bitmapInfo->Width != width || bitmapInfo->Height != height)
+ {
+ int pixels = width * height;
+ int numberOfBytes = pixels * bitmapInfo->BytesPerPixel;
+ auto fileMappingHandle = (HANDLE)bitmapInfo->FileMappingHandle;
- bitmapInfo->FileMappingHandle = (IntPtr)fileMappingHandle;
- bitmapInfo->BackBufferHandle = (IntPtr)backBufferHandle;
+ //Clear the reference to Bitmap so a new one is created by InvokeRenderAsync
+ bitmapInfo->ClearBitmap();
+
+ //Release the current handles (if not null)
+ ReleaseBitmapHandlers(bitmapInfo);
+
+ // Create new fileMappingHandle
+ fileMappingHandle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, numberOfBytes, NULL);
+ if (fileMappingHandle == NULL)
+ {
+ // TODO: Consider doing something more sensible here, since the browser will be very badly broken if this
+ // TODO: method call fails.
+ return;
+ }
+
+ backBufferHandle = MapViewOfFile(fileMappingHandle, FILE_MAP_ALL_ACCESS, 0, 0, numberOfBytes);
+ if (backBufferHandle == NULL)
+ {
+ // TODO: Consider doing something more sensible here, since the browser will be very badly broken if this
+ // TODO: method call fails.
+ return;
+ }
+
+ bitmapInfo->FileMappingHandle = (IntPtr)fileMappingHandle;
+ bitmapInfo->BackBufferHandle = (IntPtr)backBufferHandle;
+ bitmapInfo->Width = width;
+ bitmapInfo->Height = height;
+ bitmapInfo->NumberOfBytes = numberOfBytes;
+ }
+
+ CopyMemory(backBufferHandle, (void*)buffer, bitmapInfo->NumberOfBytes);
_renderWebBrowser->InvokeRenderAsync(bitmapInfo);
};
@@ -111,67 +151,24 @@ namespace CefSharp
};
private:
- void SetBufferHelper(BitmapInfo^ bitmapInfo, int newWidth, int newHeight,
- HANDLE* fileMappingHandle, HANDLE* backBufferHandle, const void* buffer)
- {
- int pixels = newWidth * newHeight;
- int numberOfBytes = pixels * bitmapInfo->BytesPerPixel;
-
- if (*backBufferHandle == NULL ||
- bitmapInfo->Width != newWidth ||
- bitmapInfo->Height != newHeight)
- {
- //Clear the reference to Bitmap so a new one is created by InvokeRenderAsync
- bitmapInfo->ClearBitmap();
-
- //Release the current handles (if not null)
- ReleaseBitmapHandlers(backBufferHandle, fileMappingHandle);
-
- // Create new fileMappingHandle
- *fileMappingHandle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, numberOfBytes, NULL);
- if (*fileMappingHandle == NULL)
- {
- // TODO: Consider doing something more sensible here, since the browser will be very badly broken if this
- // TODO: method call fails.
- return;
- }
-
- *backBufferHandle = MapViewOfFile(*fileMappingHandle, FILE_MAP_ALL_ACCESS, 0, 0, numberOfBytes);
- if (*backBufferHandle == NULL)
- {
- // TODO: Consider doing something more sensible here, since the browser will be very badly broken if this
- // TODO: method call fails.
- return;
- }
- }
-
- bitmapInfo->Width = newWidth;
- bitmapInfo->Height = newHeight;
-
- CopyMemory(*backBufferHandle, (void*)buffer, numberOfBytes);
- };
-
- void ReleaseBitmapHandlers(HANDLE* backBufferHandle, HANDLE* fileMappingHandle)
- {
- if (*backBufferHandle != NULL)
- {
- UnmapViewOfFile(*backBufferHandle);
- *backBufferHandle = NULL;
- }
-
- if (*fileMappingHandle != NULL)
- {
- CloseHandle(*fileMappingHandle);
- *fileMappingHandle = NULL;
- }
- }
-
- void DisposeBitmapInfo(BitmapInfo^ bitmapInfo)
+ void ReleaseBitmapHandlers(BitmapInfo^ bitmapInfo)
{
auto backBufferHandle = (HANDLE)bitmapInfo->BackBufferHandle;
auto fileMappingHandle = (HANDLE)bitmapInfo->FileMappingHandle;
- ReleaseBitmapHandlers(&backBufferHandle, &fileMappingHandle);
+ if (backBufferHandle != NULL)
+ {
+ UnmapViewOfFile(backBufferHandle);
+ backBufferHandle = NULL;
+ bitmapInfo->BackBufferHandle = IntPtr::Zero;
+ }
+
+ if (fileMappingHandle != NULL)
+ {
+ CloseHandle(fileMappingHandle);
+ fileMappingHandle = NULL;
+ bitmapInfo->FileMappingHandle = IntPtr::Zero;
+ }
}
IMPLEMENT_REFCOUNTING(RenderClientAdapter)
diff --git a/CefSharp.Core/Internals/StreamAdapter.cpp b/CefSharp.Core/Internals/StreamAdapter.cpp
index 291d40e7e..9791afe1f 100644
--- a/CefSharp.Core/Internals/StreamAdapter.cpp
+++ b/CefSharp.Core/Internals/StreamAdapter.cpp
@@ -11,7 +11,7 @@ namespace CefSharp
{
StreamAdapter::~StreamAdapter()
{
- _stream->Close();
+ //Remove the reference to the stream, must be kept open as it might be reused for subsiquent requests (e.g. refresh).
_stream = nullptr;
}
diff --git a/CefSharp.Core/Internals/StreamAdapter.h b/CefSharp.Core/Internals/StreamAdapter.h
index 9d8d73454..5b1162ac9 100644
--- a/CefSharp.Core/Internals/StreamAdapter.h
+++ b/CefSharp.Core/Internals/StreamAdapter.h
@@ -20,7 +20,11 @@ namespace CefSharp
public:
virtual ~StreamAdapter();
- StreamAdapter(Stream^ stream) : _stream(stream) { }
+ StreamAdapter(Stream^ stream) : _stream(stream)
+ {
+ //Reset stream position
+ stream->Position = 0;
+ }
virtual size_t Read(void* ptr, size_t size, size_t n);
virtual int Seek(int64 offset, int whence);
diff --git a/CefSharp.Core/ManagedCefBrowserAdapter.h b/CefSharp.Core/ManagedCefBrowserAdapter.h
index 83ad0bf7b..60d124a77 100644
--- a/CefSharp.Core/ManagedCefBrowserAdapter.h
+++ b/CefSharp.Core/ManagedCefBrowserAdapter.h
@@ -9,6 +9,7 @@
#include "MouseButtonType.h"
#include "PaintElementType.h"
#include "Internals/ClientAdapter.h"
+#include "Internals/CefDragDataWrapper.h"
#include "Internals/RenderClientAdapter.h"
#include "Internals/MCefRefPtr.h"
#include "Internals/StringVisitor.h"
@@ -34,7 +35,9 @@ namespace CefSharp
Close(true);
_clientAdapter = nullptr;
- if (_browserProcessServiceHost != nullptr)
+
+ // Guard managed only member derefs by isDisposing:
+ if (isDisposing && _browserProcessServiceHost != nullptr)
{
_browserProcessServiceHost->Close();
_browserProcessServiceHost = nullptr;
@@ -669,5 +672,55 @@ namespace CefSharp
browser->GetHost()->AddWordToDictionary(wordNative);
}
}
+
+ CefMouseEvent GetCefMouseEvent(MouseEvent^ mouseEvent)
+ {
+ CefMouseEvent cefMouseEvent;
+ cefMouseEvent.x = mouseEvent->X;
+ cefMouseEvent.y = mouseEvent->Y;
+ cefMouseEvent.modifiers = (uint32)mouseEvent->Modifiers;
+ return cefMouseEvent;
+ }
+
+ void OnDragTargetDragEnter(CefDragDataWrapper^ dragData, MouseEvent^ mouseEvent, DragOperationsMask allowedOperations)
+ {
+ auto browser = _clientAdapter->GetCefBrowser();
+
+ if (browser != nullptr)
+ {
+ dragData->ResetFileContents(); // Recommended by documentation to reset before calling DragEnter
+ browser->GetHost()->DragTargetDragEnter(*dragData->InternalDragData, GetCefMouseEvent(mouseEvent), (CefBrowserHost::DragOperationsMask) allowedOperations);
+ }
+ }
+
+ void OnDragTargetDragOver(MouseEvent^ mouseEvent, DragOperationsMask allowedOperations)
+ {
+ auto browser = _clientAdapter->GetCefBrowser();
+
+ if (browser != nullptr)
+ {
+ browser->GetHost()->DragTargetDragOver(GetCefMouseEvent(mouseEvent), (CefBrowserHost::DragOperationsMask) allowedOperations);
+ }
+ }
+
+ void OnDragTargetDragLeave()
+ {
+ auto browser = _clientAdapter->GetCefBrowser();
+
+ if (browser != nullptr)
+ {
+ browser->GetHost()->DragTargetDragLeave();
+ }
+ }
+
+ void OnDragTargetDragDrop(MouseEvent^ mouseEvent)
+ {
+ auto browser = _clientAdapter->GetCefBrowser();
+
+ if (browser != nullptr)
+ {
+ browser->GetHost()->DragTargetDrop(GetCefMouseEvent(mouseEvent));
+ }
+ }
};
}
diff --git a/CefSharp.Core/SchemeHandlerFactoryWrapper.cpp b/CefSharp.Core/SchemeHandlerFactoryWrapper.cpp
new file mode 100644
index 000000000..33685451f
--- /dev/null
+++ b/CefSharp.Core/SchemeHandlerFactoryWrapper.cpp
@@ -0,0 +1,23 @@
+// Copyright © 2010-2014 The CefSharp Authors. 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 "SchemeHandlerFactoryWrapper.h"
+
+using namespace System::Runtime::InteropServices;
+using namespace System::IO;
+
+namespace CefSharp
+{
+ CefRefPtr SchemeHandlerFactoryWrapper::Create(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ const CefString& scheme_name,
+ CefRefPtr request)
+ {
+ ISchemeHandler^ handler = _factory->Create();
+ CefRefPtr wrapper = new SchemeHandlerWrapper(handler);
+ return static_cast>(wrapper);
+ }
+}
\ No newline at end of file
diff --git a/CefSharp.Core/SchemeHandlerFactoryWrapper.h b/CefSharp.Core/SchemeHandlerFactoryWrapper.h
new file mode 100644
index 000000000..90823f2e1
--- /dev/null
+++ b/CefSharp.Core/SchemeHandlerFactoryWrapper.h
@@ -0,0 +1,29 @@
+// Copyright © 2010-2014 The CefSharp Authors. 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_scheme.h"
+#include "Internals/AutoLock.h"
+
+using namespace System;
+using namespace System::IO;
+using namespace System::Collections::Specialized;
+
+namespace CefSharp
+{
+ class SchemeHandlerFactoryWrapper : public CefSchemeHandlerFactory
+ {
+ gcroot _factory;
+
+ public:
+ SchemeHandlerFactoryWrapper(ISchemeHandlerFactory^ factory)
+ : _factory(factory) {}
+
+ virtual CefRefPtr Create(CefRefPtr browser, CefRefPtr frame, const CefString& scheme_name, CefRefPtr request);
+
+ IMPLEMENT_REFCOUNTING(SchemeHandlerFactoryWrapper);
+ };
+}
\ No newline at end of file
diff --git a/CefSharp.Core/SchemeHandlerWrapper.cpp b/CefSharp.Core/SchemeHandlerWrapper.cpp
index 43619b1bd..7adab6a07 100644
--- a/CefSharp.Core/SchemeHandlerWrapper.cpp
+++ b/CefSharp.Core/SchemeHandlerWrapper.cpp
@@ -142,15 +142,4 @@ namespace CefSharp
}
return -1;
}
-
- CefRefPtr SchemeHandlerFactoryWrapper::Create(
- CefRefPtr browser,
- CefRefPtr frame,
- const CefString& scheme_name,
- CefRefPtr request)
- {
- ISchemeHandler^ handler = _factory->Create();
- CefRefPtr wrapper = new SchemeHandlerWrapper(handler);
- return static_cast>(wrapper);
- }
}
\ No newline at end of file
diff --git a/CefSharp.Core/SchemeHandlerWrapper.h b/CefSharp.Core/SchemeHandlerWrapper.h
index e84a48b4b..ac00b8545 100644
--- a/CefSharp.Core/SchemeHandlerWrapper.h
+++ b/CefSharp.Core/SchemeHandlerWrapper.h
@@ -49,17 +49,4 @@ namespace CefSharp
IMPLEMENT_REFCOUNTING(SchemeHandlerWrapper);
};
-
- class SchemeHandlerFactoryWrapper : public CefSchemeHandlerFactory
- {
- gcroot _factory;
-
- public:
- SchemeHandlerFactoryWrapper(ISchemeHandlerFactory^ factory)
- : _factory(factory) {}
-
- virtual CefRefPtr Create(CefRefPtr browser, CefRefPtr frame, const CefString& scheme_name, CefRefPtr request);
-
- IMPLEMENT_REFCOUNTING(SchemeHandlerFactoryWrapper);
- };
}
\ No newline at end of file
diff --git a/CefSharp.Core/packages.config b/CefSharp.Core/packages.config
index faf0feb53..337c7a6c1 100644
--- a/CefSharp.Core/packages.config
+++ b/CefSharp.Core/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/CefSharp.Example/CefExample.cs b/CefSharp.Example/CefExample.cs
index 26dd99280..103aecea1 100644
--- a/CefSharp.Example/CefExample.cs
+++ b/CefSharp.Example/CefExample.cs
@@ -15,12 +15,28 @@ namespace CefSharp.Example
public static void Init()
{
+ // Set Google API keys, used for Geolocation requests sans GPS. See http://www.chromium.org/developers/how-tos/api-keys
+ // Environment.SetEnvironmentVariable("GOOGLE_API_KEY", "");
+ // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_ID", "");
+ // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_SECRET", "");
+
+ //Chromium Command Line args
+ //http://peter.sh/experiments/chromium-command-line-switches/
+ //NOTE: Note all relevant in relation to `CefSharp`, use for reference purposes only.
+
var settings = new CefSettings();
settings.RemoteDebuggingPort = 8088;
//settings.CefCommandLineArgs.Add("renderer-process-limit", "1");
//settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog");
//settings.CefCommandLineArgs.Add("disable-gpu", "1");
//settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
+ //settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC
+ //settings.CefCommandLineArgs.Add("no-proxy-server", "1"); //Don't use a proxy server, always make direct connections. Overrides any other proxy server flags that are passed.
+
+ //Disables the DirectWrite font rendering system on windows.
+ //Possibly useful when experiencing blury fonts.
+ //settings.CefCommandLineArgs.Add("disable-direct-write", "1");
+
settings.LogSeverity = LogSeverity.Verbose;
if (DebuggingSubProcess)
diff --git a/CefSharp.Example/Resources/TooltipTest.html b/CefSharp.Example/Resources/TooltipTest.html
index 6de4139d7..0295225b4 100644
--- a/CefSharp.Example/Resources/TooltipTest.html
+++ b/CefSharp.Example/Resources/TooltipTest.html
@@ -14,6 +14,11 @@
+