diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKitTools/MiniBrowser/win | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKitTools/MiniBrowser/win')
-rw-r--r-- | WebKitTools/MiniBrowser/win/BrowserView.cpp | 145 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/BrowserView.h | 49 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/BrowserWindow.cpp | 261 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/BrowserWindow.h | 70 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/MiniBrowser.cpp | 84 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/MiniBrowser.h | 55 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/MiniBrowser.rc | 79 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/main.cpp | 62 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/resource.h | 23 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/stdafx.cpp | 33 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/stdafx.h | 33 |
11 files changed, 0 insertions, 894 deletions
diff --git a/WebKitTools/MiniBrowser/win/BrowserView.cpp b/WebKitTools/MiniBrowser/win/BrowserView.cpp deleted file mode 100644 index b182740..0000000 --- a/WebKitTools/MiniBrowser/win/BrowserView.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 "StdAfx.h" -#include "BrowserView.h" - -#include "BrowserWindow.h" -#include <WebKit2/WKContextPrivate.h> -#include <WebKit2/WKURLCF.h> - -static const unsigned short HIGH_BIT_MASK_SHORT = 0x8000; - -BrowserView::BrowserView() - : m_webView(0) -{ -} - -// UI Client Callbacks - -static WKPageRef createNewPage(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void* clientInfo) -{ - BrowserWindow* browserWindow = BrowserWindow::create(); - browserWindow->createWindow(0, 0, 800, 600); - - return WKViewGetPage(browserWindow->view().webView()); -} - -static void showPage(WKPageRef page, const void *clientInfo) -{ - static_cast<BrowserWindow*>(const_cast<void*>(clientInfo))->showWindow(); -} - -static void closePage(WKPageRef page, const void *clientInfo) -{ -} - -static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo) -{ -} - -static bool runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo) -{ - return false; -} - -static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void* clientInfo) -{ - return 0; -} - -static void setStatusText(WKPageRef page, WKStringRef text, const void* clientInfo) -{ -} - -static void mouseDidMoveOverElement(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo) -{ -} - -void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow) -{ - assert(!m_webView); - - bool isShiftKeyDown = ::GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT; - - WKContextRef context; - if (isShiftKeyDown) - context = WKContextGetSharedThreadContext(); - else - context = WKContextGetSharedProcessContext(); - - WKPageNamespaceRef pageNamespace = WKPageNamespaceCreate(context); - - m_webView = WKViewCreate(webViewRect, pageNamespace, parentWindow->window()); - - WKPageUIClient uiClient = { - 0, /* version */ - parentWindow, /* clientInfo */ - createNewPage, - showPage, - closePage, - runJavaScriptAlert, - runJavaScriptConfirm, - runJavaScriptPrompt, - setStatusText, - mouseDidMoveOverElement, - 0, /* didNotHandleKeyEvent */ - 0, /* toolbarsAreVisible */ - 0, /* setToolbarsAreVisible */ - 0, /* menuBarIsVisible */ - 0, /* setMenuBarIsVisible */ - 0, /* statusBarIsVisible */ - 0, /* setStatusBarIsVisible */ - 0, /* isResizable */ - 0, /* setIsResizable */ - 0, /* getWindowFrame */ - 0, /* setWindowFrame */ - 0, /* runBeforeUnloadConfirmPanel */ - 0, /* didDraw */ - 0 /* pageDidScroll */ - }; - - WKPageSetPageUIClient(WKViewGetPage(m_webView), &uiClient); -} - -void BrowserView::setFrame(RECT rect) -{ - HWND webViewWindow = WKViewGetWindow(m_webView); - ::SetWindowPos(webViewWindow, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS); -} - -void BrowserView::goToURL(const std::wstring& urlString) -{ - CFStringRef string = CFStringCreateWithCharacters(0, (const UniChar*)urlString.data(), urlString.size()); - CFURLRef cfURL = CFURLCreateWithString(0, string, 0); - CFRelease(string); - - WKURLRef url = WKURLCreateWithCFURL(cfURL); - CFRelease(cfURL); - - WKPageRef page = WKViewGetPage(m_webView); - WKPageLoadURL(page, url); - WKRelease(url); -} diff --git a/WebKitTools/MiniBrowser/win/BrowserView.h b/WebKitTools/MiniBrowser/win/BrowserView.h deleted file mode 100644 index 08c5e4a..0000000 --- a/WebKitTools/MiniBrowser/win/BrowserView.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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. - */ - -#ifndef BrowserView_h -#define BrowserView_h - -#include <WebKit2/WebKit2.h> -#include <string> - -class BrowserWindow; - -class BrowserView { -public: - BrowserView(); - - void goToURL(const std::wstring& url); - - void create(RECT, BrowserWindow* parentWindow); - void setFrame(RECT); - - WKViewRef webView() const { return m_webView; } - -private: - WKViewRef m_webView; -}; - -#endif // BrowserView_h diff --git a/WebKitTools/MiniBrowser/win/BrowserWindow.cpp b/WebKitTools/MiniBrowser/win/BrowserWindow.cpp deleted file mode 100644 index dc43a68..0000000 --- a/WebKitTools/MiniBrowser/win/BrowserWindow.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 "StdAfx.h" -#include "BrowserWindow.h" -#include "MiniBrowser.h" -#include "Resource.h" - -#include <assert.h> -#include <commctrl.h> -#include <shlwapi.h> -#include <vector> -#include <wininet.h> - -using namespace std; - -BrowserWindow::BrowserWindow() - : m_window(0) - , m_rebarWindow(0) - , m_comboBoxWindow(0) -{ -} - -LRESULT CALLBACK BrowserWindow::BrowserWindowWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) -{ - LONG_PTR longPtr = ::GetWindowLongPtr(window, 0); - - if (BrowserWindow* browserView = reinterpret_cast<BrowserWindow*>(longPtr)) - return browserView->wndProc(window, message, wParam, lParam); - - if (message == WM_CREATE) { - LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); - BrowserWindow* browserWindow = static_cast<BrowserWindow*>(createStruct->lpCreateParams); - browserWindow->m_window = window; - - ::SetWindowLongPtr(window, 0, (LONG_PTR)browserWindow); - - browserWindow->onCreate(createStruct); - return 0; - } - - return ::DefWindowProc(window, message, wParam, lParam); -} - -LRESULT BrowserWindow::wndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) -{ - LRESULT lResult = 0; - bool handled = true; - - switch (message) { - case WM_ERASEBKGND: - lResult = 1; - break; - - case WM_COMMAND: - lResult = onCommand(LOWORD(wParam), handled); - break; - - case WM_SIZE: - onSize(LOWORD(lParam), HIWORD(lParam)); - break; - - case WM_DESTROY: - onDestroy(); - break; - - case WM_NCDESTROY: - onNCDestroy(); - break; - - default: - handled = false; - } - - if (!handled) - lResult = ::DefWindowProc(window, message, wParam, lParam); - - return lResult; -} - -void BrowserWindow::createWindow(int x, int y, int width, int height) -{ - assert(!m_window); - - // Register the class. - WNDCLASSEX windowClass = { 0 }; - windowClass.cbSize = sizeof(windowClass); - windowClass.style = 0; - windowClass.lpfnWndProc = BrowserWindowWndProc; - windowClass.cbClsExtra = 0; - windowClass.cbWndExtra = sizeof(this); - windowClass.hInstance = MiniBrowser::shared().instance(); - windowClass.hIcon = 0; - windowClass.hCursor = ::LoadCursor(0, IDC_ARROW); - windowClass.hbrBackground = (HBRUSH)::GetStockObject(WHITE_BRUSH); - windowClass.lpszMenuName = MAKEINTRESOURCE(IDR_MAINFRAME); - windowClass.lpszClassName = L"MiniBrowser"; - windowClass.hIconSm = 0; - - ::RegisterClassEx(&windowClass); - - ::CreateWindowW(L"MiniBrowser", L"MiniBrowser", WS_OVERLAPPEDWINDOW, x, y, width, height, 0, 0, MiniBrowser::shared().instance(), this); -} - -void BrowserWindow::showWindow() -{ - assert(m_window); - - ::ShowWindow(m_window, SW_SHOWNORMAL); -} - -void BrowserWindow::goToURL(const std::wstring& url) -{ - m_browserView.goToURL(url); -} - -void BrowserWindow::onCreate(LPCREATESTRUCT createStruct) -{ - // Register our window. - MiniBrowser::shared().registerWindow(this); - - // Create the rebar control. - m_rebarWindow = ::CreateWindowEx(0, REBARCLASSNAME, 0, WS_VISIBLE | WS_BORDER | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NOPARENTALIGN | RBS_VARHEIGHT | RBS_BANDBORDERS, - 0, 0, 0, 0, m_window, 0, createStruct->hInstance, 0); - REBARINFO rebarInfo = { 0 }; - rebarInfo.cbSize = sizeof(rebarInfo); - rebarInfo.fMask = 0; - ::SendMessage(m_rebarWindow, RB_SETBARINFO, 0, (LPARAM)&rebarInfo); - - // Create the combo box control. - m_comboBoxWindow = ::CreateWindowEx(0, L"combobox", 0, WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_VSCROLL | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CBS_AUTOHSCROLL | CBS_DROPDOWN, - 0, 0, 0, 0, m_rebarWindow, 0, createStruct->hInstance, 0); - SendMessage(m_comboBoxWindow, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0)); - - REBARBANDINFO bandInfo; - bandInfo.cbSize = sizeof(bandInfo); - bandInfo.fMask = RBBIM_STYLE | RBBIM_TEXT | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE; - bandInfo.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS; - bandInfo.lpText = L"Address"; - bandInfo.hwndChild = m_comboBoxWindow; - - RECT comboBoxRect; - ::GetWindowRect(m_comboBoxWindow, &comboBoxRect); - bandInfo.cx = 100; - bandInfo.cxMinChild = comboBoxRect.right - comboBoxRect.left; - bandInfo.cyMinChild = comboBoxRect.bottom - comboBoxRect.top; - - // Add the band to the rebar. - int result = ::SendMessage(m_rebarWindow, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&bandInfo); - - // Create the browser view. - RECT webViewRect = { 0, 0, 0, 0}; - m_browserView.create(webViewRect, this); -} - -void BrowserWindow::onDestroy() -{ - MiniBrowser::shared().unregisterWindow(this); - - // FIXME: Should we close the browser view here? -} - -void BrowserWindow::onNCDestroy() -{ - delete this; -} - -void BrowserWindow::onSize(int width, int height) -{ - RECT rebarRect; - ::GetClientRect(m_rebarWindow, &rebarRect); - - // Resize the rebar. - ::MoveWindow(m_rebarWindow, 0, 0, width, rebarRect.bottom - rebarRect.top, true); - - RECT webViewRect; - webViewRect.top = rebarRect.bottom; - webViewRect.left = 0; - webViewRect.right = width; - webViewRect.bottom = height; - m_browserView.setFrame(webViewRect); -} - -LRESULT BrowserWindow::onCommand(int commandID, bool& handled) -{ - switch (commandID) { - case ID_FILE_NEW_WINDOW: - MiniBrowser::shared().createNewWindow(); - break; - case ID_FILE_CLOSE: - ::PostMessage(m_window, WM_CLOSE, 0, 0); - break; - case ID_DEBUG_SHOW_WEB_VIEW: { - HMENU menu = ::GetMenu(m_window); - bool shouldHide = ::GetMenuState(menu, ID_DEBUG_SHOW_WEB_VIEW, MF_BYCOMMAND) & MF_CHECKED; - - ::CheckMenuItem(menu, ID_DEBUG_SHOW_WEB_VIEW, MF_BYCOMMAND | (shouldHide ? MF_UNCHECKED : MF_CHECKED)); - - // Show or hide the web view. - HWND webViewWindow = WKViewGetWindow(m_browserView.webView()); - ::ShowWindow(webViewWindow, shouldHide ? SW_HIDE : SW_SHOW); - break; - } - default: - handled = false; - } - - return 0; -} - -bool BrowserWindow::handleMessage(const MSG* message) -{ - if (message->hwnd != m_comboBoxWindow && !::IsChild(m_comboBoxWindow, message->hwnd)) - return false; - - // Look for a WM_KEYDOWN message. - if (message->message != WM_KEYDOWN) - return false; - - // Look for the VK_RETURN key. - if (message->wParam != VK_RETURN) - return false; - - std::vector<WCHAR> buffer; - int textLength = ::GetWindowTextLength(m_comboBoxWindow); - - buffer.resize(textLength + 1); - ::GetWindowText(m_comboBoxWindow, &buffer[0], buffer.size()); - - std::wstring url(&buffer[0], buffer.size() - 1); - - if (url.find(L"http://")) - url = L"http://" + url; - - m_browserView.goToURL(url); - - // We handled this message. - return true; -} diff --git a/WebKitTools/MiniBrowser/win/BrowserWindow.h b/WebKitTools/MiniBrowser/win/BrowserWindow.h deleted file mode 100644 index 1cf7350..0000000 --- a/WebKitTools/MiniBrowser/win/BrowserWindow.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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. - */ - -#ifndef BrowserWindow_h -#define BrowserWindow_h - -#include "BrowserView.h" -#include <string> - -class BrowserWindow { -public: - static BrowserWindow* create() - { - return new BrowserWindow; - } - - void createWindow(int x, int y, int width, int height); - void showWindow(); - - void goToURL(const std::wstring& url); - - bool handleMessage(const MSG*); - - const BrowserView& view() const { return m_browserView; } - HWND window() const { return m_window; } - -private: - BrowserWindow(); - - static LRESULT CALLBACK BrowserWindowWndProc(HWND, UINT, WPARAM, LPARAM); - - // Message handlers. - LRESULT wndProc(HWND, UINT, WPARAM, LPARAM); - void onCreate(LPCREATESTRUCT); - void onDestroy(); - void onNCDestroy(); - - void onSize(int width, int height); - LRESULT onCommand(int commandID, bool& handled); - - HWND m_window; - - HWND m_rebarWindow; - HWND m_comboBoxWindow; - BrowserView m_browserView; -}; - -#endif // BrowserWindow_h diff --git a/WebKitTools/MiniBrowser/win/MiniBrowser.cpp b/WebKitTools/MiniBrowser/win/MiniBrowser.cpp deleted file mode 100644 index 7e3d488..0000000 --- a/WebKitTools/MiniBrowser/win/MiniBrowser.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 "stdafx.h" - -#include "BrowserWindow.h" -#include "MiniBrowser.h" -#include <assert.h> - -MiniBrowser::MiniBrowser() - : m_instance(0) -{ -} - -MiniBrowser& MiniBrowser::shared() -{ - static MiniBrowser miniBrowser; - - return miniBrowser; -} - -void MiniBrowser::initialize(HINSTANCE instance) -{ - assert(!m_instance); - - m_instance = instance; -} - -void MiniBrowser::createNewWindow() -{ - static const wchar_t* kDefaultURLString = L"http://webkit.org/"; - - BrowserWindow* browserWindow = BrowserWindow::create(); - browserWindow->createWindow(0, 0, 800, 600); - browserWindow->showWindow(); - browserWindow->goToURL(kDefaultURLString); -} - -void MiniBrowser::registerWindow(BrowserWindow* window) -{ - m_browserWindows.insert(window); -} - -void MiniBrowser::unregisterWindow(BrowserWindow* window) -{ - m_browserWindows.erase(window); - - if (m_browserWindows.empty()) - ::PostQuitMessage(0); -} - -bool MiniBrowser::handleMessage(const MSG* message) -{ - for (std::set<BrowserWindow*>::const_iterator it = m_browserWindows.begin(), end = m_browserWindows.end(); it != end; ++it) { - BrowserWindow* browserWindow = *it; - - if (browserWindow->handleMessage(message)) - return true; - } - - return false; -} diff --git a/WebKitTools/MiniBrowser/win/MiniBrowser.h b/WebKitTools/MiniBrowser/win/MiniBrowser.h deleted file mode 100644 index c7b5177..0000000 --- a/WebKitTools/MiniBrowser/win/MiniBrowser.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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. - */ - -#ifndef MiniBrowser_h -#define MiniBrowser_h - -#include <set> - -class BrowserWindow; - -class MiniBrowser { -public: - static MiniBrowser& shared(); - - void initialize(HINSTANCE); - - void createNewWindow(); - - void registerWindow(BrowserWindow*); - void unregisterWindow(BrowserWindow*); - - bool handleMessage(const MSG*); - - HINSTANCE instance() const { return m_instance; } - -private: - MiniBrowser(); - - HINSTANCE m_instance; - std::set<BrowserWindow*> m_browserWindows; -}; - -#endif // MiniBrowser_h diff --git a/WebKitTools/MiniBrowser/win/MiniBrowser.rc b/WebKitTools/MiniBrowser/win/MiniBrowser.rc deleted file mode 100644 index 0ff88b0..0000000 --- a/WebKitTools/MiniBrowser/win/MiniBrowser.rc +++ /dev/null @@ -1,79 +0,0 @@ -// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-#include "winresrc.h" -
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Menu
-//
-
-IDR_MAINFRAME MENU
-BEGIN
- POPUP "&File"
- BEGIN
- MENUITEM "&New Window\tCtrl+N", ID_FILE_NEW_WINDOW
- MENUITEM SEPARATOR
- MENUITEM "&Close", ID_FILE_CLOSE
- END
- POPUP "&Debug"
- BEGIN
- MENUITEM "&Show WebView", ID_DEBUG_SHOW_WEB_VIEW, CHECKED
- END
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Accelerator
-//
-
-IDR_MAINFRAME_ACCEL ACCELERATORS
-BEGIN
- "N", ID_FILE_NEW_WINDOW, VIRTKEY, CONTROL, NOINVERT
-END
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.\0"
-END
-
-
-3 TEXTINCLUDE
-BEGIN
- "\r\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/WebKitTools/MiniBrowser/win/main.cpp b/WebKitTools/MiniBrowser/win/main.cpp deleted file mode 100644 index 0c125ba..0000000 --- a/WebKitTools/MiniBrowser/win/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 "stdafx.h" - -#include "BrowserWindow.h" -#include "MiniBrowser.h" -#include <string> - -#if defined _M_IX86 -#define PROCESSORARCHITECTURE "x86" -#elif defined _M_IA64 -#define PROCESSORARCHITECTURE "ia64" -#elif defined _M_X64 -#define PROCESSORARCHITECTURE "amd64" -#else -#define PROCESSORARCHITECTURE "*" -#endif - -#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='" PROCESSORARCHITECTURE "' publicKeyToken='6595b64144ccf1df' language='*'\"") - -int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow) -{ - MiniBrowser::shared().initialize(hInstance); - - // Create and show our initial window. - MiniBrowser::shared().createNewWindow(); - - MSG message; - while (BOOL result = ::GetMessage(&message, 0, 0, 0)) { - if (result == -1) - break; - ::TranslateMessage(&message); - - if (!MiniBrowser::shared().handleMessage(&message)) - ::DispatchMessage(&message); - } - - return 0; -} diff --git a/WebKitTools/MiniBrowser/win/resource.h b/WebKitTools/MiniBrowser/win/resource.h deleted file mode 100644 index b12b906..0000000 --- a/WebKitTools/MiniBrowser/win/resource.h +++ /dev/null @@ -1,23 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by MiniBrowser.rc -// - -#define ID_FILE_NEW_WINDOW 32770 -#define ID_FILE_OPEN 32771 -#define ID_FILE_CLOSE 32772 -#define ID_DEBUG_SHOW_WEB_VIEW 32773 - -#define IDR_MAINFRAME 128 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 132 -#define _APS_NEXT_COMMAND_VALUE 32775 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif diff --git a/WebKitTools/MiniBrowser/win/stdafx.cpp b/WebKitTools/MiniBrowser/win/stdafx.cpp deleted file mode 100644 index c664e32..0000000 --- a/WebKitTools/MiniBrowser/win/stdafx.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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. - */ - -// stdafx.cpp : source file that includes just the standard includes -// MiniBrowser.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/WebKitTools/MiniBrowser/win/stdafx.h b/WebKitTools/MiniBrowser/win/stdafx.h deleted file mode 100644 index 2f531bb..0000000 --- a/WebKitTools/MiniBrowser/win/stdafx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2010 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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. - */ - -#define STRICT -#define WIN32_LEAN_AND_MEAN - -#include <tchar.h> -#include <windows.h> - - - |