Permalink
Browse files

No commit message

  • Loading branch information...
peterdn
peterdn committed Jul 27, 2009
0 parents commit efdd79f1027fe22d5c9c05f3719c65578184ff8f
Showing with 4,776 additions and 0 deletions.
  1. +26 −0 LICENSE.txt
  2. +22 −0 README.txt
  3. +32 −0 WebKit.NET.sln
  4. +125 −0 WebKitBrowser/ActivationContext.cs
  5. +62 −0 WebKitBrowser/Properties/AssemblyInfo.cs
  6. +63 −0 WebKitBrowser/Properties/Resources.Designer.cs
  7. +101 −0 WebKitBrowser/Properties/Resources.resx
  8. +94 −0 WebKitBrowser/W32API.cs
  9. +135 −0 WebKitBrowser/WebDownloadDelegate.cs
  10. +153 −0 WebKitBrowser/WebFrameLoadDelegate.cs
  11. +69 −0 WebKitBrowser/WebKitBrowser.Designer.cs
  12. +535 −0 WebKitBrowser/WebKitBrowser.cs
  13. +97 −0 WebKitBrowser/WebKitBrowser.csproj
  14. +141 −0 WebKitBrowser/WebKitBrowser.manifest
  15. +120 −0 WebKitBrowser/WebKitBrowser.resx
  16. +56 −0 WebKitBrowser/WebKitBrowserEvents.cs
  17. +96 −0 WebKitBrowser/WebKitDownload.cs
  18. +61 −0 WebKitBrowser/WebKitDownloadEvents.cs
  19. +71 −0 WebKitBrowser/WebPolicyDelegate.cs
  20. +89 −0 WebKitBrowser/WebResourceLoadDelegate.cs
  21. +356 −0 WebKitBrowser/WebUIDelegate.cs
  22. +97 −0 WebKitBrowserTest/DownloadForm.Designer.cs
  23. +65 −0 WebKitBrowserTest/DownloadForm.cs
  24. +120 −0 WebKitBrowserTest/DownloadForm.resx
  25. +218 −0 WebKitBrowserTest/MainForm.Designer.cs
  26. +163 −0 WebKitBrowserTest/MainForm.cs
  27. +123 −0 WebKitBrowserTest/MainForm.resx
  28. +178 −0 WebKitBrowserTest/NavigationBar.Designer.cs
  29. +112 −0 WebKitBrowserTest/NavigationBar.cs
  30. +120 −0 WebKitBrowserTest/NavigationBar.resx
  31. +46 −0 WebKitBrowserTest/Program.cs
  32. +62 −0 WebKitBrowserTest/Properties/AssemblyInfo.cs
  33. +71 −0 WebKitBrowserTest/Properties/Resources.Designer.cs
  34. +117 −0 WebKitBrowserTest/Properties/Resources.resx
  35. +30 −0 WebKitBrowserTest/Properties/Settings.Designer.cs
  36. +7 −0 WebKitBrowserTest/Properties/Settings.settings
  37. +145 −0 WebKitBrowserTest/SourceViewForm.Designer.cs
  38. +59 −0 WebKitBrowserTest/SourceViewForm.cs
  39. +123 −0 WebKitBrowserTest/SourceViewForm.resx
  40. +66 −0 WebKitBrowserTest/WebBrowserTabPage.Designer.cs
  41. +103 −0 WebKitBrowserTest/WebBrowserTabPage.cs
  42. +123 −0 WebKitBrowserTest/WebBrowserTabPage.resx
  43. +124 −0 WebKitBrowserTest/WebKitBrowserTest.csproj
  44. BIN webkit/WebKit.Interop.dll
