diff --git a/.nuget/packages.config b/.nuget/packages.config index 19acf452e..a05271e70 100644 --- a/.nuget/packages.config +++ b/.nuget/packages.config @@ -1,4 +1,4 @@  - + diff --git a/CefSharp.BrowserSubprocess.Core/CefAppWrapper.cpp b/CefSharp.BrowserSubprocess.Core/CefAppWrapper.cpp index 755c83735..a3a2e3fa2 100644 --- a/CefSharp.BrowserSubprocess.Core/CefAppWrapper.cpp +++ b/CefSharp.BrowserSubprocess.Core/CefAppWrapper.cpp @@ -36,7 +36,7 @@ namespace CefSharp CefMainArgs cefMainArgs((HINSTANCE)hInstance.ToPointer()); - return CefExecuteProcess(cefMainArgs, (CefApp*)_cefApp.get()); + return CefExecuteProcess(cefMainArgs, (CefApp*)_cefApp.get(), NULL); } void CefAppWrapper::Bind(JavascriptRootObject^ rootObject, Func^ createBrowserProxyDelegate) diff --git a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj index b10e6d376..5645165db 100644 --- a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj +++ b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj @@ -1,6 +1,6 @@  - + Debug @@ -65,7 +65,9 @@ - + + 47d3feda + true ..\CefSharp.snk @@ -196,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 bd682d15e..bbef23d17 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 5ddcf4652..dcd6be4e9 100644 --- a/CefSharp.Core/BrowserSettings.h +++ b/CefSharp.Core/BrowserSettings.h @@ -248,18 +248,6 @@ namespace CefSharp void set(Nullable^ value) { _browserSettings->tab_to_links = CefStateFromDisabledSetting(value); } } - property String^ UserStyleSheetLocation - { - String^ get() { return StringUtils::ToClr(_browserSettings->user_style_sheet_location); } - void set(String^ value) { StringUtils::AssignNativeFromClr(_browserSettings->user_style_sheet_location, value); } - } - - property Nullable^ AuthorAndUserStylesDisabled - { - Nullable^ get() { return CefStateToDisabledSetting(_browserSettings->author_and_user_styles); } - void set(Nullable^ value) { _browserSettings->author_and_user_styles = CefStateFromDisabledSetting(value); } - } - property Nullable^ LocalStorageDisabled { Nullable^ get() { return CefStateToDisabledSetting(_browserSettings->local_storage); } diff --git a/CefSharp.Core/Cef.h b/CefSharp.Core/Cef.h index 997e6b241..6ea7131dc 100644 --- a/CefSharp.Core/Cef.h +++ b/CefSharp.Core/Cef.h @@ -148,7 +148,7 @@ namespace CefSharp CefMainArgs main_args; CefRefPtr app(new CefSharpApp(cefSettings)); - int exitCode = CefExecuteProcess(main_args, app.get()); + int exitCode = CefExecuteProcess(main_args, app.get(), NULL); if (exitCode >= 0) { @@ -157,7 +157,7 @@ namespace CefSharp return false; } - success = CefInitialize(main_args, *(cefSettings->_cefSettings), app.get()); + success = CefInitialize(main_args, *(cefSettings->_cefSettings), app.get(), NULL); app->CompleteSchemeRegistrations(); _initialized = success; @@ -318,7 +318,7 @@ namespace CefSharp } /// Flush the backing store (if any) to disk and execute the specified |handler| on the IO thread when done. Returns - /// A user-provided ICompletion handler implementation. + /// A user-provided ICompletionHandler implementation. /// Returns false if cookies cannot be accessed. static bool FlushStore(ICompletionHandler^ handler) { diff --git a/CefSharp.Core/CefSettings.h b/CefSharp.Core/CefSettings.h index f9df08893..0d5dd0573 100644 --- a/CefSharp.Core/CefSettings.h +++ b/CefSharp.Core/CefSettings.h @@ -65,7 +65,7 @@ namespace CefSharp public: CefSettings() : _cefSettings(new ::CefSettings()) { - MultiThreadedMessageLoop = true; + _cefSettings->multi_threaded_message_loop = true; BrowserSubprocessPath = "CefSharp.BrowserSubprocess.exe"; cefCustomSchemes = gcnew List(); cefCommandLineArgs = gcnew Dictionary(); @@ -86,12 +86,7 @@ namespace CefSharp virtual property bool MultiThreadedMessageLoop { - bool get() { return _cefSettings->multi_threaded_message_loop; } - - // CefSharp doesn't support single threaded message loop (and there's little point in supporting it), so we make this - // property read-only externally. - private: - void set(bool value) sealed { _cefSettings->multi_threaded_message_loop = value; } + bool get() { return _cefSettings->multi_threaded_message_loop == 1; } } virtual property String^ BrowserSubprocessPath @@ -108,7 +103,7 @@ namespace CefSharp virtual property bool IgnoreCertificateErrors { - bool get() { return _cefSettings->ignore_certificate_errors; } + bool get() { return _cefSettings->ignore_certificate_errors == 1; } void set(bool value) { _cefSettings->ignore_certificate_errors = value; } } @@ -138,7 +133,7 @@ namespace CefSharp virtual property bool PackLoadingDisabled { - bool get() { return _cefSettings->pack_loading_disabled; } + bool get() { return _cefSettings->pack_loading_disabled == 1; } void set(bool value) { _cefSettings->pack_loading_disabled = value; } } diff --git a/CefSharp.Core/CefSharp.Core.vcxproj b/CefSharp.Core/CefSharp.Core.vcxproj index d58f5aa0c..a29710e96 100644 --- a/CefSharp.Core/CefSharp.Core.vcxproj +++ b/CefSharp.Core/CefSharp.Core.vcxproj @@ -1,6 +1,6 @@  - + Debug @@ -278,6 +278,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/Internals/ClientAdapter.cpp b/CefSharp.Core/Internals/ClientAdapter.cpp index 0efcfea8d..b8526f467 100644 --- a/CefSharp.Core/Internals/ClientAdapter.cpp +++ b/CefSharp.Core/Internals/ClientAdapter.cpp @@ -141,7 +141,7 @@ namespace CefSharp // TODO: windows_key_code could possibly be the wrong choice here (the OnKeyEvent signature has changed since CEF1). The // other option would be native_key_code. - return handler->OnKeyEvent(_browserControl, KeyTypeToManaged(event.type), event.windows_key_code, event.modifiers, event.is_system_key); + return handler->OnKeyEvent(_browserControl, KeyTypeToManaged(event.type), event.windows_key_code, event.modifiers, event.is_system_key == 1); } bool ClientAdapter::OnPreKeyEvent(CefRefPtr browser, const CefKeyEvent& event, CefEventHandle os_event, bool* is_keyboard_shortcut) @@ -153,7 +153,7 @@ namespace CefSharp return false; } - return handler->OnPreKeyEvent(_browserControl, (KeyType)event.type, event.windows_key_code, event.native_key_code, event.modifiers, event.is_system_key, *is_keyboard_shortcut); + return handler->OnPreKeyEvent(_browserControl, (KeyType)event.type, event.windows_key_code, event.native_key_code, event.modifiers, event.is_system_key == 1, *is_keyboard_shortcut); } void ClientAdapter::OnLoadStart(CefRefPtr browser, CefRefPtr frame) @@ -266,8 +266,6 @@ namespace CefSharp } else if (requestResponse->Action == ResponseAction::Respond) { - CefRefPtr adapter = new StreamAdapter(requestResponse->ResponseStream); - throw gcnew NotImplementedException("Respond is not yet supported."); //resourceStream = CefStreamReader::CreateForHandler(static_cast>(adapter)); diff --git a/CefSharp.Core/Internals/CookieVisitor.cpp b/CefSharp.Core/Internals/CookieVisitor.cpp index a38995ace..694258619 100644 --- a/CefSharp.Core/Internals/CookieVisitor.cpp +++ b/CefSharp.Core/Internals/CookieVisitor.cpp @@ -20,8 +20,8 @@ namespace CefSharp cookie->Value = StringUtils::ToClr(cefCookie.value); cookie->Domain = StringUtils::ToClr(cefCookie.domain); cookie->Path = StringUtils::ToClr(cefCookie.path); - cookie->Secure = cefCookie.secure; - cookie->HttpOnly = cefCookie.httponly; + cookie->Secure = cefCookie.secure == 1; + cookie->HttpOnly = cefCookie.httponly == 1; if (cefCookie.has_expires) { diff --git a/CefSharp.Core/Internals/RenderClientAdapter.h b/CefSharp.Core/Internals/RenderClientAdapter.h index 48dbf8e36..df5b95916 100644 --- a/CefSharp.Core/Internals/RenderClientAdapter.h +++ b/CefSharp.Core/Internals/RenderClientAdapter.h @@ -128,6 +128,31 @@ namespace CefSharp return cefBrowser->GetMainFrame(); }; + void ShowDevTools() + { + auto cefHost = TryGetCefHost(); + + if (cefHost != nullptr) + { + CefWindowInfo windowInfo; + CefBrowserSettings settings; + + windowInfo.SetAsPopup(cefHost->GetWindowHandle(), "DevTools"); + + cefHost->ShowDevTools(windowInfo, this, settings); + } + } + + void CloseDevTools() + { + auto cefHost = TryGetCefHost(); + + if (cefHost != nullptr) + { + cefHost->CloseDevTools(); + } + } + private: void SetBuffer(BitmapInfo^ bitmapInfo, int newWidth, int newHeight, const void* buffer) @@ -198,7 +223,7 @@ namespace CefSharp CopyMemory(*backBufferHandle, (void*)buffer, numberOfBytes); }; - IMPLEMENT_REFCOUNTING(RenderClientAdapterInternal) + IMPLEMENT_REFCOUNTING(RenderClientAdapter) }; } } diff --git a/CefSharp.Core/ManagedCefBrowserAdapter.h b/CefSharp.Core/ManagedCefBrowserAdapter.h index 8b6c5bbab..d3e32c68d 100644 --- a/CefSharp.Core/ManagedCefBrowserAdapter.h +++ b/CefSharp.Core/ManagedCefBrowserAdapter.h @@ -46,23 +46,6 @@ namespace CefSharp }; public: - property String^ DevToolsUrl - { - String^ get() - { - auto cefHost = _renderClientAdapter->TryGetCefHost(); - - if (cefHost != nullptr) - { - return StringUtils::ToClr(cefHost->GetDevToolsURL(true)); - } - else - { - return nullptr; - } - } - } - ManagedCefBrowserAdapter(IWebBrowserInternal^ webBrowserInternal) { _renderClientAdapter = new RenderClientAdapter(webBrowserInternal, gcnew Action(this, &ManagedCefBrowserAdapter::OnAfterBrowserCreated)); @@ -468,6 +451,16 @@ namespace CefSharp } } + void ShowDevTools() + { + _renderClientAdapter->ShowDevTools(); + } + + void CloseDevTools() + { + _renderClientAdapter->CloseDevTools(); + } + void CreateBrowser(BrowserSettings^ browserSettings, IntPtr^ sourceHandle, String^ address) { HWND hwnd = static_cast(sourceHandle->ToPointer()); diff --git a/CefSharp.Core/packages.config b/CefSharp.Core/packages.config index d52c16f88..bbef23d17 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 f27dbfb1d..4dbc80ba4 100644 --- a/CefSharp.Example/CefExample.cs +++ b/CefSharp.Example/CefExample.cs @@ -16,6 +16,7 @@ namespace CefSharp.Example settings.RemoteDebuggingPort = 8088; //settings.CefCommandLineArgs.Add("renderer-process-limit", "1"); //settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog"); + settings.LogSeverity = LogSeverity.Verbose; if (debuggingSubProcess) { diff --git a/CefSharp.Example/Resources/Home.html b/CefSharp.Example/Resources/Home.html index e0f345423..b809dee81 100644 --- a/CefSharp.Example/Resources/Home.html +++ b/CefSharp.Example/Resources/Home.html @@ -105,17 +105,17 @@

