<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170346] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170346">170346</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2014-06-23 22:45:54 -0700 (Mon, 23 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/170340">r170340</a> and <a href="http://trac.webkit.org/projects/webkit/changeset/170339">r170339</a>.

Changeset <a href="http://trac.webkit.org/projects/webkit/changeset/170339">r170339</a> broke the Apple Windows Debug and Release builds.

Reverted changesets:

&quot;[Win] Build fix after <a href="http://trac.webkit.org/projects/webkit/changeset/134209">r134209</a>&quot;
http://trac.webkit.org/changeset/170340

&quot;[Win] Clean up and refactor WinLauncher&quot;
https://bugs.webkit.org/show_bug.cgi?id=134209
http://trac.webkit.org/changeset/170339</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWinLauncherDOMDefaultImplh">trunk/Tools/WinLauncher/DOMDefaultImpl.h</a></li>
<li><a href="#trunkToolsWinLauncherWinLaunchercpp">trunk/Tools/WinLauncher/WinLauncher.cpp</a></li>
<li><a href="#trunkToolsWinLauncherWinLaunchervcxprojWinLauncherLibvcxproj">trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj</a></li>
<li><a href="#trunkToolsWinLauncherWinLaunchervcxprojWinLauncherLibvcxprojfilters">trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters</a></li>
<li><a href="#trunkToolsWinLauncherWinLauncherReplaceh">trunk/Tools/WinLauncher/WinLauncherReplace.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsWinLauncherWinLauncherh">trunk/Tools/WinLauncher/WinLauncher.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkToolsWinLauncherCommoncpp">trunk/Tools/WinLauncher/Common.cpp</a></li>
<li><a href="#trunkToolsWinLauncherDOMDefaultImplcpp">trunk/Tools/WinLauncher/DOMDefaultImpl.cpp</a></li>
<li><a href="#trunkToolsWinLauncherWinLauncherWebHostcpp">trunk/Tools/WinLauncher/WinLauncherWebHost.cpp</a></li>
<li><a href="#trunkToolsWinLauncherWinLauncherWebHosth">trunk/Tools/WinLauncher/WinLauncherWebHost.h</a></li>
<li><a href="#trunkToolsWinLauncherWinMaincpp">trunk/Tools/WinLauncher/WinMain.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/ChangeLog        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-06-23  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Rolling out r170340 and r170339.
+
+        Changeset r170339 broke the Apple Windows Debug and Release builds.
+
+        Reverted changesets:
+
+        &quot;[Win] Build fix after r134209&quot;
+        http://trac.webkit.org/changeset/170340
+
+        &quot;[Win] Clean up and refactor WinLauncher&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=134209
+        http://trac.webkit.org/changeset/170339
+
</ins><span class="cx"> 2014-06-23  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Build fix after r134209
</span></span></pre></div>
<a id="trunkToolsWinLauncherCommoncpp"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/WinLauncher/Common.cpp (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/Common.cpp        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/Common.cpp        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -1,490 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2008, 2013, 2014 Apple Inc.  All rights reserved.
- * Copyright (C) 2009, 2011 Brent Fulgham.  All rights reserved.
- * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
- * Copyright (C) 2013 Alex Christensen. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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 APPLE INC. ``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 APPLE INC. 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. 
- */
-
-#include &quot;AccessibilityDelegate.h&quot;
-#include &quot;DOMDefaultImpl.h&quot;
-#include &quot;PrintWebUIDelegate.h&quot;
-#include &quot;WinLauncher.h&quot;
-#include &quot;WinLauncherReplace.h&quot;
-#include &lt;WebKit/WebKitCOMAPI.h&gt;
-#include &lt;wtf/ExportMacros.h&gt;
-#include &lt;wtf/Platform.h&gt;
-
-#if USE(CF)
-#include &lt;CoreFoundation/CFRunLoop.h&gt;
-#endif
-
-#include &lt;cassert&gt;
-#include &lt;comip.h&gt;
-#include &lt;commctrl.h&gt;
-#include &lt;commdlg.h&gt;
-#include &lt;comutil.h&gt;
-#include &lt;dbghelp.h&gt;
-#include &lt;memory&gt;
-#include &lt;objbase.h&gt;
-#include &lt;shellapi.h&gt;
-#include &lt;shlobj.h&gt;
-#include &lt;shlwapi.h&gt;
-#include &lt;string&gt;
-#include &lt;vector&gt;
-#include &lt;wininet.h&gt;
-
-#define MAX_LOADSTRING 100
-#define URLBAR_HEIGHT  24
-#define CONTROLBUTTON_WIDTH 24
-
-static const int maxHistorySize = 10;
-
-typedef _com_ptr_t&lt;_com_IIID&lt;IWebFrame, &amp;__uuidof(IWebFrame)&gt;&gt; IWebFramePtr;
-typedef _com_ptr_t&lt;_com_IIID&lt;IWebMutableURLRequest, &amp;__uuidof(IWebMutableURLRequest)&gt;&gt; IWebMutableURLRequestPtr;
-typedef _com_ptr_t&lt;_com_IIID&lt;IWebCache, &amp;__uuidof(IWebCache)&gt;&gt; IWebCachePtr;
-
-// Global Variables:
-HINSTANCE hInst;
-HWND hMainWnd;
-HWND hURLBarWnd;
-HWND hBackButtonWnd;
-HWND hForwardButtonWnd;
-WNDPROC DefEditProc = nullptr;
-WNDPROC DefButtonProc = nullptr;
-WNDPROC DefWebKitProc = nullptr;
-HWND gViewWindow = 0;
-WinLauncher* gWinLauncher = nullptr;
-TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
-TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
-
-// Support moving the transparent window
-POINT s_windowPosition = { 100, 100 };
-SIZE s_windowSize = { 800, 400 };
-
-// Forward declarations of functions included in this code module:
-ATOM MyRegisterClass(HINSTANCE hInstance);
-LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
-INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK EditProc(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK BackButtonProc(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK ForwardButtonProc(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK ReloadButtonProc(HWND, UINT, WPARAM, LPARAM);
-
-static void loadURL(BSTR urlBStr);
-
-static void resizeSubViews()
-{
-    if (gWinLauncher-&gt;usesLayeredWebView() || !gViewWindow)
-        return;
-
-    RECT rcClient;
-    GetClientRect(hMainWnd, &amp;rcClient);
-    MoveWindow(hBackButtonWnd, 0, 0, CONTROLBUTTON_WIDTH, URLBAR_HEIGHT, TRUE);
-    MoveWindow(hForwardButtonWnd, CONTROLBUTTON_WIDTH, 0, CONTROLBUTTON_WIDTH, URLBAR_HEIGHT, TRUE);
-    MoveWindow(hURLBarWnd, CONTROLBUTTON_WIDTH * 2, 0, rcClient.right, URLBAR_HEIGHT, TRUE);
-    MoveWindow(gViewWindow, 0, URLBAR_HEIGHT, rcClient.right, rcClient.bottom - URLBAR_HEIGHT, TRUE);
-}
-
-static void subclassForLayeredWindow()
-{
-    hMainWnd = gViewWindow;
-#if defined _M_AMD64 || defined _WIN64
-    DefWebKitProc = reinterpret_cast&lt;WNDPROC&gt;(::GetWindowLongPtr(hMainWnd, GWLP_WNDPROC));
-    ::SetWindowLongPtr(hMainWnd, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(WndProc));
-#else
-    DefWebKitProc = reinterpret_cast&lt;WNDPROC&gt;(::GetWindowLong(hMainWnd, GWL_WNDPROC));
-    ::SetWindowLong(hMainWnd, GWL_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(WndProc));
-#endif
-}
-
-static void computeFullDesktopFrame()
-{
-    RECT desktop;
-    if (!::SystemParametersInfo(SPI_GETWORKAREA, 0, static_cast&lt;void*&gt;(&amp;desktop), 0))
-        return;
-
-    s_windowPosition.x = 0;
-    s_windowPosition.y = 0;
-    s_windowSize.cx = desktop.right - desktop.left;
-    s_windowSize.cy = desktop.bottom - desktop.top;
-}
-
-BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID)
-{
-    if (reason == DLL_PROCESS_ATTACH)
-        hInst = dllInstance;
-
-    return TRUE;
-}
-
-static bool getAppDataFolder(_bstr_t&amp; directory)
-{
-    wchar_t appDataDirectory[MAX_PATH];
-    if (FAILED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory)))
-        return false;
-
-    wchar_t executablePath[MAX_PATH];
-    ::GetModuleFileNameW(0, executablePath, MAX_PATH);
-    ::PathRemoveExtensionW(executablePath);
-
-    directory = _bstr_t(appDataDirectory) + L&quot;\\&quot; + ::PathFindFileNameW(executablePath);
-
-    return true;
-}
-
-static bool setCacheFolder()
-{
-    IWebCachePtr webCache;
-
-    HRESULT hr = WebKitCreateInstance(CLSID_WebCache, 0, __uuidof(webCache), reinterpret_cast&lt;void**&gt;(&amp;webCache.GetInterfacePtr()));
-    if (FAILED(hr))
-        return false;
-
-    _bstr_t appDataFolder;
-    if (!getAppDataFolder(appDataFolder))
-        return false;
-
-    appDataFolder += L&quot;\\cache&quot;;
-    webCache-&gt;setCacheFolder(appDataFolder);
-
-    return true;
-}
-
-void createCrashReport(EXCEPTION_POINTERS* exceptionPointers)
-{
-    _bstr_t directory;
-
-    if (!getAppDataFolder(directory))
-        return;
-
-    if (::SHCreateDirectoryEx(0, directory, 0) != ERROR_SUCCESS
-        &amp;&amp; ::GetLastError() != ERROR_FILE_EXISTS
-        &amp;&amp; ::GetLastError() != ERROR_ALREADY_EXISTS)
-        return;
-
-    std::wstring fileName = directory + L&quot;\\CrashReport.dmp&quot;;
-    HANDLE miniDumpFile = ::CreateFile(fileName.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
-
-    if (miniDumpFile &amp;&amp; miniDumpFile != INVALID_HANDLE_VALUE) {
-
-        MINIDUMP_EXCEPTION_INFORMATION mdei;
-        mdei.ThreadId = ::GetCurrentThreadId();
-        mdei.ExceptionPointers  = exceptionPointers;
-        mdei.ClientPointers = 0;
-
-#ifdef _DEBUG
-        MINIDUMP_TYPE dumpType = MiniDumpWithFullMemory;
-#else
-        MINIDUMP_TYPE dumpType = MiniDumpNormal;
-#endif
-
-        ::MiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(), miniDumpFile, dumpType, &amp;mdei, 0, 0);
-        ::CloseHandle(miniDumpFile);
-        processCrashReport(fileName.c_str());
-    }
-}
-
-static BOOL CALLBACK AbortProc(HDC hDC, int Error)
-{
-    MSG msg;
-    while (::PeekMessage(&amp;msg, 0, 0, 0, PM_REMOVE)) {
-        ::TranslateMessage(&amp;msg);
-        ::DispatchMessage(&amp;msg);
-    }
-
-    return TRUE;
-}
-
-static HDC getPrinterDC()
-{
-    PRINTDLG pdlg;
-    memset(&amp;pdlg, 0, sizeof(PRINTDLG));
-    pdlg.lStructSize = sizeof(PRINTDLG);
-    pdlg.Flags = PD_PRINTSETUP | PD_RETURNDC;
-
-    ::PrintDlg(&amp;pdlg);
-
-    return pdlg.hDC;
-}
-
-static void initDocStruct(DOCINFO* di, TCHAR* docname)
-{
-    memset(di, 0, sizeof(DOCINFO));
-    di-&gt;cbSize = sizeof(DOCINFO);
-    di-&gt;lpszDocName = docname;
-}
-
-typedef _com_ptr_t&lt;_com_IIID&lt;IWebFramePrivate, &amp;__uuidof(IWebFramePrivate)&gt;&gt; IWebFramePrivatePtr;
-
-void PrintView(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
-    HDC printDC = getPrinterDC();
-    if (!printDC) {
-        ::MessageBoxW(0, L&quot;Error creating printing DC&quot;, L&quot;Error&quot;, MB_APPLMODAL | MB_OK);
-        return;
-    }
-
-    if (::SetAbortProc(printDC, AbortProc) == SP_ERROR) {
-        ::MessageBoxW(0, L&quot;Error setting up AbortProc&quot;, L&quot;Error&quot;, MB_APPLMODAL | MB_OK);
-        return;
-    }
-
-    IWebFramePtr frame = gWinLauncher-&gt;mainFrame();
-    if (!frame)
-        return;
-
-    IWebFramePrivatePtr framePrivate;
-    if (FAILED(frame-&gt;QueryInterface(&amp;framePrivate.GetInterfacePtr())))
-        return;
-
-    framePrivate-&gt;setInPrintingMode(TRUE, printDC);
-
-    UINT pageCount = 0;
-    framePrivate-&gt;getPrintedPageCount(printDC, &amp;pageCount);
-
-    DOCINFO di;
-    initDocStruct(&amp;di, L&quot;WebKit Doc&quot;);
-    ::StartDoc(printDC, &amp;di);
-
-    // FIXME: Need CoreGraphics implementation
-    void* graphicsContext = 0;
-    for (size_t page = 1; page &lt;= pageCount; ++page) {
-        ::StartPage(printDC);
-        framePrivate-&gt;spoolPages(printDC, page, page, graphicsContext);
-        ::EndPage(printDC);
-    }
-
-    framePrivate-&gt;setInPrintingMode(FALSE, printDC);
-
-    ::EndDoc(printDC);
-    ::DeleteDC(printDC);
-}
-
-static void ToggleMenuItem(HWND hWnd, UINT menuID)
-{
-    HMENU menu = ::GetMenu(hWnd);
-
-    MENUITEMINFO info;
-    ::memset(&amp;info, 0x00, sizeof(info));
-    info.cbSize = sizeof(info);
-    info.fMask = MIIM_STATE;
-
-    if (!::GetMenuItemInfo(menu, menuID, FALSE, &amp;info))
-        return;
-
-    BOOL newState = !(info.fState &amp; MFS_CHECKED);
-
-    if (!gWinLauncher-&gt;standardPreferences() || !gWinLauncher-&gt;privatePreferences())
-        return;
-
-    switch (menuID) {
-    case IDM_AVFOUNDATION:
-        gWinLauncher-&gt;standardPreferences()-&gt;setAVFoundationEnabled(newState);
-        break;
-    case IDM_ACC_COMPOSITING:
-        gWinLauncher-&gt;privatePreferences()-&gt;setAcceleratedCompositingEnabled(newState);
-        break;
-    case IDM_WK_FULLSCREEN:
-        gWinLauncher-&gt;privatePreferences()-&gt;setFullScreenEnabled(newState);
-        break;
-    case IDM_COMPOSITING_BORDERS:
-        gWinLauncher-&gt;privatePreferences()-&gt;setShowDebugBorders(newState);
-        gWinLauncher-&gt;privatePreferences()-&gt;setShowRepaintCounter(newState);
-        break;
-    case IDM_DISABLE_IMAGES:
-        gWinLauncher-&gt;standardPreferences()-&gt;setLoadsImagesAutomatically(!newState);
-        break;
-    case IDM_DISABLE_STYLES:
-        gWinLauncher-&gt;privatePreferences()-&gt;setAuthorAndUserStylesEnabled(!newState);
-        break;
-    case IDM_DISABLE_JAVASCRIPT:
-        gWinLauncher-&gt;standardPreferences()-&gt;setJavaScriptEnabled(!newState);
-        break;
-    case IDM_DISABLE_LOCAL_FILE_RESTRICTIONS:
-        gWinLauncher-&gt;privatePreferences()-&gt;setAllowUniversalAccessFromFileURLs(newState);
-        gWinLauncher-&gt;privatePreferences()-&gt;setAllowFileAccessFromFileURLs(newState);
-        break;
-    }
-
-    info.fState = (newState) ? MFS_CHECKED : MFS_UNCHECKED;
-
-    ::SetMenuItemInfo(menu, menuID, FALSE, &amp;info);
-}
-
-static const int dragBarHeight = 30;
-
-LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
-    WNDPROC parentProc = (gWinLauncher) ? (gWinLauncher-&gt;usesLayeredWebView() ? DefWebKitProc : DefWindowProc) : DefWindowProc;
-
-    switch (message) {
-    case WM_NCHITTEST:
-        if (gWinLauncher &amp;&amp; gWinLauncher-&gt;usesLayeredWebView()) {
-            RECT window;
-            ::GetWindowRect(hWnd, &amp;window);
-            // For testing our transparent window, we need a region to use as a handle for
-            // dragging. The right way to do this would be to query the web view to see what's
-            // under the mouse. However, for testing purposes we just use an arbitrary
-            // 30 pixel band at the top of the view as an arbitrary gripping location.
-            //
-            // When we are within this bad, return HT_CAPTION to tell Windows we want to
-            // treat this region as if it were the title bar on a normal window.
-            int y = HIWORD(lParam);
-
-            if ((y &gt; window.top) &amp;&amp; (y &lt; window.top + dragBarHeight))
-                return HTCAPTION;
-        }
-        return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
-    case WM_COMMAND: {
-        int wmId = LOWORD(wParam);
-        int wmEvent = HIWORD(wParam);
-        if (wmId &gt;= IDM_HISTORY_LINK0 &amp;&amp; wmId &lt;= IDM_HISTORY_LINK9) {
-            if (gWinLauncher)
-                gWinLauncher-&gt;navigateToHistory(hWnd, wmId);
-            break;
-        }
-        // Parse the menu selections:
-        switch (wmId) {
-        case IDM_ABOUT:
-            DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
-            break;
-        case IDM_EXIT:
-            DestroyWindow(hWnd);
-            break;
-        case IDM_PRINT:
-            PrintView(hWnd, message, wParam, lParam);
-            break;
-        case IDM_WEB_INSPECTOR:
-            if (gWinLauncher)
-                gWinLauncher-&gt;launchInspector();
-            break;
-        case IDM_HISTORY_BACKWARD:
-        case IDM_HISTORY_FORWARD:
-            if (gWinLauncher)
-                gWinLauncher-&gt;navigateForwardOrBackward(hWnd, wmId);
-            break;
-        case IDM_AVFOUNDATION:
-        case IDM_ACC_COMPOSITING:
-        case IDM_WK_FULLSCREEN:
-        case IDM_COMPOSITING_BORDERS:
-        case IDM_DISABLE_IMAGES:
-        case IDM_DISABLE_STYLES:
-        case IDM_DISABLE_JAVASCRIPT:
-        case IDM_DISABLE_LOCAL_FILE_RESTRICTIONS:
-            ToggleMenuItem(hWnd, wmId);
-            break;
-        default:
-            return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
-        }
-        }
-        break;
-    case WM_DESTROY:
-#if USE(CF)
-        CFRunLoopStop(CFRunLoopGetMain());
-#endif
-        PostQuitMessage(0);
-        break;
-    case WM_SIZE:
-        if (!gWinLauncher || !gWinLauncher-&gt;hasWebView() || gWinLauncher-&gt;usesLayeredWebView())
-            return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
-
-        resizeSubViews();
-        break;
-    default:
-        return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
-    }
-
-    return 0;
-}
-
-LRESULT CALLBACK EditProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
-    switch (message) {
-    case WM_CHAR:
-        if (wParam == 13) { // Enter Key
-            wchar_t strPtr[INTERNET_MAX_URL_LENGTH];
-            *((LPWORD)strPtr) = INTERNET_MAX_URL_LENGTH; 
-            int strLen = SendMessage(hDlg, EM_GETLINE, 0, (LPARAM)strPtr);
-
-            strPtr[strLen] = 0;
-            _bstr_t bstr(strPtr);
-            loadURL(bstr.GetBSTR());
-
-            return 0;
-        } 
-    default:
-        return CallWindowProc(DefEditProc, hDlg, message, wParam, lParam);
-    }
-}
-
-LRESULT CALLBACK BackButtonProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
-    switch (message) {
-    case WM_LBUTTONUP:
-        gWinLauncher-&gt;goBack();
-    default:
-        return CallWindowProc(DefButtonProc, hDlg, message, wParam, lParam);
-    }
-}
-
-LRESULT CALLBACK ForwardButtonProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
-    switch (message) {
-    case WM_LBUTTONUP:
-        gWinLauncher-&gt;goForward();
-    default:
-        return CallWindowProc(DefButtonProc, hDlg, message, wParam, lParam);
-    }
-}
-
-// Message handler for about box.
-INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
-    UNREFERENCED_PARAMETER(lParam);
-    switch (message) {
-    case WM_INITDIALOG:
-        return (INT_PTR)TRUE;
-
-    case WM_COMMAND:
-        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
-            EndDialog(hDlg, LOWORD(wParam));
-            return (INT_PTR)TRUE;
-        }
-        break;
-    }
-    return (INT_PTR)FALSE;
-}
-
-static void loadURL(BSTR passedURL)
-{
-    if (FAILED(gWinLauncher-&gt;loadURL(passedURL)))
-        return;
-
-    SetFocus(gViewWindow);
-}
-
-extern &quot;C&quot; __declspec(dllexport) int WINAPI dllLauncherEntryPoint(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpstrCmdLine, int nCmdShow)
-{
-    return wWinMain(hInstance, hPrevInstance, lpstrCmdLine, nCmdShow);
-}
</del></span></pre></div>
<a id="trunkToolsWinLauncherDOMDefaultImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/WinLauncher/DOMDefaultImpl.cpp (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/DOMDefaultImpl.cpp        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/DOMDefaultImpl.cpp        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -1,95 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All Rights Reserved.
- * Copyright (C) 2011 Anthony Johnson. All Rights Reserved.
- * Copyright (C) 2011 Brent Fulgham. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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 APPLE INC. ``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 APPLE INC. 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. 
- */
-
-#include &quot;stdafx.h&quot;
-#include &quot;DOMDefaultImpl.h&quot;
-
-// IUnknown -------------------------------------------------------------------
-HRESULT WebScriptObject::QueryInterface(REFIID riid, void** ppvObject)
-{
-    *ppvObject = 0;
-    if (IsEqualGUID(riid, IID_IUnknown))
-        *ppvObject = static_cast&lt;IWebScriptObject*&gt;(this);
-    else if (IsEqualGUID(riid, IID_IWebScriptObject))
-        *ppvObject = static_cast&lt;IWebScriptObject*&gt;(this);
-    else
-        return E_NOINTERFACE;
-
-    AddRef();
-    return S_OK;
-}
-
-ULONG WebScriptObject::AddRef(void)
-{
-    return ++m_refCount;
-}
-
-ULONG WebScriptObject::Release(void)
-{
-    ULONG newRef = --m_refCount;
-    if (!newRef)
-        delete(this);
-
-    return newRef;
-}
-
-// DOMObject -------------------------------------------------------------------
-HRESULT DOMObject::QueryInterface(REFIID riid, void** ppvObject)
-{
-    *ppvObject = 0;
-    if (IsEqualGUID(riid, IID_IDOMObject))
-        *ppvObject = static_cast&lt;IDOMObject*&gt;(this);
-    else
-        return WebScriptObject::QueryInterface(riid, ppvObject);
-
-    WebScriptObject::AddRef();
-    return S_OK;
-}
-
-
-// DOMEventListener -------------------------------------------------------------------
-HRESULT DOMEventListener::QueryInterface(const IID &amp;riid, void** ppvObject)
-{
-    *ppvObject = 0;
-    if (IsEqualGUID(riid, IID_IDOMEventListener))
-        *ppvObject = static_cast&lt;IDOMEventListener*&gt;(this);
-    else
-        return DOMObject::QueryInterface(riid, ppvObject);
-
-    AddRef();
-    return S_OK;
-}
-
-ULONG DOMEventListener::AddRef(void)
-{
-    return WebScriptObject::AddRef();
-}
-
-ULONG DOMEventListener::Release(void)
-{
-    return WebScriptObject::Release();
-}
</del></span></pre></div>
<a id="trunkToolsWinLauncherDOMDefaultImplh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/DOMDefaultImpl.h (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/DOMDefaultImpl.h        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/DOMDefaultImpl.h        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -87,4 +87,70 @@
</span><span class="cx">     virtual HRESULT STDMETHODCALLTYPE handleEvent(IDOMEvent*) { return E_NOTIMPL; }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+// IUnknown -------------------------------------------------------------------
+HRESULT WebScriptObject::QueryInterface(REFIID riid, void** ppvObject)
+{
+    *ppvObject = 0;
+    if (IsEqualGUID(riid, IID_IUnknown))
+        *ppvObject = static_cast&lt;IWebScriptObject*&gt;(this);
+    else if (IsEqualGUID(riid, IID_IWebScriptObject))
+        *ppvObject = static_cast&lt;IWebScriptObject*&gt;(this);
+    else
+        return E_NOINTERFACE;
+
+    AddRef();
+    return S_OK;
+}
+
+ULONG WebScriptObject::AddRef(void)
+{
+    return ++m_refCount;
+}
+
+ULONG WebScriptObject::Release(void)
+{
+    ULONG newRef = --m_refCount;
+    if (!newRef)
+        delete(this);
+
+    return newRef;
+}
+
+// DOMObject -------------------------------------------------------------------
+HRESULT DOMObject::QueryInterface(REFIID riid, void** ppvObject)
+{
+    *ppvObject = 0;
+    if (IsEqualGUID(riid, IID_IDOMObject))
+        *ppvObject = static_cast&lt;IDOMObject*&gt;(this);
+    else
+        return WebScriptObject::QueryInterface(riid, ppvObject);
+
+    WebScriptObject::AddRef();
+    return S_OK;
+}
+
+
+// DOMEventListener -------------------------------------------------------------------
+HRESULT DOMEventListener::QueryInterface(const IID &amp;riid, void** ppvObject)
+{
+    *ppvObject = 0;
+    if (IsEqualGUID(riid, IID_IDOMEventListener))
+        *ppvObject = static_cast&lt;IDOMEventListener*&gt;(this);
+    else
+        return DOMObject::QueryInterface(riid, ppvObject);
+
+    AddRef();
+    return S_OK;
+}
+
+ULONG DOMEventListener::AddRef(void)
+{
+    return WebScriptObject::AddRef();
+}
+
+ULONG DOMEventListener::Release(void)
+{
+    return WebScriptObject::Release();
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsWinLauncherWinLaunchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncher.cpp (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.cpp        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/WinLauncher.cpp        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2008, 2013, 2014 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2008, 2013 Apple Inc.  All rights reserved.
</ins><span class="cx">  * Copyright (C) 2009, 2011 Brent Fulgham.  All rights reserved.
</span><span class="cx">  * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 Alex Christensen. All rights reserved.
</span><span class="lines">@@ -29,7 +29,9 @@
</span><span class="cx"> #include &quot;stdafx.h&quot;
</span><span class="cx"> #include &quot;WinLauncher.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;AccessibilityDelegate.h&quot;
</ins><span class="cx"> #include &quot;DOMDefaultImpl.h&quot;
</span><ins>+#include &quot;PrintWebUIDelegate.h&quot;
</ins><span class="cx"> #include &quot;WinLauncherLibResource.h&quot;
</span><span class="cx"> #include &quot;WinLauncherReplace.h&quot;
</span><span class="cx"> #include &lt;WebKit/WebKitCOMAPI.h&gt;
</span><span class="lines">@@ -40,143 +42,191 @@
</span><span class="cx"> #include &lt;CoreFoundation/CFRunLoop.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if USE(GLIB)
+#include &lt;glib.h&gt;
+#endif
+
</ins><span class="cx"> #include &lt;algorithm&gt;
</span><del>-#include &lt;cassert&gt;
</del><ins>+#include &lt;assert.h&gt;
+#include &lt;comip.h&gt;
+#include &lt;commctrl.h&gt;
+#include &lt;commdlg.h&gt;
+#include &lt;comutil.h&gt;
+#include &lt;dbghelp.h&gt;
</ins><span class="cx"> #include &lt;functional&gt;
</span><del>-#include &lt;memory&gt;
</del><ins>+#include &lt;objbase.h&gt;
+#include &lt;shellapi.h&gt;
+#include &lt;shlobj.h&gt;
+#include &lt;shlwapi.h&gt;
</ins><span class="cx"> #include &lt;string&gt;
</span><span class="cx"> #include &lt;vector&gt;
</span><ins>+#include &lt;wininet.h&gt;
</ins><span class="cx"> 
</span><ins>+#define MAX_LOADSTRING 100
+#define URLBAR_HEIGHT  24
+#define CONTROLBUTTON_WIDTH 24
+
</ins><span class="cx"> static const int maxHistorySize = 10;
</span><span class="cx"> 
</span><ins>+typedef _com_ptr_t&lt;_com_IIID&lt;IWebFrame, &amp;__uuidof(IWebFrame)&gt;&gt; IWebFramePtr;
+typedef _com_ptr_t&lt;_com_IIID&lt;IWebHistory, &amp;__uuidof(IWebHistory)&gt;&gt; IWebHistoryPtr;
+typedef _com_ptr_t&lt;_com_IIID&lt;IWebHistoryItem, &amp;__uuidof(IWebHistoryItem)&gt;&gt; IWebHistoryItemPtr;
+typedef _com_ptr_t&lt;_com_IIID&lt;IWebInspector, &amp;__uuidof(IWebInspector)&gt;&gt; IWebInspectorPtr;
</ins><span class="cx"> typedef _com_ptr_t&lt;_com_IIID&lt;IWebMutableURLRequest, &amp;__uuidof(IWebMutableURLRequest)&gt;&gt; IWebMutableURLRequestPtr;
</span><ins>+typedef _com_ptr_t&lt;_com_IIID&lt;IWebPreferences, &amp;__uuidof(IWebPreferences)&gt;&gt; IWebPreferencesPtr;
+typedef _com_ptr_t&lt;_com_IIID&lt;IWebPreferencesPrivate, &amp;__uuidof(IWebPreferencesPrivate)&gt;&gt; IWebPreferencesPrivatePtr;
+typedef _com_ptr_t&lt;_com_IIID&lt;IWebView, &amp;__uuidof(IWebView)&gt;&gt; IWebViewPtr;
+typedef _com_ptr_t&lt;_com_IIID&lt;IWebViewPrivate, &amp;__uuidof(IWebViewPrivate)&gt;&gt; IWebViewPrivatePtr;
</ins><span class="cx"> typedef _com_ptr_t&lt;_com_IIID&lt;IWebCache, &amp;__uuidof(IWebCache)&gt;&gt; IWebCachePtr;
</span><span class="cx"> 
</span><del>-WinLauncher::WinLauncher(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView)
-    : m_hMainWnd(mainWnd)
-    , m_hURLBarWnd(urlBarWnd)
-    , m_useLayeredWebView(useLayeredWebView)
-{
-}
</del><ins>+// Global Variables:
+HINSTANCE hInst;                                // current instance
+HWND hMainWnd;
+HWND hURLBarWnd;
+HWND hBackButtonWnd;
+HWND hForwardButtonWnd;
+WNDPROC DefEditProc = 0;
+WNDPROC DefButtonProc = 0;
+WNDPROC DefWebKitProc = 0;
+IWebInspectorPtr gInspector;
+IWebViewPtr gWebView;
+IWebViewPrivatePtr gWebViewPrivate;
+IWebPreferencesPtr gStandardPreferences;
+IWebPreferencesPrivatePtr gPrefsPrivate;
+HWND gViewWindow = 0;
+WinLauncherWebHost* gWebHost = 0;
+PrintWebUIDelegate* gPrintDelegate = 0;
+AccessibilityDelegate* gAccessibilityDelegate = 0;
+IWebHistoryPtr gWebHistory;
+std::vector&lt;IWebHistoryItemPtr&gt; gHistoryItems;
+TCHAR szTitle[MAX_LOADSTRING];                    // The title bar text
+TCHAR szWindowClass[MAX_LOADSTRING];            // the main window class name
</ins><span class="cx"> 
</span><del>-HRESULT WinLauncher::init()
-{
-    HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, reinterpret_cast&lt;void**&gt;(&amp;m_webView.GetInterfacePtr()));
-    if (FAILED(hr))
-        return hr;
</del><ins>+// Support moving the transparent window
+POINT s_windowPosition = { 100, 100 };
+SIZE s_windowSize = { 800, 400 };
+bool s_usesLayeredWebView = false;
+bool s_fullDesktop = false;
</ins><span class="cx"> 
</span><del>-    hr = m_webView-&gt;QueryInterface(IID_IWebViewPrivate, reinterpret_cast&lt;void**&gt;(&amp;m_webViewPrivate.GetInterfacePtr()));
-    if (FAILED(hr))
-        return hr;
</del><ins>+// Forward declarations of functions included in this code module:
+ATOM                MyRegisterClass(HINSTANCE hInstance);
+LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK    EditProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK    BackButtonProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK    ForwardButtonProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK    ReloadButtonProc(HWND, UINT, WPARAM, LPARAM);
</ins><span class="cx"> 
</span><del>-    hr = WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(m_webHistory), reinterpret_cast&lt;void**&gt;(&amp;m_webHistory.GetInterfacePtr()));
</del><ins>+static void loadURL(BSTR urlBStr);
</ins><span class="cx"> 
</span><del>-    return hr;
</del><ins>+static bool usesLayeredWebView()
+{
+    return s_usesLayeredWebView;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-HRESULT WinLauncher::prepareViews(HWND mainWnd, const RECT&amp; clientRect, const BSTR&amp; requestedURL, HWND&amp; viewHwnd)
</del><ins>+static bool shouldUseFullDesktop()
</ins><span class="cx"> {
</span><del>-    if (!m_webView)
-        return E_FAIL;
</del><ins>+    return s_fullDesktop;
+}
</ins><span class="cx"> 
</span><del>-    HRESULT hr = m_webView-&gt;setHostWindow(reinterpret_cast&lt;OLE_HANDLE&gt;(mainWnd));
-    if (FAILED(hr))
-        return hr;
</del><ins>+class SimpleEventListener : public DOMEventListener {
+public:
+    SimpleEventListener(LPWSTR type)
+    {
+        wcsncpy_s(m_eventType, 100, type, 100);
+        m_eventType[99] = 0;
+    }
</ins><span class="cx"> 
</span><del>-    hr = m_webView-&gt;initWithFrame(clientRect, 0, 0);
-    if (FAILED(hr))
-        return hr;
</del><ins>+    virtual HRESULT STDMETHODCALLTYPE handleEvent(IDOMEvent* evt)
+    {
+        wchar_t message[255];
+        wcscpy_s(message, 255, m_eventType);
+        wcscat_s(message, 255, L&quot; event fired!&quot;);
+        ::MessageBox(0, message, L&quot;Event Handler&quot;, MB_OK);
+        return S_OK;
+    }
</ins><span class="cx"> 
</span><del>-    if (!requestedURL) {
-        IWebFramePtr frame;
-        hr = m_webView-&gt;mainFrame(&amp;frame.GetInterfacePtr());
-        if (FAILED(hr))
-            return hr;
</del><ins>+private:
+    wchar_t m_eventType[100];
+};
</ins><span class="cx"> 
</span><del>-        frame-&gt;loadHTMLString(_bstr_t(defaultHTML).GetBSTR(), 0);
-    }
</del><ins>+typedef _com_ptr_t&lt;_com_IIID&lt;IWebDataSource, &amp;__uuidof(IWebDataSource)&gt;&gt; IWebDataSourcePtr;
</ins><span class="cx"> 
</span><del>-    hr = m_webViewPrivate-&gt;setTransparent(m_useLayeredWebView);
</del><ins>+HRESULT WinLauncherWebHost::updateAddressBar(IWebView* webView)
+{
+    IWebFramePtr mainFrame;
+    HRESULT hr = webView-&gt;mainFrame(&amp;mainFrame.GetInterfacePtr());
</ins><span class="cx">     if (FAILED(hr))
</span><del>-        return hr;
</del><ins>+        return 0;
</ins><span class="cx"> 
</span><del>-    hr = m_webViewPrivate-&gt;setUsesLayeredWindow(m_useLayeredWebView);
</del><ins>+    IWebDataSourcePtr dataSource;
+    hr = mainFrame-&gt;dataSource(&amp;dataSource.GetInterfacePtr());
+    if (FAILED(hr) || !dataSource)
+        hr = mainFrame-&gt;provisionalDataSource(&amp;dataSource.GetInterfacePtr());
+    if (FAILED(hr) || !dataSource)
+        return 0;
+
+    IWebMutableURLRequestPtr request;
+    hr = dataSource-&gt;request(&amp;request.GetInterfacePtr());
+    if (FAILED(hr) || !request)
+        return 0;
+
+    _bstr_t frameURL;
+    hr = request-&gt;mainDocumentURL(frameURL.GetAddress());
</ins><span class="cx">     if (FAILED(hr))
</span><del>-        return hr;
</del><ins>+        return 0;
</ins><span class="cx"> 
</span><del>-    hr = m_webViewPrivate-&gt;viewWindow(reinterpret_cast&lt;OLE_HANDLE*&gt;(&amp;viewHwnd));
</del><ins>+    ::SendMessage(hURLBarWnd, static_cast&lt;UINT&gt;(WM_SETTEXT), 0, reinterpret_cast&lt;LPARAM&gt;(frameURL.GetBSTR()));
</ins><span class="cx"> 
</span><del>-    return hr;
</del><ins>+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-HRESULT WinLauncher::setFrameLoadDelegate(IWebFrameLoadDelegate* frameLoadDelegate)
</del><ins>+HRESULT WinLauncherWebHost::didFailProvisionalLoadWithError(IWebView*, IWebError *error, IWebFrame*)
</ins><span class="cx"> {
</span><del>-    m_frameLoadDelegate = frameLoadDelegate;
-    return m_webView-&gt;setFrameLoadDelegate(frameLoadDelegate);
-}
</del><ins>+    _bstr_t errorDescription;
+    HRESULT hr = error-&gt;localizedDescription(errorDescription.GetAddress());
+    if (FAILED(hr))
+        errorDescription = L&quot;Failed to load page and to localize error description.&quot;;
</ins><span class="cx"> 
</span><del>-HRESULT WinLauncher::setUIDelegate(IWebUIDelegate* uiDelegate)
-{
-    m_uiDelegate = uiDelegate;
-    return m_webView-&gt;setUIDelegate(uiDelegate);
</del><ins>+    if (_wcsicmp(errorDescription, L&quot;Cancelled&quot;))
+        ::MessageBoxW(0, static_cast&lt;LPCWSTR&gt;(errorDescription), L&quot;Error&quot;, MB_APPLMODAL | MB_OK);
+
+    return S_OK;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-HRESULT WinLauncher::setAccessibilityDelegate(IAccessibilityDelegate* accessibilityDelegate)
</del><ins>+HRESULT STDMETHODCALLTYPE WinLauncherWebHost::QueryInterface(REFIID riid, void** ppvObject)
</ins><span class="cx"> {
</span><del>-    m_accessibilityDelegate = accessibilityDelegate;
-    return m_webView-&gt;setAccessibilityDelegate(accessibilityDelegate);
-}
</del><ins>+    *ppvObject = 0;
+    if (IsEqualGUID(riid, IID_IUnknown))
+        *ppvObject = static_cast&lt;IWebFrameLoadDelegate*&gt;(this);
+    else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate))
+        *ppvObject = static_cast&lt;IWebFrameLoadDelegate*&gt;(this);
+    else
+        return E_NOINTERFACE;
</ins><span class="cx"> 
</span><del>-IWebFramePtr WinLauncher::mainFrame()
-{
-    IWebFramePtr framePtr;
-    m_webView-&gt;mainFrame(&amp;framePtr.GetInterfacePtr());
-    return framePtr;
</del><ins>+    AddRef();
+    return S_OK;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WinLauncher::seedInitialDefaultPreferences()
</del><ins>+ULONG STDMETHODCALLTYPE WinLauncherWebHost::AddRef(void)
</ins><span class="cx"> {
</span><del>-    IWebPreferencesPtr tmpPreferences;
-    if (FAILED(WebKitCreateInstance(CLSID_WebPreferences, 0, IID_IWebPreferences, reinterpret_cast&lt;void**&gt;(&amp;tmpPreferences.GetInterfacePtr()))))
-        return false;
-
-    if (FAILED(tmpPreferences-&gt;standardPreferences(&amp;m_standardPreferences.GetInterfacePtr())))
-        return false;
-
-    return true;
</del><ins>+    return ++m_refCount;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WinLauncher::setToDefaultPreferences()
</del><ins>+ULONG STDMETHODCALLTYPE WinLauncherWebHost::Release(void)
</ins><span class="cx"> {
</span><del>-    HRESULT hr = m_standardPreferences-&gt;QueryInterface(IID_IWebPreferencesPrivate, reinterpret_cast&lt;void**&gt;(&amp;m_prefsPrivate.GetInterfacePtr()));
-    if (!SUCCEEDED(hr))
-        return false;
</del><ins>+    ULONG newRef = --m_refCount;
+    if (!newRef)
+        delete(this);
</ins><span class="cx"> 
</span><del>-#if USE(CG)
-    m_standardPreferences-&gt;setAVFoundationEnabled(TRUE);
-    m_prefsPrivate-&gt;setAcceleratedCompositingEnabled(TRUE);
-#endif
-
-    m_prefsPrivate-&gt;setFullScreenEnabled(TRUE);
-    m_prefsPrivate-&gt;setShowDebugBorders(FALSE);
-    m_prefsPrivate-&gt;setShowRepaintCounter(FALSE);
-
-    m_standardPreferences-&gt;setLoadsImagesAutomatically(TRUE);
-    m_prefsPrivate-&gt;setAuthorAndUserStylesEnabled(TRUE);
-    m_standardPreferences-&gt;setJavaScriptEnabled(TRUE);
-    m_prefsPrivate-&gt;setAllowUniversalAccessFromFileURLs(FALSE);
-    m_prefsPrivate-&gt;setAllowFileAccessFromFileURLs(TRUE);
-
-    m_prefsPrivate-&gt;setDeveloperExtrasEnabled(TRUE);
-
-    return true;
</del><ins>+    return newRef;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void updateMenuItemForHistoryItem(HMENU menu, IWebHistoryItem&amp; historyItem, int currentHistoryItem)
</span><span class="cx"> {
</span><span class="cx">     UINT menuID = IDM_HISTORY_LINK0 + currentHistoryItem;
</span><span class="cx"> 
</span><del>-    MENUITEMINFO menuItemInfo = { 0 };
</del><ins>+    MENUITEMINFO menuItemInfo = {0};
</ins><span class="cx">     menuItemInfo.cbSize = sizeof(MENUITEMINFO);
</span><span class="cx">     menuItemInfo.fMask = MIIM_TYPE;
</span><span class="cx">     menuItemInfo.fType = MFT_STRING;
</span><span class="lines">@@ -189,9 +239,9 @@
</span><span class="cx">     ::EnableMenuItem(menu, menuID, MF_BYCOMMAND | MF_ENABLED);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WinLauncher::showLastVisitedSites(IWebView&amp; webView)
</del><ins>+static void showLastVisitedSites(IWebView&amp; webView)
</ins><span class="cx"> {
</span><del>-    HMENU menu = ::GetMenu(m_hMainWnd);
</del><ins>+    HMENU menu = ::GetMenu(hMainWnd);
</ins><span class="cx"> 
</span><span class="cx">     _com_ptr_t&lt;_com_IIID&lt;IWebBackForwardList, &amp;__uuidof(IWebBackForwardList)&gt;&gt; backForwardList;
</span><span class="cx">     HRESULT hr = webView.backForwardList(&amp;backForwardList.GetInterfacePtr());
</span><span class="lines">@@ -224,12 +274,12 @@
</span><span class="cx">     if (FAILED(hr))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    hr = m_webHistory-&gt;addItems(1, &amp;currentItem.GetInterfacePtr());
</del><ins>+    hr = gWebHistory-&gt;addItems(1, &amp;currentItem.GetInterfacePtr());
</ins><span class="cx">     if (FAILED(hr))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     _com_ptr_t&lt;_com_IIID&lt;IWebHistoryPrivate, &amp;__uuidof(IWebHistoryPrivate)&gt;&gt; webHistory;
</span><del>-    hr = m_webHistory-&gt;QueryInterface(IID_IWebHistoryPrivate, reinterpret_cast&lt;void**&gt;(&amp;webHistory.GetInterfacePtr()));
</del><ins>+    hr = gWebHistory-&gt;QueryInterface(IID_IWebHistoryPrivate, reinterpret_cast&lt;void**&gt;(&amp;webHistory.GetInterfacePtr()));
</ins><span class="cx">     if (FAILED(hr))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -238,7 +288,7 @@
</span><span class="cx">     if (FAILED(hr))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_historyItems.resize(totalListCount);
</del><ins>+    gHistoryItems.resize(totalListCount);
</ins><span class="cx"> 
</span><span class="cx">     std::vector&lt;IWebHistoryItem*&gt; historyToLoad(totalListCount);
</span><span class="cx">     hr = webHistory-&gt;allItems(&amp;totalListCount, historyToLoad.data());
</span><span class="lines">@@ -246,8 +296,8 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     size_t i = 0;
</span><del>-    for (auto&amp; cur : historyToLoad) {
-        m_historyItems[i].Attach(cur);
</del><ins>+    for (auto cur = historyToLoad.begin(); cur != historyToLoad.end(); ++cur) {
+        gHistoryItems[i].Attach(*cur);
</ins><span class="cx">         ++i;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -257,7 +307,7 @@
</span><span class="cx"> 
</span><span class="cx">     int currentHistoryItem = 0;
</span><span class="cx">     for (int i = 0; i &lt; totalListCount; ++i) {
</span><del>-        updateMenuItemForHistoryItem(menu, *(m_historyItems[allItemsOffset + currentHistoryItem]), currentHistoryItem);
</del><ins>+        updateMenuItemForHistoryItem(menu, *(gHistoryItems[allItemsOffset + currentHistoryItem]), currentHistoryItem);
</ins><span class="cx">         ++currentHistoryItem;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -266,96 +316,737 @@
</span><span class="cx">         ::EnableMenuItem(menu, IDM_HISTORY_LINK0 + i, MF_BYCOMMAND | MF_DISABLED);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WinLauncher::launchInspector()
</del><ins>+typedef _com_ptr_t&lt;_com_IIID&lt;IDOMDocument, &amp;__uuidof(IDOMDocument)&gt;&gt; IDOMDocumentPtr;
+typedef _com_ptr_t&lt;_com_IIID&lt;IDOMElement, &amp;__uuidof(IDOMElement)&gt;&gt; IDOMElementPtr;
+typedef _com_ptr_t&lt;_com_IIID&lt;IDOMEventTarget, &amp;__uuidof(IDOMEventTarget)&gt;&gt; IDOMEventTargetPtr;
+
+HRESULT WinLauncherWebHost::didFinishLoadForFrame(IWebView* webView, IWebFrame* frame)
</ins><span class="cx"> {
</span><del>-    if (!m_webViewPrivate)
</del><ins>+    IDOMDocumentPtr doc;
+    frame-&gt;DOMDocument(&amp;doc.GetInterfacePtr());
+
+    IDOMElementPtr element;
+    IDOMEventTargetPtr target;
+
+    showLastVisitedSites(*webView);
+
+    // The following is for the test page:
+    HRESULT hr = doc-&gt;getElementById(L&quot;webkit logo&quot;, &amp;element.GetInterfacePtr());
+    if (!SUCCEEDED(hr))
+        return hr;
+
+    hr = element-&gt;QueryInterface(IID_IDOMEventTarget, reinterpret_cast&lt;void**&gt;(&amp;target.GetInterfacePtr()));
+    if (!SUCCEEDED(hr))
+        return hr;
+
+    hr = target-&gt;addEventListener(L&quot;click&quot;, new SimpleEventListener (L&quot;webkit logo click&quot;), FALSE);
+    if (!SUCCEEDED(hr))
+        return hr;
+
+    return hr;
+}
+
+static void resizeSubViews()
+{
+    if (usesLayeredWebView() || !gViewWindow)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (!SUCCEEDED(m_webViewPrivate-&gt;inspector(&amp;m_inspector.GetInterfacePtr())))
</del><ins>+    RECT rcClient;
+    GetClientRect(hMainWnd, &amp;rcClient);
+    MoveWindow(hBackButtonWnd, 0, 0, CONTROLBUTTON_WIDTH, URLBAR_HEIGHT, TRUE);
+    MoveWindow(hForwardButtonWnd, CONTROLBUTTON_WIDTH, 0, CONTROLBUTTON_WIDTH, URLBAR_HEIGHT, TRUE);
+    MoveWindow(hURLBarWnd, CONTROLBUTTON_WIDTH * 2, 0, rcClient.right, URLBAR_HEIGHT, TRUE);
+    MoveWindow(gViewWindow, 0, URLBAR_HEIGHT, rcClient.right, rcClient.bottom - URLBAR_HEIGHT, TRUE);
+}
+
+static void subclassForLayeredWindow()
+{
+    hMainWnd = gViewWindow;
+#if defined _M_AMD64 || defined _WIN64
+    DefWebKitProc = reinterpret_cast&lt;WNDPROC&gt;(::GetWindowLongPtr(hMainWnd, GWLP_WNDPROC));
+    ::SetWindowLongPtr(hMainWnd, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(WndProc));
+#else
+    DefWebKitProc = reinterpret_cast&lt;WNDPROC&gt;(::GetWindowLong(hMainWnd, GWL_WNDPROC));
+    ::SetWindowLong(hMainWnd, GWL_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(WndProc));
+#endif
+}
+
+static void computeFullDesktopFrame()
+{
+    RECT desktop;
+    if (!::SystemParametersInfo(SPI_GETWORKAREA, 0, static_cast&lt;void*&gt;(&amp;desktop), 0))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_inspector-&gt;show();
</del><ins>+    s_windowPosition.x = 0;
+    s_windowPosition.y = 0;
+    s_windowSize.cx = desktop.right - desktop.left;
+    s_windowSize.cy = desktop.bottom - desktop.top;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WinLauncher::navigateForwardOrBackward(HWND hWnd, UINT menuID)
</del><ins>+BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID)
</ins><span class="cx"> {
</span><del>-    if (!m_webView)
</del><ins>+    if (reason == DLL_PROCESS_ATTACH)
+        hInst = dllInstance;
+
+    return TRUE;
+}
+
+static bool getAppDataFolder(_bstr_t&amp; directory)
+{
+    wchar_t appDataDirectory[MAX_PATH];
+    if (FAILED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory)))
+        return false;
+
+    wchar_t executablePath[MAX_PATH];
+    ::GetModuleFileNameW(0, executablePath, MAX_PATH);
+    ::PathRemoveExtensionW(executablePath);
+
+    directory = _bstr_t(appDataDirectory) + L&quot;\\&quot; + ::PathFindFileNameW(executablePath);
+
+    return true;
+}
+
+static bool setToDefaultPreferences()
+{
+    HRESULT hr = gStandardPreferences-&gt;QueryInterface(IID_IWebPreferencesPrivate, reinterpret_cast&lt;void**&gt;(&amp;gPrefsPrivate.GetInterfacePtr()));
+    if (!SUCCEEDED(hr))
+        return false;
+
+#if USE(CG)
+    gStandardPreferences-&gt;setAVFoundationEnabled(TRUE);
+    gPrefsPrivate-&gt;setAcceleratedCompositingEnabled(TRUE);
+#endif
+
+    gPrefsPrivate-&gt;setFullScreenEnabled(TRUE);
+    gPrefsPrivate-&gt;setShowDebugBorders(FALSE);
+    gPrefsPrivate-&gt;setShowRepaintCounter(FALSE);
+
+    gStandardPreferences-&gt;setLoadsImagesAutomatically(TRUE);
+    gPrefsPrivate-&gt;setAuthorAndUserStylesEnabled(TRUE);
+    gStandardPreferences-&gt;setJavaScriptEnabled(TRUE);
+    gPrefsPrivate-&gt;setAllowUniversalAccessFromFileURLs(FALSE);
+    gPrefsPrivate-&gt;setAllowFileAccessFromFileURLs(TRUE);
+
+    gPrefsPrivate-&gt;setDeveloperExtrasEnabled(TRUE);
+
+    return true;
+}
+
+static bool setCacheFolder()
+{
+    IWebCachePtr webCache;
+
+    HRESULT hr = WebKitCreateInstance(CLSID_WebCache, 0, __uuidof(webCache), reinterpret_cast&lt;void**&gt;(&amp;webCache.GetInterfacePtr()));
+    if (FAILED(hr))
+        return false;
+
+    _bstr_t appDataFolder;
+    if (!getAppDataFolder(appDataFolder))
+        return false;
+
+    appDataFolder += L&quot;\\cache&quot;;
+    webCache-&gt;setCacheFolder(appDataFolder);
+
+    return true;
+}
+
+void createCrashReport(EXCEPTION_POINTERS* exceptionPointers)
+{
+    _bstr_t directory;
+
+    if (!getAppDataFolder(directory))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (::SHCreateDirectoryEx(0, directory, 0) != ERROR_SUCCESS
+        &amp;&amp; ::GetLastError() != ERROR_FILE_EXISTS
+        &amp;&amp; ::GetLastError() != ERROR_ALREADY_EXISTS)
+        return;
+
+    std::wstring fileName = directory + L&quot;\\CrashReport.dmp&quot;;
+    HANDLE miniDumpFile = ::CreateFile(fileName.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+
+    if (miniDumpFile &amp;&amp; miniDumpFile != INVALID_HANDLE_VALUE) {
+
+        MINIDUMP_EXCEPTION_INFORMATION mdei;
+        mdei.ThreadId = ::GetCurrentThreadId();
+        mdei.ExceptionPointers  = exceptionPointers;
+        mdei.ClientPointers = 0;
+
+#ifdef _DEBUG
+        MINIDUMP_TYPE dumpType = MiniDumpWithFullMemory;
+#else
+        MINIDUMP_TYPE dumpType = MiniDumpNormal;
+#endif
+
+        ::MiniDumpWriteDump(::GetCurrentProcess(), ::GetCurrentProcessId(), miniDumpFile, dumpType, &amp;mdei, 0, 0);
+        ::CloseHandle(miniDumpFile);
+        processCrashReport(fileName.c_str());
+    }
+}
+
+int WINAPI wWinMain(HINSTANCE, HINSTANCE, PWSTR, int nCmdShow)
+{
+#ifdef _CRTDBG_MAP_ALLOC
+    _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+    _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+#endif
+
+     // TODO: Place code here.
+    MSG msg = {0};
+    HACCEL hAccelTable;
+
+    INITCOMMONCONTROLSEX InitCtrlEx;
+
+    InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
+    InitCtrlEx.dwICC  = 0x00004000; //ICC_STANDARD_CLASSES;
+    InitCommonControlsEx(&amp;InitCtrlEx);
+
+    _bstr_t requestedURL;
+    int argc = 0;
+    WCHAR** argv = CommandLineToArgvW(GetCommandLineW(), &amp;argc);
+    for (int i = 1; i &lt; argc; ++i) {
+        if (!wcsicmp(argv[i], L&quot;--transparent&quot;))
+            s_usesLayeredWebView = true;
+        else if (!wcsicmp(argv[i], L&quot;--desktop&quot;))
+            s_fullDesktop = true;
+        else if (!requestedURL)
+            requestedURL = argv[i];
+    }
+
+    // Initialize global strings
+    LoadString(hInst, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
+    LoadString(hInst, IDC_WINLAUNCHER, szWindowClass, MAX_LOADSTRING);
+    MyRegisterClass(hInst);
+
+    if (shouldUseFullDesktop())
+        computeFullDesktopFrame();
+
+    // Init COM
+    OleInitialize(NULL);
+
+    if (usesLayeredWebView()) {
+        hURLBarWnd = CreateWindow(L&quot;EDIT&quot;, L&quot;Type URL Here&quot;,
+                    WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, 
+                    s_windowPosition.x, s_windowPosition.y + s_windowSize.cy, s_windowSize.cx, URLBAR_HEIGHT,
+                    0,
+                    0,
+                    hInst, 0);
+    } else {
+        hMainWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
+                       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, 0, hInst, 0);
+
+        if (!hMainWnd)
+            return FALSE;
+
+        hBackButtonWnd = CreateWindow(L&quot;BUTTON&quot;, L&quot;&lt;&quot;, WS_CHILD | WS_VISIBLE  | BS_TEXT, 0, 0, 0, 0, hMainWnd, 0, hInst, 0);
+        hForwardButtonWnd = CreateWindow(L&quot;BUTTON&quot;, L&quot;&gt;&quot;, WS_CHILD | WS_VISIBLE  | BS_TEXT, CONTROLBUTTON_WIDTH, 0, 0, 0, hMainWnd, 0, hInst, 0);
+        hURLBarWnd = CreateWindow(L&quot;EDIT&quot;, 0, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, CONTROLBUTTON_WIDTH * 2, 0, 0, 0, hMainWnd, 0, hInst, 0);
+
+        ShowWindow(hMainWnd, nCmdShow);
+        UpdateWindow(hMainWnd);
+    }
+
+    DefEditProc = reinterpret_cast&lt;WNDPROC&gt;(GetWindowLongPtr(hURLBarWnd, GWLP_WNDPROC));
+    DefButtonProc = reinterpret_cast&lt;WNDPROC&gt;(GetWindowLongPtr(hBackButtonWnd, GWLP_WNDPROC));
+    SetWindowLongPtr(hURLBarWnd, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(EditProc));
+    SetWindowLongPtr(hBackButtonWnd, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(BackButtonProc));
+    SetWindowLongPtr(hForwardButtonWnd, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(ForwardButtonProc));
+
+    SetFocus(hURLBarWnd);
+
+    RECT clientRect = { s_windowPosition.x, s_windowPosition.y, s_windowPosition.x + s_windowSize.cx, s_windowPosition.y + s_windowSize.cy };
+
+    IWebPreferencesPtr tmpPreferences;
+    if (FAILED(WebKitCreateInstance(CLSID_WebPreferences, 0, IID_IWebPreferences, reinterpret_cast&lt;void**&gt;(&amp;tmpPreferences.GetInterfacePtr()))))
+        goto exit;
+
+    if (FAILED(tmpPreferences-&gt;standardPreferences(&amp;gStandardPreferences.GetInterfacePtr())))
+        goto exit;
+
+    if (!setToDefaultPreferences())
+        goto exit;
+
+    HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, reinterpret_cast&lt;void**&gt;(&amp;gWebView.GetInterfacePtr()));
+    if (FAILED(hr))
+        goto exit;
+
+    hr = gWebView-&gt;QueryInterface(IID_IWebViewPrivate, reinterpret_cast&lt;void**&gt;(&amp;gWebViewPrivate.GetInterfacePtr()));
+    if (FAILED(hr))
+        goto exit;
+
+    hr = WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(gWebHistory), reinterpret_cast&lt;void**&gt;(&amp;gWebHistory.GetInterfacePtr()));
+    if (FAILED(hr))
+        goto exit;
+
+    if (!setCacheFolder())
+        goto exit;
+
+    gWebHost = new WinLauncherWebHost();
+    gWebHost-&gt;AddRef();
+    hr = gWebView-&gt;setFrameLoadDelegate(gWebHost);
+    if (FAILED(hr))
+        goto exit;
+
+    gPrintDelegate = new PrintWebUIDelegate;
+    gPrintDelegate-&gt;AddRef();
+    hr = gWebView-&gt;setUIDelegate(gPrintDelegate);
+    if (FAILED (hr))
+        goto exit;
+
+    gAccessibilityDelegate = new AccessibilityDelegate;
+    gAccessibilityDelegate-&gt;AddRef();
+    hr = gWebView-&gt;setAccessibilityDelegate(gAccessibilityDelegate);
+    if (FAILED (hr))
+        goto exit;
+
+    hr = gWebView-&gt;setHostWindow(reinterpret_cast&lt;OLE_HANDLE&gt;(hMainWnd));
+    if (FAILED(hr))
+        goto exit;
+
+    hr = gWebView-&gt;initWithFrame(clientRect, 0, 0);
+    if (FAILED(hr))
+        goto exit;
+
+    if (!requestedURL) {
+        IWebFramePtr frame;
+        hr = gWebView-&gt;mainFrame(&amp;frame.GetInterfacePtr());
+        if (FAILED(hr))
+            goto exit;
+
+        frame-&gt;loadHTMLString(_bstr_t(defaultHTML).GetBSTR(), 0);
+    }
+
+    hr = gWebViewPrivate-&gt;setTransparent(usesLayeredWebView());
+    if (FAILED(hr))
+        goto exit;
+
+    hr = gWebViewPrivate-&gt;setUsesLayeredWindow(usesLayeredWebView());
+    if (FAILED(hr))
+        goto exit;
+
+    hr = gWebViewPrivate-&gt;viewWindow(reinterpret_cast&lt;OLE_HANDLE*&gt;(&amp;gViewWindow));
+    if (FAILED(hr) || !gViewWindow)
+        goto exit;
+
+    if (usesLayeredWebView())
+        subclassForLayeredWindow();
+
+    resizeSubViews();
+
+    ShowWindow(gViewWindow, nCmdShow);
+    UpdateWindow(gViewWindow);
+
+    hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_WINLAUNCHER));
+
+    if (requestedURL.length())
+        loadURL(requestedURL.GetBSTR());
+
+#pragma warning(disable:4509)
+
+    // Main message loop:
+    __try {
+        while (GetMessage(&amp;msg, 0, 0, 0)) {
+#if USE(CF)
+            CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);
+#endif
+            if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) {
+                TranslateMessage(&amp;msg);
+                DispatchMessage(&amp;msg);
+            }
+#if USE(GLIB)
+            g_main_context_iteration(0, false);
+#endif
+        }
+    } __except(createCrashReport(GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) { }
+
+exit:
+    gPrintDelegate-&gt;Release();
+
+    shutDownWebKit();
+#ifdef _CRTDBG_MAP_ALLOC
+    _CrtDumpMemoryLeaks();
+#endif
+
+    // Shut down COM.
+    OleUninitialize();
+    
+    return static_cast&lt;int&gt;(msg.wParam);
+}
+
+ATOM MyRegisterClass(HINSTANCE hInstance)
+{
+    WNDCLASSEX wcex;
+
+    wcex.cbSize = sizeof(WNDCLASSEX);
+
+    wcex.style          = CS_HREDRAW | CS_VREDRAW;
+    wcex.lpfnWndProc    = WndProc;
+    wcex.cbClsExtra     = 0;
+    wcex.cbWndExtra     = 0;
+    wcex.hInstance      = hInstance;
+    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINLAUNCHER));
+    wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
+    wcex.hbrBackground  = 0;
+    wcex.lpszMenuName   = MAKEINTRESOURCE(IDC_WINLAUNCHER);
+    wcex.lpszClassName  = szWindowClass;
+    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
+
+    return RegisterClassEx(&amp;wcex);
+}
+
+static BOOL CALLBACK AbortProc(HDC hDC, int Error)
+{
+    MSG msg;
+    while (::PeekMessage(&amp;msg, 0, 0, 0, PM_REMOVE)) {
+        ::TranslateMessage(&amp;msg);
+        ::DispatchMessage(&amp;msg);
+    }
+
+    return TRUE;
+}
+
+static HDC getPrinterDC()
+{
+    PRINTDLG pdlg;
+    memset(&amp;pdlg, 0, sizeof(PRINTDLG));
+    pdlg.lStructSize = sizeof(PRINTDLG);
+    pdlg.Flags = PD_PRINTSETUP | PD_RETURNDC;
+
+    ::PrintDlg(&amp;pdlg);
+
+    return pdlg.hDC;
+}
+
+static void initDocStruct(DOCINFO* di, TCHAR* docname)
+{
+    memset(di, 0, sizeof(DOCINFO));
+    di-&gt;cbSize = sizeof(DOCINFO);
+    di-&gt;lpszDocName = docname;
+}
+
+typedef _com_ptr_t&lt;_com_IIID&lt;IWebFramePrivate, &amp;__uuidof(IWebFramePrivate)&gt;&gt; IWebFramePrivatePtr;
+
+void PrintView(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    HDC printDC = getPrinterDC();
+    if (!printDC) {
+        ::MessageBoxW(0, L&quot;Error creating printing DC&quot;, L&quot;Error&quot;, MB_APPLMODAL | MB_OK);
+        return;
+    }
+
+    if (::SetAbortProc(printDC, AbortProc) == SP_ERROR) {
+        ::MessageBoxW(0, L&quot;Error setting up AbortProc&quot;, L&quot;Error&quot;, MB_APPLMODAL | MB_OK);
+        return;
+    }
+
+    IWebFramePtr frame;
+    IWebFramePrivatePtr framePrivate;
+    if (FAILED(gWebView-&gt;mainFrame(&amp;frame.GetInterfacePtr())))
+        return;
+
+    if (FAILED(frame-&gt;QueryInterface(&amp;framePrivate.GetInterfacePtr())))
+        return;
+
+    framePrivate-&gt;setInPrintingMode(TRUE, printDC);
+
+    UINT pageCount = 0;
+    framePrivate-&gt;getPrintedPageCount(printDC, &amp;pageCount);
+
+    DOCINFO di;
+    initDocStruct(&amp;di, L&quot;WebKit Doc&quot;);
+    ::StartDoc(printDC, &amp;di);
+
+    // FIXME: Need CoreGraphics implementation
+    void* graphicsContext = 0;
+    for (size_t page = 1; page &lt;= pageCount; ++page) {
+        ::StartPage(printDC);
+        framePrivate-&gt;spoolPages(printDC, page, page, graphicsContext);
+        ::EndPage(printDC);
+    }
+
+    framePrivate-&gt;setInPrintingMode(FALSE, printDC);
+
+    ::EndDoc(printDC);
+    ::DeleteDC(printDC);
+}
+
+static void ToggleMenuItem(HWND hWnd, UINT menuID)
+{
+    HMENU menu = ::GetMenu(hWnd);
+
+    MENUITEMINFO info;
+    ::memset(&amp;info, 0x00, sizeof(info));
+    info.cbSize = sizeof(info);
+    info.fMask = MIIM_STATE;
+
+    if (!::GetMenuItemInfo(menu, menuID, FALSE, &amp;info))
+        return;
+
+    BOOL newState = !(info.fState &amp; MFS_CHECKED);
+
+    if (!gStandardPreferences || !gPrefsPrivate)
+        return;
+
+    switch (menuID) {
+    case IDM_AVFOUNDATION:
+        gStandardPreferences-&gt;setAVFoundationEnabled(newState);
+        break;
+    case IDM_ACC_COMPOSITING:
+        gPrefsPrivate-&gt;setAcceleratedCompositingEnabled(newState);
+        break;
+    case IDM_WK_FULLSCREEN:
+        gPrefsPrivate-&gt;setFullScreenEnabled(newState);
+        break;
+    case IDM_COMPOSITING_BORDERS:
+        gPrefsPrivate-&gt;setShowDebugBorders(newState);
+        gPrefsPrivate-&gt;setShowRepaintCounter(newState);
+        break;
+    case IDM_DISABLE_IMAGES:
+        gStandardPreferences-&gt;setLoadsImagesAutomatically(!newState);
+        break;
+    case IDM_DISABLE_STYLES:
+        gPrefsPrivate-&gt;setAuthorAndUserStylesEnabled(!newState);
+        break;
+    case IDM_DISABLE_JAVASCRIPT:
+        gStandardPreferences-&gt;setJavaScriptEnabled(!newState);
+        break;
+    case IDM_DISABLE_LOCAL_FILE_RESTRICTIONS:
+        gPrefsPrivate-&gt;setAllowUniversalAccessFromFileURLs(newState);
+        gPrefsPrivate-&gt;setAllowFileAccessFromFileURLs(newState);
+        break;
+    }
+
+    info.fState = (newState) ? MFS_CHECKED : MFS_UNCHECKED;
+
+    ::SetMenuItemInfo(menu, menuID, FALSE, &amp;info);
+}
+
+static void LaunchInspector(HWND hwnd)
+{
+    if (!gWebViewPrivate)
+        return;
+
+    if (!SUCCEEDED(gWebViewPrivate-&gt;inspector(&amp;gInspector.GetInterfacePtr())))
+        return;
+
+    gInspector-&gt;show();
+}
+
+static void NavigateForwardOrBackward(HWND hWnd, UINT menuID)
+{
+    if (!gWebView)
+        return;
+
</ins><span class="cx">     BOOL wentBackOrForward = FALSE;
</span><span class="cx">     if (IDM_HISTORY_FORWARD == menuID)
</span><del>-        m_webView-&gt;goForward(&amp;wentBackOrForward);
</del><ins>+        gWebView-&gt;goForward(&amp;wentBackOrForward);
</ins><span class="cx">     else
</span><del>-        m_webView-&gt;goBack(&amp;wentBackOrForward);
</del><ins>+        gWebView-&gt;goBack(&amp;wentBackOrForward);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WinLauncher::navigateToHistory(HWND hWnd, UINT menuID)
</del><ins>+static void NavigateToHistory(HWND hWnd, UINT menuID)
</ins><span class="cx"> {
</span><del>-    if (!m_webView)
</del><ins>+    if (!gWebView)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     int historyEntry = menuID - IDM_HISTORY_LINK0;
</span><del>-    if (historyEntry &gt; m_historyItems.size())
</del><ins>+    if (historyEntry &gt; gHistoryItems.size())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    IWebHistoryItemPtr desiredHistoryItem = m_historyItems[historyEntry];
</del><ins>+    IWebHistoryItemPtr desiredHistoryItem = gHistoryItems[historyEntry];
</ins><span class="cx">     if (!desiredHistoryItem)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     BOOL succeeded = FALSE;
</span><del>-    m_webView-&gt;goToBackForwardItem(desiredHistoryItem, &amp;succeeded);
</del><ins>+    gWebView-&gt;goToBackForwardItem(desiredHistoryItem, &amp;succeeded);
</ins><span class="cx"> 
</span><span class="cx">     _bstr_t frameURL;
</span><span class="cx">     desiredHistoryItem-&gt;URLString(frameURL.GetAddress());
</span><span class="cx"> 
</span><del>-    ::SendMessage(m_hURLBarWnd, (UINT)WM_SETTEXT, 0, (LPARAM)frameURL.GetBSTR());
</del><ins>+    ::SendMessage(hURLBarWnd, (UINT)WM_SETTEXT, 0, (LPARAM)frameURL.GetBSTR());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WinLauncher::goBack()
</del><ins>+static const int dragBarHeight = 30;
+
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
</ins><span class="cx"> {
</span><ins>+    WNDPROC parentProc = usesLayeredWebView() ? DefWebKitProc : DefWindowProc;
+
+    switch (message) {
+    case WM_NCHITTEST:
+        if (usesLayeredWebView()) {
+            RECT window;
+            ::GetWindowRect(hWnd, &amp;window);
+            // For testing our transparent window, we need a region to use as a handle for
+            // dragging. The right way to do this would be to query the web view to see what's
+            // under the mouse. However, for testing purposes we just use an arbitrary
+            // 30 pixel band at the top of the view as an arbitrary gripping location.
+            //
+            // When we are within this bad, return HT_CAPTION to tell Windows we want to
+            // treat this region as if it were the title bar on a normal window.
+            int y = HIWORD(lParam);
+
+            if ((y &gt; window.top) &amp;&amp; (y &lt; window.top + dragBarHeight))
+                return HTCAPTION;
+        }
+        return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
+    case WM_COMMAND: {
+        int wmId = LOWORD(wParam);
+        int wmEvent = HIWORD(wParam);
+        if (wmId &gt;= IDM_HISTORY_LINK0 &amp;&amp; wmId &lt;= IDM_HISTORY_LINK9) {
+            NavigateToHistory(hWnd, wmId);
+            break;
+        }
+        // Parse the menu selections:
+        switch (wmId) {
+        case IDM_ABOUT:
+            DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
+            break;
+        case IDM_EXIT:
+            DestroyWindow(hWnd);
+            break;
+        case IDM_PRINT:
+            PrintView(hWnd, message, wParam, lParam);
+            break;
+        case IDM_WEB_INSPECTOR:
+            LaunchInspector(hWnd);
+            break;
+        case IDM_HISTORY_BACKWARD:
+        case IDM_HISTORY_FORWARD:
+            NavigateForwardOrBackward(hWnd, wmId);
+            break;
+        case IDM_AVFOUNDATION:
+        case IDM_ACC_COMPOSITING:
+        case IDM_WK_FULLSCREEN:
+        case IDM_COMPOSITING_BORDERS:
+        case IDM_DISABLE_IMAGES:
+        case IDM_DISABLE_STYLES:
+        case IDM_DISABLE_JAVASCRIPT:
+        case IDM_DISABLE_LOCAL_FILE_RESTRICTIONS:
+            ToggleMenuItem(hWnd, wmId);
+            break;
+        default:
+            return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
+        }
+        }
+        break;
+    case WM_DESTROY:
+#if USE(CF)
+        CFRunLoopStop(CFRunLoopGetMain());
+#endif
+        PostQuitMessage(0);
+        break;
+    case WM_SIZE:
+        if (!gWebView || usesLayeredWebView())
+           return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
+
+        resizeSubViews();
+        break;
+    default:
+        return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
+    }
+
+    return 0;
+}
+
+LRESULT CALLBACK EditProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    switch (message) {
+    case WM_CHAR:
+        if (wParam == 13) { // Enter Key
+            wchar_t strPtr[INTERNET_MAX_URL_LENGTH];
+            *((LPWORD)strPtr) = INTERNET_MAX_URL_LENGTH; 
+            int strLen = SendMessage(hDlg, EM_GETLINE, 0, (LPARAM)strPtr);
+
+            strPtr[strLen] = 0;
+            _bstr_t bstr(strPtr);
+            loadURL(bstr.GetBSTR());
+
+            return 0;
+        } 
+    default:
+        return CallWindowProc(DefEditProc, hDlg, message, wParam, lParam);
+    }
+}
+
+LRESULT CALLBACK BackButtonProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
</ins><span class="cx">     BOOL wentBack = FALSE;
</span><del>-    m_webView-&gt;goBack(&amp;wentBack);
-    return wentBack;
</del><ins>+    switch (message) {
+    case WM_LBUTTONUP:
+        gWebView-&gt;goBack(&amp;wentBack);
+    default:
+        return CallWindowProc(DefButtonProc, hDlg, message, wParam, lParam);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WinLauncher::goForward()
</del><ins>+LRESULT CALLBACK ForwardButtonProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
</ins><span class="cx"> {
</span><span class="cx">     BOOL wentForward = FALSE;
</span><del>-    m_webView-&gt;goForward(&amp;wentForward);
-    return wentForward;
</del><ins>+    switch (message) {
+    case WM_LBUTTONUP:
+        gWebView-&gt;goForward(&amp;wentForward);
+    default:
+        return CallWindowProc(DefButtonProc, hDlg, message, wParam, lParam);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-HRESULT WinLauncher::loadURL(const BSTR&amp; passedURL)
</del><ins>+// Message handler for about box.
+INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
</ins><span class="cx"> {
</span><ins>+    UNREFERENCED_PARAMETER(lParam);
+    switch (message) {
+    case WM_INITDIALOG:
+        return (INT_PTR)TRUE;
+
+    case WM_COMMAND:
+        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
+            EndDialog(hDlg, LOWORD(wParam));
+            return (INT_PTR)TRUE;
+        }
+        break;
+    }
+    return (INT_PTR)FALSE;
+}
+
+static void loadURL(BSTR passedURL)
+{
</ins><span class="cx">     _bstr_t urlBStr(passedURL);
</span><span class="cx">     if (!!urlBStr &amp;&amp; (::PathFileExists(urlBStr) || ::PathIsUNC(urlBStr))) {
</span><span class="cx">         TCHAR fileURL[INTERNET_MAX_URL_LENGTH];
</span><del>-        DWORD fileURLLength = sizeof(fileURL) / sizeof(fileURL[0]);
</del><ins>+        DWORD fileURLLength = sizeof(fileURL)/sizeof(fileURL[0]);
</ins><span class="cx"> 
</span><span class="cx">         if (SUCCEEDED(::UrlCreateFromPath(urlBStr, fileURL, &amp;fileURLLength, 0)))
</span><span class="cx">             urlBStr = fileURL;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     IWebFramePtr frame;
</span><del>-    HRESULT hr = m_webView-&gt;mainFrame(&amp;frame.GetInterfacePtr());
</del><ins>+    HRESULT hr = gWebView-&gt;mainFrame(&amp;frame.GetInterfacePtr());
</ins><span class="cx">     if (FAILED(hr))
</span><del>-        return hr;
</del><ins>+        return;
</ins><span class="cx"> 
</span><span class="cx">     IWebMutableURLRequestPtr request;
</span><span class="cx">     hr = WebKitCreateInstance(CLSID_WebMutableURLRequest, 0, IID_IWebMutableURLRequest, (void**)&amp;request);
</span><span class="cx">     if (FAILED(hr))
</span><del>-        return hr;
</del><ins>+        return;
</ins><span class="cx"> 
</span><span class="cx">     hr = request-&gt;initWithURL(wcsstr(static_cast&lt;wchar_t*&gt;(urlBStr), L&quot;://&quot;) ? urlBStr : _bstr_t(L&quot;http://&quot;) + urlBStr, WebURLRequestUseProtocolCachePolicy, 60);
</span><span class="cx">     if (FAILED(hr))
</span><del>-        return hr;
</del><ins>+        return;
</ins><span class="cx"> 
</span><span class="cx">     _bstr_t methodBStr(L&quot;GET&quot;);
</span><span class="cx">     hr = request-&gt;setHTTPMethod(methodBStr);
</span><span class="cx">     if (FAILED(hr))
</span><del>-        return hr;
</del><ins>+        return;
</ins><span class="cx"> 
</span><span class="cx">     hr = frame-&gt;loadRequest(request);
</span><ins>+    if (FAILED(hr))
+        return;
</ins><span class="cx"> 
</span><del>-    return hr;
</del><ins>+    SetFocus(gViewWindow);
</ins><span class="cx"> }
</span><ins>+
+extern &quot;C&quot; __declspec(dllexport) int WINAPI dllLauncherEntryPoint(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpstrCmdLine, int nCmdShow)
+{
+    return wWinMain(hInstance, hPrevInstance, lpstrCmdLine, nCmdShow);
+}
</ins></span></pre></div>
<a id="trunkToolsWinLauncherWinLauncherh"></a>
<div class="addfile"><h4>Added: trunk/Tools/WinLauncher/WinLauncher.h (0 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.h                                (rev 0)
+++ trunk/Tools/WinLauncher/WinLauncher.h        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -0,0 +1,119 @@
</span><ins>+/*
+ * Copyright (C) 2006 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. ``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 APPLE INC. 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. 
+ */
+
+#pragma once
+
+#include &quot;resource.h&quot;
+#include &lt;WebKit/WebKit.h&gt;
+
+class WinLauncherWebHost : public IWebFrameLoadDelegate
+{
+public:
+    WinLauncherWebHost() : m_refCount(1) {}
+
+    // IUnknown
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+    virtual ULONG STDMETHODCALLTYPE AddRef(void);
+    virtual ULONG STDMETHODCALLTYPE Release(void);
+
+    // IWebFrameLoadDelegate
+    virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame( 
+        /* [in] */ IWebView* webView,
+        /* [in] */ IWebFrame* /*frame*/) { return S_OK; }
+    
+    virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+    
+    virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebError *error,
+        /* [in] */ IWebFrame*);
+    
+    virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebFrame *frame) { return updateAddressBar(webView); }
+    
+    virtual HRESULT STDMETHODCALLTYPE didReceiveTitle( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ BSTR title,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+    
+    virtual HRESULT STDMETHODCALLTYPE didChangeIcons(
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+
+    virtual HRESULT STDMETHODCALLTYPE didReceiveIcon( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ OLE_HANDLE hBitmap,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+    
+    virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame( 
+        /* [in] */ IWebView* webView,
+        /* [in] */ IWebFrame* /*frame*/);
+    
+    virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebError *error,
+        /* [in] */ IWebFrame *forFrame) { return S_OK; }
+    
+    virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+
+    virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ BSTR url,
+        /* [in] */ double delaySeconds,
+        /* [in] */ DATE fireDate,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+    
+    virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+    
+    virtual HRESULT STDMETHODCALLTYPE willCloseFrame( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+    
+    virtual /* [local] */ HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ JSContextRef context,
+        /* [in] */ JSObjectRef windowScriptObject)  { return S_OK; }
+
+    virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject( 
+        /* [in] */ IWebView *webView,
+        /* [in] */ JSContextRef context,
+        /* [in] */ JSObjectRef windowScriptObject,
+        /* [in] */ IWebFrame *frame) { return S_OK; }
+
+    // WinLauncherWebHost
+
+protected:
+    HRESULT updateAddressBar(IWebView* webView);
+
+protected:
+    ULONG                   m_refCount;
+};
</ins></span></pre></div>
<a id="trunkToolsWinLauncherWinLaunchervcxprojWinLauncherLibvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -203,15 +203,6 @@
</span><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\AccessibilityDelegate.cpp&quot; /&gt;
</span><del>-    &lt;ClCompile Include=&quot;..\Common.cpp&quot;&gt;
-      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
-      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
-      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Production|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
-      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
-      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Release|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
-      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
-    &lt;/ClCompile&gt;
-    &lt;ClCompile Include=&quot;..\DOMDefaultImpl.cpp&quot; /&gt;
</del><span class="cx">     &lt;ClCompile Include=&quot;..\PrintWebUIDelegate.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\stdafx.cpp&quot;&gt;
</span><span class="cx">       &lt;PrecompiledHeader Condition=&quot;'$(Configuration)|$(Platform)'=='Release|Win32'&quot;&gt;Create&lt;/PrecompiledHeader&gt;
</span><span class="lines">@@ -228,8 +219,6 @@
</span><span class="cx">       &lt;PrecompiledHeader Condition=&quot;'$(Configuration)|$(Platform)'=='DebugSuffix|x64'&quot;&gt;Create&lt;/PrecompiledHeader&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\WinLauncher.cpp&quot; /&gt;
</span><del>-    &lt;ClCompile Include=&quot;..\WinLauncherWebHost.cpp&quot; /&gt;
-    &lt;ClCompile Include=&quot;..\WinMain.cpp&quot; /&gt;
</del><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\AccessibilityDelegate.h&quot; /&gt;
</span><span class="lines">@@ -238,7 +227,6 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\stdafx.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\WinLauncher.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\WinLauncherReplace.h&quot; /&gt;
</span><del>-    &lt;ClInclude Include=&quot;..\WinLauncherWebHost.h&quot; /&gt;
</del><span class="cx">     &lt;ClInclude Include=&quot;WinLauncherLibResource.h&quot; /&gt;
</span><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span></span></pre></div>
<a id="trunkToolsWinLauncherWinLaunchervcxprojWinLauncherLibvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -37,18 +37,6 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\AccessibilityDelegate.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;Source Files&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><del>-    &lt;ClCompile Include=&quot;..\WinLauncherWebHost.cpp&quot;&gt;
-      &lt;Filter&gt;Source Files&lt;/Filter&gt;
-    &lt;/ClCompile&gt;
-    &lt;ClCompile Include=&quot;..\DOMDefaultImpl.cpp&quot;&gt;
-      &lt;Filter&gt;Source Files&lt;/Filter&gt;
-    &lt;/ClCompile&gt;
-    &lt;ClCompile Include=&quot;..\WinMain.cpp&quot;&gt;
-      &lt;Filter&gt;Source Files&lt;/Filter&gt;
-    &lt;/ClCompile&gt;
-    &lt;ClCompile Include=&quot;..\Common.cpp&quot;&gt;
-      &lt;Filter&gt;Source Files&lt;/Filter&gt;
-    &lt;/ClCompile&gt;
</del><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\DOMDefaultImpl.h&quot;&gt;
</span><span class="lines">@@ -72,9 +60,6 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\WinLauncherReplace.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;Header Files&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><del>-    &lt;ClInclude Include=&quot;..\WinLauncherWebHost.h&quot;&gt;
-      &lt;Filter&gt;Header Files&lt;/Filter&gt;
-    &lt;/ClInclude&gt;
</del><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span><span class="cx">     &lt;ResourceCompile Include=&quot;WinLauncherLib.rc&quot;&gt;
</span></span></pre></div>
<a id="trunkToolsWinLauncherWinLauncherReplaceh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncherReplace.h (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncherReplace.h        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/WinLauncherReplace.h        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -22,13 +22,8 @@
</span><span class="cx">  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef WinLauncherReplace_h
-#define WinLauncherReplace_h
-
</del><span class="cx"> // This file is to make it easier for users to manage changes to the internals of WinLauncher
</span><span class="cx"> 
</span><del>-static const wchar_t* defaultHTML = L&quot;&lt;p style=\&quot;background-color: #00FF00\&quot;&gt;Testing&lt;/p&gt;&lt;img id=\&quot;webkit logo\&quot; src=\&quot;http://webkit.org/images/icon-gold.png\&quot; alt=\&quot;Face\&quot;&gt;&lt;div style=\&quot;border: solid blue; background: white;\&quot; contenteditable=\&quot;true\&quot;&gt;div with blue border&lt;/div&gt;&lt;ul&gt;&lt;li&gt;foo&lt;li&gt;bar&lt;li&gt;baz&lt;/ul&gt;&quot;;
</del><ins>+const wchar_t* defaultHTML = L&quot;&lt;p style=\&quot;background-color: #00FF00\&quot;&gt;Testing&lt;/p&gt;&lt;img id=\&quot;webkit logo\&quot; src=\&quot;http://webkit.org/images/icon-gold.png\&quot; alt=\&quot;Face\&quot;&gt;&lt;div style=\&quot;border: solid blue; background: white;\&quot; contenteditable=\&quot;true\&quot;&gt;div with blue border&lt;/div&gt;&lt;ul&gt;&lt;li&gt;foo&lt;li&gt;bar&lt;li&gt;baz&lt;/ul&gt;&quot;;
</ins><span class="cx"> 
</span><del>-static void processCrashReport(const wchar_t* fileName) { ::MessageBox(0, fileName, L&quot;Crash Report&quot;, MB_OK); }
-
-#endif
</del><ins>+void processCrashReport(const wchar_t* fileName) { ::MessageBox(0, fileName, L&quot;Crash Report&quot;, MB_OK); }
</ins></span></pre></div>
<a id="trunkToolsWinLauncherWinLauncherWebHostcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/WinLauncher/WinLauncherWebHost.cpp (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncherWebHost.cpp        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/WinLauncherWebHost.cpp        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -1,160 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2008, 2013 Apple Inc.  All rights reserved.
- * Copyright (C) 2009, 2011 Brent Fulgham.  All rights reserved.
- * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
- * Copyright (C) 2013 Alex Christensen. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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 APPLE INC. ``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 APPLE INC. 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. 
- */
-
-#include &quot;stdafx.h&quot;
-#include &quot;WinLauncherWebHost.h&quot;
-
-#include &quot;DOMDefaultImpl.h&quot;
-#include &quot;WinLauncher.h&quot;
-#include &lt;WebKit/WebKit.h&gt;
-
-class SimpleEventListener : public DOMEventListener {
-public:
-    SimpleEventListener(LPWSTR type)
-    {
-        wcsncpy_s(m_eventType, 100, type, 100);
-        m_eventType[99] = 0;
-    }
-
-    virtual HRESULT STDMETHODCALLTYPE handleEvent(IDOMEvent* evt)
-    {
-        wchar_t message[255];
-        wcscpy_s(message, 255, m_eventType);
-        wcscat_s(message, 255, L&quot; event fired!&quot;);
-        ::MessageBox(0, message, L&quot;Event Handler&quot;, MB_OK);
-        return S_OK;
-    }
-
-private:
-    wchar_t m_eventType[100];
-};
-
-typedef _com_ptr_t&lt;_com_IIID&lt;IWebFrame, &amp;__uuidof(IWebFrame)&gt;&gt; IWebFramePtr;
-typedef _com_ptr_t&lt;_com_IIID&lt;IWebDataSource, &amp;__uuidof(IWebDataSource)&gt;&gt; IWebDataSourcePtr;
-typedef _com_ptr_t&lt;_com_IIID&lt;IWebMutableURLRequest, &amp;__uuidof(IWebMutableURLRequest)&gt;&gt; IWebMutableURLRequestPtr;
-
-HRESULT WinLauncherWebHost::updateAddressBar(IWebView&amp; webView)
-{
-    IWebFramePtr mainFrame;
-    HRESULT hr = webView.mainFrame(&amp;mainFrame.GetInterfacePtr());
-    if (FAILED(hr))
-        return 0;
-
-    IWebDataSourcePtr dataSource;
-    hr = mainFrame-&gt;dataSource(&amp;dataSource.GetInterfacePtr());
-    if (FAILED(hr) || !dataSource)
-        hr = mainFrame-&gt;provisionalDataSource(&amp;dataSource.GetInterfacePtr());
-    if (FAILED(hr) || !dataSource)
-        return 0;
-
-    IWebMutableURLRequestPtr request;
-    hr = dataSource-&gt;request(&amp;request.GetInterfacePtr());
-    if (FAILED(hr) || !request)
-        return 0;
-
-    _bstr_t frameURL;
-    hr = request-&gt;mainDocumentURL(frameURL.GetAddress());
-    if (FAILED(hr))
-        return 0;
-
-    ::SendMessage(m_hURLBarWnd, static_cast&lt;UINT&gt;(WM_SETTEXT), 0, reinterpret_cast&lt;LPARAM&gt;(frameURL.GetBSTR()));
-
-    return 0;
-}
-
-HRESULT WinLauncherWebHost::didFailProvisionalLoadWithError(IWebView*, IWebError *error, IWebFrame*)
-{
-    _bstr_t errorDescription;
-    HRESULT hr = error-&gt;localizedDescription(errorDescription.GetAddress());
-    if (FAILED(hr))
-        errorDescription = L&quot;Failed to load page and to localize error description.&quot;;
-
-    if (_wcsicmp(errorDescription, L&quot;Cancelled&quot;))
-        ::MessageBoxW(0, static_cast&lt;LPCWSTR&gt;(errorDescription), L&quot;Error&quot;, MB_APPLMODAL | MB_OK);
-
-    return S_OK;
-}
-
-HRESULT WinLauncherWebHost::QueryInterface(REFIID riid, void** ppvObject)
-{
-    *ppvObject = 0;
-    if (IsEqualGUID(riid, IID_IUnknown))
-        *ppvObject = static_cast&lt;IWebFrameLoadDelegate*&gt;(this);
-    else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate))
-        *ppvObject = static_cast&lt;IWebFrameLoadDelegate*&gt;(this);
-    else
-        return E_NOINTERFACE;
-
-    AddRef();
-    return S_OK;
-}
-
-ULONG WinLauncherWebHost::AddRef()
-{
-    return ++m_refCount;
-}
-
-ULONG WinLauncherWebHost::Release()
-{
-    ULONG newRef = --m_refCount;
-    if (!newRef)
-        delete(this);
-
-    return newRef;
-}
-
-typedef _com_ptr_t&lt;_com_IIID&lt;IDOMDocument, &amp;__uuidof(IDOMDocument)&gt;&gt; IDOMDocumentPtr;
-typedef _com_ptr_t&lt;_com_IIID&lt;IDOMElement, &amp;__uuidof(IDOMElement)&gt;&gt; IDOMElementPtr;
-typedef _com_ptr_t&lt;_com_IIID&lt;IDOMEventTarget, &amp;__uuidof(IDOMEventTarget)&gt;&gt; IDOMEventTargetPtr;
-
-HRESULT WinLauncherWebHost::didFinishLoadForFrame(IWebView* webView, IWebFrame* frame)
-{
-    IDOMDocumentPtr doc;
-    frame-&gt;DOMDocument(&amp;doc.GetInterfacePtr());
-
-    IDOMElementPtr element;
-    IDOMEventTargetPtr target;
-
-    if (m_client)
-        m_client-&gt;showLastVisitedSites(*webView);
-
-    // The following is for the test page:
-    HRESULT hr = doc-&gt;getElementById(L&quot;webkit logo&quot;, &amp;element.GetInterfacePtr());
-    if (!SUCCEEDED(hr))
-        return hr;
-
-    hr = element-&gt;QueryInterface(IID_IDOMEventTarget, reinterpret_cast&lt;void**&gt;(&amp;target.GetInterfacePtr()));
-    if (!SUCCEEDED(hr))
-        return hr;
-
-    hr = target-&gt;addEventListener(L&quot;click&quot;, new SimpleEventListener (L&quot;webkit logo click&quot;), FALSE);
-    if (!SUCCEEDED(hr))
-        return hr;
-
-    return hr;
-}
</del></span></pre></div>
<a id="trunkToolsWinLauncherWinLauncherWebHosth"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/WinLauncher/WinLauncherWebHost.h (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncherWebHost.h        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/WinLauncherWebHost.h        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -1,74 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2014 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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 APPLE INC. ``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 APPLE INC. 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. 
- */
-
-#pragma once
-
-#include &quot;resource.h&quot;
-#include &lt;WebKit/WebKit.h&gt;
-
-class WinLauncher;
-
-class WinLauncherWebHost : public IWebFrameLoadDelegate {
-public:
-    WinLauncherWebHost(WinLauncher* client, HWND urlBar)
-        : m_refCount(1), m_client(client), m_hURLBarWnd(urlBar) { }
-
-    // IUnknown
-    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
-    virtual ULONG STDMETHODCALLTYPE AddRef();
-    virtual ULONG STDMETHODCALLTYPE Release();
-
-    // IWebFrameLoadDelegate
-    virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame(IWebView*, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame(IWebView*, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError(IWebView*, IWebError*, IWebFrame*);
-    virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame(IWebView* webView, IWebFrame*)
-    {
-        if (!webView)
-            return E_POINTER;
-
-        return updateAddressBar(*webView);
-    }
-    
-    virtual HRESULT STDMETHODCALLTYPE didReceiveTitle(IWebView*, BSTR title, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE didChangeIcons(IWebView*, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE didReceiveIcon(IWebView*, OLE_HANDLE hBitmap, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame(IWebView*, IWebFrame*);   
-    virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError(IWebView*, IWebError*, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame(IWebView*, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL(IWebView*, BSTR url, double delaySeconds, DATE fireDate, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame(IWebView*, IWebFrame*) { return S_OK; }
-    virtual HRESULT STDMETHODCALLTYPE willCloseFrame(IWebView*, IWebFrame*) { return S_OK; }
-    virtual /* [local] */ HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable(IWebView*, JSContextRef, JSObjectRef)  { return S_OK; }
-    virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject(IWebView*, JSContextRef, JSObjectRef, IWebFrame*) { return S_OK; }
-
-protected:
-    HRESULT updateAddressBar(IWebView&amp;);
-
-private:
-    HWND m_hURLBarWnd;
-    ULONG m_refCount;
-    WinLauncher* m_client;
-};
</del></span></pre></div>
<a id="trunkToolsWinLauncherWinMaincpp"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/WinLauncher/WinMain.cpp (170345 => 170346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinMain.cpp        2014-06-24 04:38:17 UTC (rev 170345)
+++ trunk/Tools/WinLauncher/WinMain.cpp        2014-06-24 05:45:54 UTC (rev 170346)
</span><span class="lines">@@ -1,203 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2008, 2013, 2014 Apple Inc.  All rights reserved.
- * Copyright (C) 2009, 2011 Brent Fulgham.  All rights reserved.
- * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
- * Copyright (C) 2013 Alex Christensen. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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 APPLE INC. ``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 APPLE INC. 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. 
- */
-
-#include &quot;stdafx.h&quot;
-#include &quot;WinLauncherLibResource.h&quot;
-#include &quot;WinLauncherWebHost.h&quot;
-#include &quot;Common.cpp&quot;
-
-int WINAPI wWinMain(HINSTANCE, HINSTANCE, PWSTR, int nCmdShow)
-{
-#ifdef _CRTDBG_MAP_ALLOC
-    _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
-    _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
-#endif
-
-    MSG msg = {0};
-    HACCEL hAccelTable;
-
-    INITCOMMONCONTROLSEX InitCtrlEx;
-
-    InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
-    InitCtrlEx.dwICC  = 0x00004000; // ICC_STANDARD_CLASSES;
-    InitCommonControlsEx(&amp;InitCtrlEx);
-
-    bool usesLayeredWebView = false;
-    bool useFullDesktop = false;
-
-    _bstr_t requestedURL;
-    int argc = 0;
-    WCHAR** argv = CommandLineToArgvW(GetCommandLineW(), &amp;argc);
-    for (int i = 1; i &lt; argc; ++i) {
-        if (!wcsicmp(argv[i], L&quot;--transparent&quot;))
-            usesLayeredWebView = true;
-        else if (!wcsicmp(argv[i], L&quot;--desktop&quot;))
-            useFullDesktop = true;
-        else if (!requestedURL)
-            requestedURL = argv[i];
-    }
-
-    // Initialize global strings
-    LoadString(hInst, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
-    LoadString(hInst, IDC_WINLAUNCHER, szWindowClass, MAX_LOADSTRING);
-    MyRegisterClass(hInst);
-
-    if (useFullDesktop)
-        computeFullDesktopFrame();
-
-    // Init COM
-    OleInitialize(nullptr);
-
-    if (usesLayeredWebView) {
-        hURLBarWnd = CreateWindow(L&quot;EDIT&quot;, L&quot;Type URL Here&quot;,
-            WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, 
-            s_windowPosition.x, s_windowPosition.y + s_windowSize.cy, s_windowSize.cx, URLBAR_HEIGHT,
-            0, 0, hInst, 0);
-    } else {
-        hMainWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
-            CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, 0, hInst, 0);
-
-        if (!hMainWnd)
-            return FALSE;
-
-        hBackButtonWnd = CreateWindow(L&quot;BUTTON&quot;, L&quot;&lt;&quot;, WS_CHILD | WS_VISIBLE  | BS_TEXT, 0, 0, 0, 0, hMainWnd, 0, hInst, 0);
-        hForwardButtonWnd = CreateWindow(L&quot;BUTTON&quot;, L&quot;&gt;&quot;, WS_CHILD | WS_VISIBLE  | BS_TEXT, CONTROLBUTTON_WIDTH, 0, 0, 0, hMainWnd, 0, hInst, 0);
-        hURLBarWnd = CreateWindow(L&quot;EDIT&quot;, 0, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, CONTROLBUTTON_WIDTH * 2, 0, 0, 0, hMainWnd, 0, hInst, 0);
-
-        ShowWindow(hMainWnd, nCmdShow);
-        UpdateWindow(hMainWnd);
-    }
-
-    DefEditProc = reinterpret_cast&lt;WNDPROC&gt;(GetWindowLongPtr(hURLBarWnd, GWLP_WNDPROC));
-    DefButtonProc = reinterpret_cast&lt;WNDPROC&gt;(GetWindowLongPtr(hBackButtonWnd, GWLP_WNDPROC));
-    SetWindowLongPtr(hURLBarWnd, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(EditProc));
-    SetWindowLongPtr(hBackButtonWnd, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(BackButtonProc));
-    SetWindowLongPtr(hForwardButtonWnd, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(ForwardButtonProc));
-
-    SetFocus(hURLBarWnd);
-
-    RECT clientRect = { s_windowPosition.x, s_windowPosition.y, s_windowPosition.x + s_windowSize.cx, s_windowPosition.y + s_windowSize.cy };
-
-    gWinLauncher = new WinLauncher(hMainWnd, hURLBarWnd, usesLayeredWebView);
-    if (!gWinLauncher)
-        goto exit;
-
-    if (!gWinLauncher-&gt;seedInitialDefaultPreferences())
-        goto exit;
-
-    if (!gWinLauncher-&gt;setToDefaultPreferences())
-        goto exit;
-
-    HRESULT hr = gWinLauncher-&gt;init();
-    if (FAILED(hr))
-        goto exit;
-
-    if (!setCacheFolder())
-        goto exit;
-
-    hr = gWinLauncher-&gt;setFrameLoadDelegate(new WinLauncherWebHost(gWinLauncher, hURLBarWnd));
-    if (FAILED(hr))
-        goto exit;
-
-    hr = gWinLauncher-&gt;setUIDelegate(new PrintWebUIDelegate());
-    if (FAILED (hr))
-        goto exit;
-
-    hr = gWinLauncher-&gt;setAccessibilityDelegate(new AccessibilityDelegate());
-    if (FAILED (hr))
-        goto exit;
-
-    hr = gWinLauncher-&gt;prepareViews(hMainWnd, clientRect, requestedURL.GetBSTR(), gViewWindow);
-    if (FAILED(hr) || !gViewWindow)
-        goto exit;
-
-    if (gWinLauncher-&gt;usesLayeredWebView())
-        subclassForLayeredWindow();
-
-    resizeSubViews();
-
-    ShowWindow(gViewWindow, nCmdShow);
-    UpdateWindow(gViewWindow);
-
-    hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_WINLAUNCHER));
-
-    if (requestedURL.length())
-        loadURL(requestedURL.GetBSTR());
-
-#pragma warning(disable:4509)
-
-    // Main message loop:
-    __try {
-        while (GetMessage(&amp;msg, 0, 0, 0)) {
-#if USE(CF)
-            CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);
-#endif
-            if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) {
-                TranslateMessage(&amp;msg);
-                DispatchMessage(&amp;msg);
-            }
-#if USE(GLIB)
-            g_main_context_iteration(0, false);
-#endif
-        }
-    } __except(createCrashReport(GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) { }
-
-exit:
-    shutDownWebKit();
-#ifdef _CRTDBG_MAP_ALLOC
-    _CrtDumpMemoryLeaks();
-#endif
-
-    // Shut down COM.
-    OleUninitialize();
-
-    delete gWinLauncher;
-    
-    return static_cast&lt;int&gt;(msg.wParam);
-}
-
-ATOM MyRegisterClass(HINSTANCE hInstance)
-{
-    WNDCLASSEX wcex;
-
-    wcex.cbSize = sizeof(WNDCLASSEX);
-
-    wcex.style          = CS_HREDRAW | CS_VREDRAW;
-    wcex.lpfnWndProc    = WndProc;
-    wcex.cbClsExtra     = 0;
-    wcex.cbWndExtra     = 0;
-    wcex.hInstance      = hInstance;
-    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINLAUNCHER));
-    wcex.hCursor        = LoadCursor(0, IDC_ARROW);
-    wcex.hbrBackground  = 0;
-    wcex.lpszMenuName   = MAKEINTRESOURCE(IDC_WINLAUNCHER);
-    wcex.lpszClassName  = szWindowClass;
-    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
-
-    return RegisterClassEx(&amp;wcex);
-}
</del></span></pre>
</div>
</div>

</body>
</html>