2 * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include "ChromeClientWx.h"
30 #include "FloatRect.h"
31 #include "FrameLoadRequest.h"
32 #include "NotImplemented.h"
33 #include "PlatformString.h"
37 #include <wx/wxprec.h>
41 #include <wx/textdlg.h>
45 #include "WebViewPrivate.h"
49 ChromeClientWx::~ChromeClientWx()
53 void ChromeClientWx::chromeDestroyed()
58 void ChromeClientWx::setWindowRect(const FloatRect&)
63 FloatRect ChromeClientWx::windowRect()
69 FloatRect ChromeClientWx::pageRect()
75 float ChromeClientWx::scaleFactor()
81 void ChromeClientWx::focus()
86 void ChromeClientWx::unfocus()
91 bool ChromeClientWx::canTakeFocus(FocusDirection)
97 void ChromeClientWx::takeFocus(FocusDirection)
103 Page* ChromeClientWx::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures&)
106 // FIXME: Create a EVT_WEBKIT_NEW_WINDOW event, and only run this code
107 // when that event is not handled.
110 wxWebFrame* newFrame = new wxWebFrame(wxTheApp->GetAppName());
112 if (newFrame->webview) {
113 newFrame->webview->LoadURL(request.resourceRequest().url().string());
114 newFrame->Show(true);
116 WebViewPrivate* impl = newFrame->webview->m_impl;
118 myPage = impl->frame->page();
124 Page* ChromeClientWx::createModalDialog(Frame*, const FrameLoadRequest&)
130 void ChromeClientWx::show()
135 bool ChromeClientWx::canRunModal()
141 void ChromeClientWx::runModal()
146 void ChromeClientWx::setToolbarsVisible(bool)
151 bool ChromeClientWx::toolbarsVisible()
157 void ChromeClientWx::setStatusbarVisible(bool)
162 bool ChromeClientWx::statusbarVisible()
168 void ChromeClientWx::setScrollbarsVisible(bool)
173 bool ChromeClientWx::scrollbarsVisible()
179 void ChromeClientWx::setMenubarVisible(bool)
184 bool ChromeClientWx::menubarVisible()
190 void ChromeClientWx::setResizable(bool)
195 void ChromeClientWx::addMessageToConsole(const String&,
202 bool ChromeClientWx::canRunBeforeUnloadConfirmPanel()
208 bool ChromeClientWx::runBeforeUnloadConfirmPanel(const String& string,
211 wxMessageDialog dialog(NULL, string, wxT("Confirm Action?"), wxYES_NO);
212 return dialog.ShowModal() == wxYES;
215 void ChromeClientWx::closeWindowSoon()
221 Sites for testing prompts:
222 Alert - just type in a bad web address or http://www.htmlite.com/JS002.php
223 Prompt - http://www.htmlite.com/JS007.php
224 Confirm - http://www.htmlite.com/JS006.php
227 void ChromeClientWx::runJavaScriptAlert(Frame* frame, const String& string)
229 wxMessageBox(string, wxT("JavaScript Alert"), wxOK);
232 bool ChromeClientWx::runJavaScriptConfirm(Frame* frame, const String& string)
234 wxMessageDialog dialog(NULL, string, wxT("JavaScript Confirm"), wxYES_NO);
236 return (dialog.ShowModal() == wxID_YES);
239 bool ChromeClientWx::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
241 wxTextEntryDialog dialog(NULL, message, wxT("JavaScript Prompt"), wxEmptyString, wxOK | wxCANCEL);
243 if (dialog.ShowModal() == wxID_OK) {
244 result = dialog.GetValue();
251 void ChromeClientWx::setStatusbarText(const String&)
256 bool ChromeClientWx::shouldInterruptJavaScript()
262 bool ChromeClientWx::tabsToLinks() const
268 IntRect ChromeClientWx::windowResizerRect() const
274 void ChromeClientWx::addToDirtyRegion(const IntRect&)
279 void ChromeClientWx::scrollBackingStore(int dx, int dy,
280 const IntRect& scrollViewRect,
281 const IntRect& clipRect)
286 void ChromeClientWx::updateBackingStore()
291 void ChromeClientWx::mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags)
296 void ChromeClientWx::setToolTip(const String&)
300 void ChromeClientWx::print(Frame*)
305 unsigned long long ChromeClientWx::requestQuotaIncreaseForNewDatabase(Frame*, SecurityOrigin*, const String&, unsigned long long)
311 unsigned long long ChromeClientWx::requestQuotaIncreaseForDatabaseOperation(Frame*, SecurityOrigin*, const String&, unsigned long long)