Perhaps very obvious, but still worth mentioning. Since CefSharp is based on CEF, which is in turn based on - Chromium (version 29 for the time being), CefSharp provides + Chromium (version 33 for the time being), CefSharp provides one of the best HTML5 rendering experiences available - - - 468-470+ points out of 555 + + 470+ points out of 555 on html5test.com. Note: YMMV depending on .DLLs you add and features you enable.

Support for both x86 and x64

- Chromium 29 supports both x86 and x64, and so do we as of CefSharp 3.29.0. For the time being, it does not + Chromium 33 supports both x86 and x64, and so do we as of CefSharp 33.0.0 For the time being, it does not "auto-detect" the platform being used (since this is quite complex), so you have to choose either one for your project. This practically means that you will have to compile & package separate binaries/installers of your app for x86 and x64 respectively if you want/need to support both of them. diff --git a/CefSharp.Native.props b/CefSharp.Native.props index 4c70d3d3a..56b6b68c7 100644 --- a/CefSharp.Native.props +++ b/CefSharp.Native.props @@ -1,22 +1,10 @@ - - x64 - Win32 - - - - - - - - - diff --git a/CefSharp.Test/CefSharp.Test.csproj b/CefSharp.Test/CefSharp.Test.csproj index d456060a3..0aa234944 100644 --- a/CefSharp.Test/CefSharp.Test.csproj +++ b/CefSharp.Test/CefSharp.Test.csproj @@ -135,4 +135,11 @@ --> + + + + 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.Test/packages.config b/CefSharp.Test/packages.config index ff0fd105c..742fc0821 100644 --- a/CefSharp.Test/packages.config +++ b/CefSharp.Test/packages.config @@ -2,6 +2,7 @@ + \ No newline at end of file diff --git a/CefSharp.WinForms.Example/BrowserForm.Designer.cs b/CefSharp.WinForms.Example/BrowserForm.Designer.cs index 35699b84f..56e15ba65 100644 --- a/CefSharp.WinForms.Example/BrowserForm.Designer.cs +++ b/CefSharp.WinForms.Example/BrowserForm.Designer.cs @@ -249,17 +249,17 @@ // // showDevToolsMenuItem // - this.showDevToolsMenuItem.Enabled = false; this.showDevToolsMenuItem.Name = "showDevToolsMenuItem"; this.showDevToolsMenuItem.Size = new System.Drawing.Size(158, 22); this.showDevToolsMenuItem.Text = "Show Dev Tools"; + this.showDevToolsMenuItem.Click += new System.EventHandler(this.ShowDevToolsMenuItemClick); // // closeDevToolsMenuItem // - this.closeDevToolsMenuItem.Enabled = false; this.closeDevToolsMenuItem.Name = "closeDevToolsMenuItem"; this.closeDevToolsMenuItem.Size = new System.Drawing.Size(158, 22); this.closeDevToolsMenuItem.Text = "Close Dev Tools"; + this.closeDevToolsMenuItem.Click += new System.EventHandler(this.CloseDevToolsMenuItemClick); // // toolStripMenuItem3 // diff --git a/CefSharp.WinForms.Example/BrowserForm.cs b/CefSharp.WinForms.Example/BrowserForm.cs index 76c2b4f6f..4505b1caa 100644 --- a/CefSharp.WinForms.Example/BrowserForm.cs +++ b/CefSharp.WinForms.Example/BrowserForm.cs @@ -250,5 +250,15 @@ namespace CefSharp.WinForms.Example }, TaskScheduler.FromCurrentSynchronizationContext()); } + + private void ShowDevToolsMenuItemClick(object sender, EventArgs e) + { + browser.ShowDevTools(); + } + + private void CloseDevToolsMenuItemClick(object sender, EventArgs e) + { + browser.CloseDevTools(); + } } } diff --git a/CefSharp.WinForms.Example/CefSharp.WinForms.Example.csproj b/CefSharp.WinForms.Example/CefSharp.WinForms.Example.csproj index 8a88df10d..c34e16f1f 100644 --- a/CefSharp.WinForms.Example/CefSharp.WinForms.Example.csproj +++ b/CefSharp.WinForms.Example/CefSharp.WinForms.Example.csproj @@ -89,6 +89,7 @@ + @@ -124,4 +125,11 @@ + + + + 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.WinForms.Example/Properties/AssemblyInfo.cs b/CefSharp.WinForms.Example/Properties/AssemblyInfo.cs index 18adc9f5a..0f58787eb 100644 --- a/CefSharp.WinForms.Example/Properties/AssemblyInfo.cs +++ b/CefSharp.WinForms.Example/Properties/AssemblyInfo.cs @@ -4,11 +4,6 @@ using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CefSharp.WinForms.Example")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - [assembly: AssemblyCompany(AssemblyInfo.AssemblyCompany)] [assembly: AssemblyProduct(AssemblyInfo.AssemblyProduct)] [assembly: AssemblyCopyright(AssemblyInfo.AssemblyCopyright)] diff --git a/CefSharp.WinForms.Example/packages.config b/CefSharp.WinForms.Example/packages.config new file mode 100644 index 000000000..b519c7ce7 --- /dev/null +++ b/CefSharp.WinForms.Example/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CefSharp.WinForms/ChromiumWebBrowser.cs b/CefSharp.WinForms/ChromiumWebBrowser.cs index 9ff07b6b2..2685ed873 100644 --- a/CefSharp.WinForms/ChromiumWebBrowser.cs +++ b/CefSharp.WinForms/ChromiumWebBrowser.cs @@ -18,7 +18,7 @@ namespace CefSharp.WinForms public string Title { get; set; } public bool IsLoading { get; private set; } public string TooltipText { get; private set; } - public string Address { get; set; } + public string Address { get; private set; } public IDialogHandler DialogHandler { get; set; } public IJsDialogHandler JsDialogHandler { get; set; } @@ -249,21 +249,14 @@ namespace CefSharp.WinForms managedCefBrowserAdapter.StopFinding(clearSelection); } - void IWebBrowserInternal.ShowDevTools() + public void ShowDevTools() { - // TODO: Do something about this one. - var devToolsUrl = managedCefBrowserAdapter.DevToolsUrl; - throw new NotImplementedException("Implement when Cef upgraded to 1750."); + managedCefBrowserAdapter.ShowDevTools(); } - void IWebBrowserInternal.CloseDevTools() + public void CloseDevTools() { - throw new NotImplementedException("Implement when Cef upgraded to 1750."); - } - - public string DevToolsUrl - { - get { return managedCefBrowserAdapter.DevToolsUrl; } + managedCefBrowserAdapter.CloseDevTools(); } public void Stop() diff --git a/CefSharp.Wpf.Example/CefSharp.Wpf.Example.csproj b/CefSharp.Wpf.Example/CefSharp.Wpf.Example.csproj index 57748065b..219ed33d4 100644 --- a/CefSharp.Wpf.Example/CefSharp.Wpf.Example.csproj +++ b/CefSharp.Wpf.Example/CefSharp.Wpf.Example.csproj @@ -129,6 +129,7 @@ + @@ -156,22 +157,13 @@ - - x64 - Win32 - - - - - - - - - - - - - + + + + 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.Wpf.Example/Properties/AssemblyInfo.cs b/CefSharp.Wpf.Example/Properties/AssemblyInfo.cs index d4e530020..c747afb17 100644 --- a/CefSharp.Wpf.Example/Properties/AssemblyInfo.cs +++ b/CefSharp.Wpf.Example/Properties/AssemblyInfo.cs @@ -1,10 +1,13 @@ -using System.Reflection; +using System; +using System.Reflection; using System.Runtime.InteropServices; +using CefSharp; [assembly: AssemblyTitle("CefSharp.Wpf.Example")] -[assembly: AssemblyCompany("The CefSharp Authors")] -[assembly: AssemblyProduct("CefSharp")] -[assembly: AssemblyCopyright("Copyright © The CefSharp Authors 2010-2014")] - -[assembly: AssemblyVersion("3.29.0.0")] -[assembly: ComVisible(false)] +[assembly: AssemblyCompany(AssemblyInfo.AssemblyCompany)] +[assembly: AssemblyProduct(AssemblyInfo.AssemblyProduct)] +[assembly: AssemblyCopyright(AssemblyInfo.AssemblyCopyright)] +[assembly: ComVisible(AssemblyInfo.ComVisible)] +[assembly: AssemblyVersion(AssemblyInfo.AssemblyVersion)] +[assembly: AssemblyFileVersion(AssemblyInfo.AssemblyFileVersion)] +[assembly: CLSCompliant(AssemblyInfo.ClsCompliant)] diff --git a/CefSharp.Wpf.Example/packages.config b/CefSharp.Wpf.Example/packages.config new file mode 100644 index 000000000..b519c7ce7 --- /dev/null +++ b/CefSharp.Wpf.Example/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CefSharp.Wpf/ChromiumWebBrowser.cs b/CefSharp.Wpf/ChromiumWebBrowser.cs index 9fe8c1bc5..5e800ae28 100644 --- a/CefSharp.Wpf/ChromiumWebBrowser.cs +++ b/CefSharp.Wpf/ChromiumWebBrowser.cs @@ -148,21 +148,7 @@ namespace CefSharp.Wpf return; } - if (!Cef.IsInitialized && - !Cef.Initialize()) - { - throw new InvalidOperationException("Cef::Initialize() failed"); - } - - // TODO: Consider making the delay here configurable. - tooltipTimer = new DispatcherTimer( - TimeSpan.FromSeconds(0.5), - DispatcherPriority.Render, - OnTooltipTimerTick, - Dispatcher - ); - - managedCefBrowserAdapter.LoadUrl(newValue); + Load(newValue); } #endregion Address dependency property @@ -944,7 +930,21 @@ namespace CefSharp.Wpf public void Load(string url) { - throw new NotImplementedException(); + if (!Cef.IsInitialized && + !Cef.Initialize()) + { + throw new InvalidOperationException("Cef::Initialize() failed"); + } + + // TODO: Consider making the delay here configurable. + tooltipTimer = new DispatcherTimer( + TimeSpan.FromSeconds(0.5), + DispatcherPriority.Render, + OnTooltipTimerTick, + Dispatcher + ); + + managedCefBrowserAdapter.LoadUrl(url); } public void LoadHtml(string html, string url) @@ -1051,21 +1051,14 @@ namespace CefSharp.Wpf }); } - void IWebBrowserInternal.ShowDevTools() + public void ShowDevTools() { - // TODO: Do something about this one. - var devToolsUrl = managedCefBrowserAdapter.DevToolsUrl; - throw new NotImplementedException("Implement when Cef upgraded to 1750."); + managedCefBrowserAdapter.ShowDevTools(); } - void IWebBrowserInternal.CloseDevTools() + public void CloseDevTools() { - throw new NotImplementedException("Implement when Cef upgraded to 1750."); - } - - public string DevToolsUrl - { - get { return managedCefBrowserAdapter.DevToolsUrl; } + managedCefBrowserAdapter.CloseDevTools(); } void IWebBrowserInternal.OnFrameLoadStart(string url, bool isMainFrame) diff --git a/CefSharp/IWebBrowser.cs b/CefSharp/IWebBrowser.cs index 33b906d7b..a453ed2af 100644 --- a/CefSharp/IWebBrowser.cs +++ b/CefSharp/IWebBrowser.cs @@ -141,13 +141,12 @@ namespace CefSharp bool CanReload { get; } ///