@@ -0,0 +1,26 @@
+All source code provided in this release of WebKit.NET is subject to the
+following licensing terms:
+
+Copyright (c) 2009, Peter Nelson (charn.opcode@gmail.com)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,22 @@
+WebKit.NET README
+*****************
+
+WebKit.NET is a control library wrapper for WebKit written in C#.
+
+Currently the source code is licensed under a BSD open source license, see
+LICENSE.txt for details.
+
+This package currently contains two Visual C# 2008 projects and a build of the
+WebKit library (including dependencies) in the following folders:
+
+ WebKitBrowser - WebKit.NET control library.
+
+ WebKitBrowserTest - A simple application that uses the WebKit.NET control
+ to display web pages.
+
+ webkit - The WebKit library and dependencies.
+
+The current releases are at a very early stage of development and are not
+recommended for production level use yet.
+
+Please send any questions or feedback to Peter Nelson at charn.opcode@gmail.com
@@ -0,0 +1,32 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebKitBrowser", "WebKitBrowser\WebKitBrowser.csproj", "{44AFE214-12C7-4280-898D-A7C4AABF1533}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebKitBrowserTest", "WebKitBrowserTest\WebKitBrowserTest.csproj", "{0F92D5BB-D2FC-42D5-8938-7A9D26BF3315}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9A0D75E0-65F8-4777-B5A0-B84937944551}"
+ ProjectSection(SolutionItems) = preProject
+ LICENSE.txt = LICENSE.txt
+ README.txt = README.txt
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {44AFE214-12C7-4280-898D-A7C4AABF1533}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {44AFE214-12C7-4280-898D-A7C4AABF1533}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {44AFE214-12C7-4280-898D-A7C4AABF1533}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {44AFE214-12C7-4280-898D-A7C4AABF1533}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0F92D5BB-D2FC-42D5-8938-7A9D26BF3315}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0F92D5BB-D2FC-42D5-8938-7A9D26BF3315}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0F92D5BB-D2FC-42D5-8938-7A9D26BF3315}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0F92D5BB-D2FC-42D5-8938-7A9D26BF3315}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2009, Peter Nelson (charn.opcode@gmail.com)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/// TODO:
+/// garbage collection / deinitialization
+/// support for manifest resource
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.InteropServices;
+using WebKit;
+
+namespace WebKit
+{
+ /// <summary>
+ /// A simple interface to the Windows Activation Context API.
+ /// </summary>
+ /// <remarks>
+ /// Activation context switching is required here to support registration
+ /// free COM interop. Ordinarily this can be achieved by embedding an
+ /// application manifest with mappings to COM objects in the assembly,
+ /// however this does not work in a class library. (TODO: verify this...)
+ /// Instead we create an activation context which explicitly loads a
+ /// manifest and activate this context when we need to create a COM object.
+ /// </remarks>
+ internal class ActivationContext
+ {
+ // Read-only state properties
+ public string ManifestFileName { get; private set; }
+ public bool Activated { get; private set; }
+ public bool Initialized { get; private set; }
+
+ // Private stuff...
+ private W32API.ACTCTX activationContext;
+ private IntPtr contextHandle;
+ private uint lastCookie;
+
+ /// <summary>
+ /// Constructor for ActivationContext.
+ /// </summary>
+ /// <param name="ManifestFileName">Path of the manifest file to load.</param>
+ public ActivationContext(string ManifestFileName)
+ {
+ this.ManifestFileName = ManifestFileName;
+ this.Activated = false;
+ this.Initialized = false;
+ }
+
+ /// <summary>
+ /// Activates the activation context.
+ /// </summary>
+ /// <returns>Success value.</returns>
+ public bool Activate()
+ {
+ if (!Initialized)
+ throw new InvalidOperationException("ActivationContext has not been initialized");
+ if (!Activated)
+ {
+ lastCookie = 0;
+ Activated = W32API.ActivateActCtx(contextHandle, out lastCookie);
+ }
+ return Activated;
+ }
+
+ /// <summary>
+ /// Deactivates the activation context, activating the next one down
+ /// on the 'stack'.
+ /// </summary>
+ /// <returns>Success value.</returns>
+ public bool Deactivate()
+ {
+ if (!Initialized)
+ throw new InvalidOperationException("ActivationContext has not been initialized");
+ if (Activated)
+ {
+ // TODO: Error handling?
+ W32API.DeactivateActCtx(0, lastCookie);
+ Activated = false;
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// Initializes the activation context.
+ /// </summary>
+ public void Initialize()
+ {
+ if (!Initialized)
+ {
+ activationContext = new W32API.ACTCTX();
+
+ activationContext.cbSize = Marshal.SizeOf(typeof(W32API.ACTCTX));
+ activationContext.lpSource = this.ManifestFileName;
+
+ contextHandle = W32API.CreateActCtx(ref activationContext);
+
+ Initialized = (contextHandle.ToInt32() != -1);
+ }
+ }
+ }
+}
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2009, Peter Nelson (charn.opcode@gmail.com)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+*/
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("WebKitBrowser")]
+[assembly: AssemblyDescription(".NET Wrapper for WebKit")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Peter Nelson")]
+[assembly: AssemblyProduct("WebKit.NET")]
+[assembly: AssemblyCopyright("Copyright © Peter Nelson 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("64a334d8-c2e8-483d-885c-bb1ffaa3a3b9")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.2.0.0")]
+[assembly: AssemblyFileVersion("0.2.0.0")]

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit efdd79f

Please sign in to comment.