Commit Graph

81 Commits

Author SHA1 Message Date
amaitland 679cdb5b11 JSB ResolveObject WcfEnabled = false throw exception if attempt to register sync object
Update the examples to use newer Register method as Legacy options is disabled by default
2018-01-22 11:02:23 +10:00
Alex Maitland 9b01b69d2f Implement Javascript Binding v2 (#2247)
* JSB Rewrite - Add CefSharp.RegisterBoundObject javascript method

To get around the problem of IPC timing, I've reversed the communication, now it's the render process requesting
the bound objects, the implementation is incomplete at this stage, more just a basic proof of concept

Rewrite BindingTest.html using QUnit
One of the tests doesn't map correctly as it requires def user interaction

TODO:

- Get objects by name
- Rename Messages.h values that relate to this change so they are more descriptive
- Better error handling
- Caching of objects within a render process
- Investigate global context options, don't think it's possible to call an async method directly in the global context

# Conflicts:
#	CefSharp.Example/Resources/BindingTest.html

* JSB Improve Request/Response message names

* BindingTest.html - Output stress test results

* Remove JavascriptRootObject was leftover from time we used WCF to transmit objects

* JavascriptObjectRepository - Objects are now sent in the same list with an IsAsync flag

Separation when sending over IPC with two unique lists isn't necessary

* JavascriptObjectRepository - Return objects by name or return all by default

Untabify CefAppUnmanagedWrapper.cpp
Add minor comment to CefBrowserWrapper for a reminder that we use Frame Identifier as dictionary key

* Add //TODO: JSB comments for work that's left to be done

Ideally within a render process we cache bound objects once they've been communicated,
It would also be nice to make multiple binding requests so objects can later be added dynamically

* JSB Allow multiple calls to CefSharp.RegisterBoundObject

Update BindingTest.html to name two distinct calls to different bound objects

* JSB - Add some notes about caching, no working implementation yet

* JSB - Dynamically Register object on Request

* JSB Add ability to unbind an object and rename RegisterBoundObject to BindObjectAsync

# Conflicts:
#	CefSharp.Example/Resources/BindingTest.html

* JSB BindObjectAsync - if objects already bound then return false

* JSB - Ignore Indexer properties

Were previously throwing an exception

* JSB - Add LegacyJavascriptBindingEnabled option so preserve existing behaviour

This is only useful for SPA application and those that only navigate to pages
hosting within a single domain. Any sort of cross-site navigation and a new
render process will be spawned and objects won't be bound automatically
(You can use the new methods to request they're bound yourself, at least in theory,
more testing required on this)

* Add LegacyBindingTest.html

Current disabled by default. To enable uncomment CefSharpSettings.LegacyJavascriptBindingEnabled = true;
in CefExample.cs

* RegisterJsObject and RegisterAsyncJsObject can now only be used when CefSharpSettings.LegacyJavascriptBindingEnabled = true

See https://github.com/cefsharp/CefSharp/issues/2246 for details
2018-01-22 10:24:25 +10:00
amaitland 127c00554f Rewrite WPF/OffScreen OnPaint
OffScreen
  - Now maintains a raw Byte[] buffer that is used to create the GDI bitmaps
can be overridden and raw buffer access granted (eliminates the forced memory copy to the memory mapped view)

WPF
  - MemoryMappedFile.CreateNew is now used to create the in memory view and copy the buffer
  - InteropBitmapFactory only create new MemoryMappedFile selectively. If the MemoryMappedFile is larger than we require then just reuse it rather than
    releasing then allocating a smaller section of memory that's used for double buffering with InteropBitmap and WritableBitmap
  - Removed CefDirtyRect and used existing Rect class
  - Rename rendering event to Paint, still preferable to implement IBitmapFactory or subclass ChromiumWebBrowser
  - Update ChromiumWebBrowserWithScreenshotSupport to support new rendering method - not very well tested.

Resolves #2237
2018-01-18 11:29:12 +10:00
GrabzIt 62ae9ed36f Fixed pointer 2017-10-06 08:26:59 +01:00
GrabzIt 2f680f01b7 Updated version 59.0.0 to latest build 3.3071.1649 2017-08-18 20:37:41 +01:00
GrabzIt 35f9cc3377 Update to Cef Version 59.0.0
Note that there is one breaking change as offscreen windows are now automatically transparent due to this cef change: https://bitbucket.org/chromiumembedded/cef/commits/3f71138d64586d774f645a6db5283b5205ea9df4

To make a offscreen window non-transparent you need to set the background colour as shown below were it is set to white:

browserSettings.BackgroundColor = 0255255255;
2017-08-18 15:45:52 +01:00
Chris cd934267c6 Updated copyright year and made sure it used same format everywhere (#1966) 2017-03-06 08:44:37 +10:00
Alex Maitland d4feffb554 Feature - Add IBinder (#1749)
* Add basic ModelBinding which was imported from NancyFx framework - more can be stripped out that's unused

* Add IBinder as a param when registering an object for binding
Binding is disabled by default

* Add license and remove unused using statements

* Make bind method virtual to allow for overriding
Make methods protected

* Add very basic collection support - only primitive types supported for now.
Remove unused exceptions

* Support binding a list of sub objects

* Add null check for null params

* Add BindingOptions class - remove binder and CamelCaseJavascriptNames properties - allow for additional options in the future
Breaking change.

* Add support for List<object> binding type
2016-07-20 13:38:24 +10:00
Alex Maitland 69ffd4370b Merge pull request #1542 from amaitland/cleanup/duplicatecode
Cleanup ManagedCefBrowserAdapater + Remove Duplicate Code
2016-02-01 16:16:07 +10:00
amaitland 306be4255d Add try/catch around _browserProcessServiceHost->Open call - seems that occasionally there's a timing issue
See #862, #804 and #1494
2016-01-12 16:00:38 +10:00
amaitland 0181d59850 Add SendKeyEvent overload that takes the message params and parses them - using the managed method would have required an unnecessary object creation
This code maybe useful to someone, can be used in the context of the OffScreen browser now
2016-01-12 15:31:13 +10:00
amaitland e20209b82d ManagedCefBrowserAdapter - _browserAdapter was never set so the Close method wasn't being called
Remove GetCefBrowser method as ManagedCefBrowserAdapter now totally relies on the managed wrappers for calls like SendKeyEvent
2016-01-12 15:16:31 +10:00
amaitland 63ba97042d Move the Drag OSR methods from ManagedCefBrowserAdapter to CefBrowserHostWrapper 2016-01-12 14:36:24 +10:00
amaitland 264be0e753 Store a reference to IBrowser in ClientAdapter rather than trying to access it through the BrowserAdapter 2016-01-12 14:11:49 +10:00
amaitland 627f80c8ec Pass in only the required params into BrowserProcessServiceHost - was passing in the browser adapter which wasn't strictly required.
Pass the IBrowser instance into IWebBrowserInternal.OnAfterBrowserCreated
Keep a reference to IBrowser in the ChromiumWebBrowser instances (reduces the number of GetBrowser calls and also makes it clearer internally when the browser variable is set)
2016-01-12 14:01:37 +10:00
amaitland f74bef6921 Instead of passing in the BrowserId on OnAfterBrowserCreated pass in the IBrowser 2016-01-12 13:42:35 +10:00
amaitland bae3c28e92 Update copyright to 2016 2016-01-11 14:11:30 +10:00
amaitland 83dba09e99 Start to remove some of the methods from ManagedCefBrowserAdapter that are now available through IBrowserHost 2016-01-09 08:09:38 +10:00
amaitland 7aa128781d Add IsDisposed checks
Resolves #1307
2015-10-13 19:46:38 +10:00
amaitland b9ee476e8e Fix up some of the vc++ include mess that we had going
Cleanup using namespace statements as well
2015-09-29 16:26:06 +10:00
amaitland cb989648cb Keep a WeakReference to IBrowserAdapter instead of IBrowser and lookup the browser by it's Id for callbacks 2015-09-24 21:00:53 +10:00
amaitland 73e01e09e6 Merge branch 'features/HighDpiAgain' of https://github.com/bjarteskogoy/CefSharp 2015-08-26 15:18:29 +10:00
Bjarte Skogøy 276c05195e Spaces instead of tabs. 2015-08-21 08:58:57 +02:00
mmamone cb96ce1437 Implement start drag for WPF browser
Exposed the necessary functions for start drag to work:
* StartDragging (RenderClientAdapter)
* OnDragSourceEndedAt (ManagedCefBrowserAdapter)
* OnDragSourceSystemDragEnded (ManagedCefBrowserAdapter)

Implemented IRenderWebBrowser.StartDragging for the WPF
ChromiumWebBrowser.

TODO: Would like to add an adorner layer for the dragged text (using the
supplied fragment html), but feels like a project for later.
2015-08-19 13:03:18 +10:00
Bjarte Skogøy c7c0dad0d4 Init bitmap infos when scale info is available 2015-08-18 23:33:10 +02:00
cefsharp-ms 0b300d5dda Merged master 2015-07-31 17:41:00 +02:00
amaitland 9a0d7688a0 Merge branch 'cef/2272' 2015-07-28 17:17:12 +10:00
amaitland d843e96407 Merge branch 'cef/2272' of https://github.com/jamespearce2006/CefSharp into cef/2272 2015-07-28 15:59:30 +10:00
cefsharp-ms a8db666642 added async bound method result callback on browser process side 2015-07-23 15:12:28 +02:00
cefsharp-ms 7744b7197f async bindings are dispatched to a background thread for each browser 2015-07-23 15:12:05 +02:00
cefsharp-ms 0e073bcd0a added message to transmit async bound jsrootobject to render process 2015-07-23 15:10:52 +02:00
cefsharp-ms a99e020138 added option to register async js objects with only method bindings 2015-07-23 15:10:28 +02:00
amaitland 0c031a1a3b Split RequestContext out from BrowserSettings 2015-07-22 13:51:16 +10:00
Tommaso Ercole a3e869b542 Add basic CefRequestContext wrapper 2015-07-21 23:51:49 +10:00
David Serfozo 798d90ade2 constructors/destructors moved to .h;;little changes to make code more consistent 2015-07-08 18:29:46 +02:00
David Serfozo 7c9a449158 added new IJavascriptCallback implementation into the pipeline 2015-07-07 19:30:43 +02:00
amaitland 3ab612a44a Rename Oninitialized to OnAfterBrowserCreated (more closely matches the underlying CEF API) 2015-07-07 16:48:45 +10:00
Alex Maitland ff6d53ecff Merge pull request #1102 from amaitland/cleanup/browsersettings
BrowserSettings map to Enabled/Disabled/Default Enum
2015-07-07 10:37:07 +10:00
amaitland df29944016 Implement SendMouseMoveEvent in IBrowserHost
Can now be used by offscreen
2015-07-06 12:47:29 +10:00
amaitland 5c27b7befa Set toolTip to null after mouse leaves 2015-07-06 12:42:50 +10:00
amaitland 98d186c33c Move OnMouseButton into IBrowserHost (rename to SendMouseClickEvent) 2015-07-06 12:39:33 +10:00
amaitland fbe8ccd61c Move Invalidate method from ManagedCefBrowserAdapter into CefBrowserHostWrapper - now can be used in OffScreen 2015-07-06 12:25:09 +10:00
amaitland 92a325b77e Change Nullable types from ref to value (as nullable is a struct).
Decompiled code showed `ValueType` before and how shows the correct type
2015-07-01 22:42:24 +10:00
amaitland df94d54a61 Remove duplicate GetMainFrame and GetFocusedFrame methods - turned them into extensions 2015-07-01 19:49:27 +10:00
amaitland f239503bb3 Move SendMouseWheelEvent to IBrowserHost 2015-07-01 19:38:14 +10:00
amaitland 958a6264a3 Remove LoadUrl code from ManagedCefBrowserAdapter - remove more duplication 2015-07-01 12:29:37 +10:00
amaitland 2129c1907e Remove IBrowserAdapter from Frame and Browser wrappers - now directly cast CefClient to ClientAdapter so can execute js 2015-06-29 14:03:10 +10:00
amaitland 819dfd54f9 Move WcfEnabled option into CefSharpSettings class
Reduce code duplication - move EvaluateScriptAsync in WebBrowserExtensions
2015-06-29 13:20:47 +10:00
David Serfozo 762d94942a added jscallback support for new evaluatescript implementation 2015-06-27 19:01:41 +02:00
David Serfozo cc8a07c21f added evaluatescriptasync message handlers and rerouted evalscript to cef ipc 2015-06-27 19:01:21 +02:00