- /// The address (URL) which the browser control is currently displaying. Can be set to a simplified URL - /// (e.g. www.google.com) or a full URL (e.g. http://www.google.com). Will automatically be updated as the user - /// navigates to another page (e.g. by clicking on a link). + /// The address (URL) which the browser control is currently displaying. + /// Will automatically be updated as the user navigates to another page (e.g. by clicking on a link). /// /// In the WPF control, this property is implemented as a Dependency Property and fully supports data /// binding. - string Address { get; set; } + string Address { get; } /// /// The title of the web page being currently displayed. @@ -169,11 +168,6 @@ namespace CefSharp /// binding. double ZoomLevel { get; set; } - /// - /// Url which can be loaded in a browser control to view the dev tools - /// - string DevToolsUrl { get; } - /// /// Search for text within the current page. /// @@ -248,5 +242,15 @@ namespace CefSharp /// Opens a Print Dialog which if used (can be user cancelled) will print the browser contents. /// void Print(); + + /// + /// Open developer tools in its own window. + /// + void ShowDevTools(); + + /// + /// Explicitly close the developer tools window if one exists for this browser instance. + /// + void CloseDevTools(); } } diff --git a/CefSharp/Internals/IWebBrowserInternal.cs b/CefSharp/Internals/IWebBrowserInternal.cs index 0c57c2c55..403189119 100644 --- a/CefSharp/Internals/IWebBrowserInternal.cs +++ b/CefSharp/Internals/IWebBrowserInternal.cs @@ -13,8 +13,6 @@ namespace CefSharp.Internals void SetNavState(bool canGoBack, bool canGoForward, bool canReload); void SetTitle(string title); void SetTooltipText(string tooltipText); - void ShowDevTools(); - void CloseDevTools(); void OnFrameLoadStart(string url, bool isMainFrame); void OnFrameLoadEnd(string url, bool isMainFrame, int httpStatusCode); diff --git a/CefSharp/Properties/AssemblyInfo.cs b/CefSharp/Properties/AssemblyInfo.cs index 0145b2ed8..305a8a77d 100644 --- a/CefSharp/Properties/AssemblyInfo.cs +++ b/CefSharp/Properties/AssemblyInfo.cs @@ -33,8 +33,8 @@ namespace CefSharp public const bool ComVisible = false; public const string AssemblyCompany = "The CefSharp Authors"; public const string AssemblyProduct = "CefSharp"; - public const string AssemblyVersion = "31.0.0.0"; - public const string AssemblyFileVersion = "31.0.0.0"; + public const string AssemblyVersion = "33.0.0.0"; + public const string AssemblyFileVersion = "33.0.0.0"; public const string AssemblyCopyright = "Copyright © The CefSharp Authors 2010-2014"; public const string CefSharpCoreProject = "CefSharp.Core, PublicKey=" + PublicKey; public const string CefSharpBrowserSubprocessProject = "CefSharp.BrowserSubprocess, PublicKey=" + PublicKey; diff --git a/NuGet/CefSharp.Common.nuspec b/NuGet/CefSharp.Common.nuspec index 7322252e7..7533eacb5 100644 --- a/NuGet/CefSharp.Common.nuspec +++ b/NuGet/CefSharp.Common.nuspec @@ -12,7 +12,7 @@ chrome browser Copyright © 2010-2014 The CefSharp Authors - + diff --git a/NuGet/CefSharp.WinForms.nuspec b/NuGet/CefSharp.WinForms.nuspec new file mode 100644 index 000000000..01c2da4e6 --- /dev/null +++ b/NuGet/CefSharp.WinForms.nuspec @@ -0,0 +1,26 @@ + + + + CefSharp.WinForms + $version$ + The CefSharp Authors + The CefSharp Authors + https://github.com/cefsharp/cefsharp + https://raw.github.com/cefsharp/CefSharp/master/LICENSE + false + The CefSharp Chromium-based browser component (WinForms control). + winforms chrome browser + Copyright © 2010-2014 The CefSharp Authors + + + + + + + + + + + + diff --git a/NuGet/CefSharp.WinForms.props b/NuGet/CefSharp.WinForms.props index c30b8d881..05acaa714 100644 --- a/NuGet/CefSharp.WinForms.props +++ b/NuGet/CefSharp.WinForms.props @@ -1,6 +1,10 @@ - + + + diff --git a/NuGet/pack.bat b/NuGet/pack.bat index a64816511..093e6136f 100644 --- a/NuGet/pack.bat +++ b/NuGet/pack.bat @@ -1,19 +1,4 @@ -if "%APPVEYOR_BUILD_NUMBER%"=="" ( - set APPVEYOR_BUILD_NUMBER=10000 -) - -set version=31.0.0-JSWIP-PRE-%APPVEYOR_BUILD_NUMBER% -REM set platform=x86 - -if "%platform%"=="x64" ( - set DotPlatform=.x64 - set CPlatform=x64 -) else ( - set Platform=x86 - set DotPlatform=.x86 - set CPlatform=Win32 -) - -NuGet pack CefSharp.Common.nuspec -NoPackageAnalysis -Version %version% -Properties DotPlatform=%DotPlatform%;Platform=%Platform%;CPlatform=%CPlatform% -NuGet pack CefSharp.WpfOrWinForms.nuspec -NoPackageAnalysis -Version %version% -Properties ControlType=Wpf;DotPlatform=%DotPlatform%;Platform=%Platform% -NuGet pack CefSharp.WpfOrWinForms.nuspec -NoPackageAnalysis -Version %version% -Properties ControlType=WinForms;DotPlatform=%DotPlatform%;Platform=%Platform% +set version=33.0.0-pre2 +NuGet pack CefSharp.Common.nuspec -NoPackageAnalysis -Version %version% +NuGet pack CefSharp.Wpf.nuspec -NoPackageAnalysis -Version %version% +NuGet pack CefSharp.WinForms.nuspec -NoPackageAnalysis -Version %version% diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 000000000..5413daef8 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,246 @@ +param( + [ValidateSet("vs2013", "vs2012", "nupkg", "nupkg-only")] + [Parameter(Position = 0)] + [string] $Target = "nupkg", + [Parameter(Position = 1)] + [string] $Version = "33.0.0-pre2" +) + +$WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition + +$CefSln = Join-Path $WorkingDir 'CefSharp3.sln' + +# https://github.com/jbake/Powershell_scripts/blob/master/Invoke-BatchFile.ps1 +function Invoke-BatchFile +{ + param( + [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] + [string]$Path, + [Parameter(Position = 1, Mandatory = $true, ValueFromPipeline = $true)] + [string]$Parameters + ) + + $tempFile = [IO.Path]::GetTempFileName() + + cmd.exe /c " `"$Path`" $Parameters && set > `"$tempFile`" " + + Get-Content $tempFile | Foreach-Object { + if ($_ -match "^(.*?)=(.*)$") + { + Set-Content "env:\$($matches[1])" $matches[2] + } + } + + Remove-Item $tempFile +} + +function Write-Diagnostic +{ + param( + [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] + [string] $Message + ) + + Write-Host + Write-Host $Message -ForegroundColor Green + Write-Host +} + +function Die +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $Message + ) + + Write-Host + Write-Error $Message + exit 1 +} + +function Warn +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $Message + ) + + Write-Host + Write-Host $Message -ForegroundColor Yellow + Write-Host +} + +function TernaryReturn +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [bool] $Yes, + [Parameter(Position = 1, ValueFromPipeline = $true)] + $Value, + [Parameter(Position = 2, ValueFromPipeline = $true)] + $Value2 + ) + + if($Yes) { + return $Value + } + + $Value2 +} + +function Msvs +{ + param( + [ValidateSet('v110', 'v120')] + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $Toolchain, + + [Parameter(Position = 1, ValueFromPipeline = $true)] + [ValidateSet('Debug', 'Release')] + [string] $Configuration, + + [Parameter(Position = 2, ValueFromPipeline = $true)] + [ValidateSet('x86', 'x64')] + [string] $Platform + ) + + Write-Diagnostic "Targeting $Toolchain using configuration $Configuration on platform $Platform" + + $VisualStudioVersion = $null + $VXXCommonTools = $null + + switch -Exact ($Toolchain) { + 'v110' { + $VisualStudioVersion = '11.0' + $VXXCommonTools = Join-Path $env:VS110COMNTOOLS '..\..\vc' + } + 'v120' { + $VisualStudioVersion = '12.0' + $VXXCommonTools = Join-Path $env:VS120COMNTOOLS '..\..\vc' + } + } + + if ($VXXCommonTools -eq $null -or (-not (Test-Path($VXXCommonTools)))) { + Die 'Error unable to find any visual studio environment' + } + + $VCVarsAll = Join-Path $VXXCommonTools vcvarsall.bat + if (-not (Test-Path $VCVarsAll)) { + Die "Unable to find $VCVarsAll" + } + + # Only configure build environment once + if($env:CEFSHARP_BUILD_IS_BOOTSTRAPPED -eq $null) { + Invoke-BatchFile $VCVarsAll $Platform + $env:CEFSHARP_BUILD_IS_BOOTSTRAPPED = $true + } + + $Arch = TernaryReturn ($Platform -eq 'x64') 'x64' 'win32' + + $Arguments = @( + "$CefSln", + "/t:rebuild", + "/p:VisualStudioVersion=$VisualStudioVersion", + "/p:Configuration=$Configuration", + "/p:Platform=$Arch" + ) + + $StartInfo = New-Object System.Diagnostics.ProcessStartInfo + $StartInfo.FileName = "msbuild.exe" + $StartInfo.Arguments = $Arguments + + $StartInfo.EnvironmentVariables.Clear() + + Get-ChildItem -Path env:* | ForEach-Object { + $StartInfo.EnvironmentVariables.Add($_.Name, $_.Value) + } + + $StartInfo.UseShellExecute = $false + $StartInfo.CreateNoWindow = $false + + $Process = New-Object System.Diagnostics.Process + $Process.StartInfo = $startInfo + $Process.Start() + $Process.WaitForExit() + + if($Process.ExitCode -ne 0) { + Die "Build failed" + } +} + +function VSX +{ + param( + [ValidateSet('v110', 'v120')] + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $Toolchain + ) + + if($Toolchain -eq 'v120' -and $env:VS120COMNTOOLS -eq $null) { + Warn "Toolchain $Toolchain is not installed on your development machine, skipping build." + Return + } + + if($Toolchain -eq 'v110' -and $env:VS110COMNTOOLS -eq $null) { + Warn "Toolchain $Toolchain is not installed on your development machine, skipping build." + Return + } + + Write-Diagnostic "Starting to build targeting toolchain $Toolchain" + + Msvs "$Toolchain" 'Release' 'x86' + Msvs "$Toolchain" 'Release' 'x64' + + Write-Diagnostic "Finished build targeting toolchain $Toolchain" +} + +function NugetPackageRestore +{ + $nuget = Join-Path $env:LOCALAPPDATA .\nuget\NuGet.exe + if(-not (Test-Path $nuget)) { + Die "Please install nuget. More information available at: http://docs.nuget.org/docs/start-here/installing-nuget" + } + + Write-Diagnostic "Restore Nuget Packages" + + # Restore packages + . $nuget restore $CefSln +} + +function Nupkg +{ + $nuget = Join-Path $env:LOCALAPPDATA .\nuget\NuGet.exe + if(-not (Test-Path $nuget)) { + Die "Please install nuget. More information available at: http://docs.nuget.org/docs/start-here/installing-nuget" + } + + Write-Diagnostic "Building nuget package" + + # Build packages + . $nuget pack nuget\CefSharp.Common.nuspec -NoPackageAnalysis -Version $Version -OutputDirectory nuget + . $nuget pack nuget\CefSharp.Wpf.nuspec -NoPackageAnalysis -Version $Version -OutputDirectory nuget + . $nuget pack nuget\CefSharp.WinForms.nuspec -NoPackageAnalysis -Version $Version -OutputDirectory nuget +} + +NugetPackageRestore + +switch -Exact ($Target) { + "nupkg" + { + VSX v120 + #VSX v110 + Nupkg + } + "nupkg-only" + { + Nupkg + } + "vs2013" + { + VSX v120 + } + "vs2012" + { + VSX v110 + } +} \ No newline at end of file