1/* 2 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 */ 24 25#include "config.h" 26#include "ChromeClientWinCE.h" 27 28#include "FileChooser.h" 29#include "FileIconLoader.h" 30#include "Icon.h" 31#include "NotImplemented.h" 32#include "NavigationAction.h" 33#include "PopupMenuWin.h" 34#include "SearchPopupMenuWin.h" 35#include "WebView.h" 36#include <wtf/text/CString.h> 37 38using namespace WebCore; 39 40namespace WebKit { 41 42ChromeClientWinCE::ChromeClientWinCE(WebView* webView) 43 : m_webView(webView) 44{ 45 ASSERT(m_webView); 46} 47 48void ChromeClientWinCE::chromeDestroyed() 49{ 50 delete this; 51} 52 53FloatRect ChromeClientWinCE::windowRect() 54{ 55 if (!m_webView) 56 return FloatRect(); 57 58 RECT rect; 59 m_webView->frameRect(&rect); 60 return rect; 61} 62 63void ChromeClientWinCE::setWindowRect(const FloatRect&) 64{ 65 notImplemented(); 66} 67 68FloatRect ChromeClientWinCE::pageRect() 69{ 70 return windowRect(); 71} 72 73void ChromeClientWinCE::focus() 74{ 75 notImplemented(); 76} 77 78void ChromeClientWinCE::unfocus() 79{ 80 notImplemented(); 81} 82 83Page* ChromeClientWinCE::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) 84{ 85 notImplemented(); 86 return 0; 87} 88 89void ChromeClientWinCE::show() 90{ 91 notImplemented(); 92} 93 94bool ChromeClientWinCE::canRunModal() 95{ 96 notImplemented(); 97 return false; 98} 99 100void ChromeClientWinCE::runModal() 101{ 102 notImplemented(); 103} 104 105void ChromeClientWinCE::setToolbarsVisible(bool) 106{ 107 notImplemented(); 108} 109 110bool ChromeClientWinCE::toolbarsVisible() 111{ 112 return false; 113} 114 115void ChromeClientWinCE::setStatusbarVisible(bool) 116{ 117 notImplemented(); 118} 119 120bool ChromeClientWinCE::statusbarVisible() 121{ 122 notImplemented(); 123 return false; 124} 125 126void ChromeClientWinCE::setScrollbarsVisible(bool) 127{ 128 notImplemented(); 129} 130 131bool ChromeClientWinCE::scrollbarsVisible() 132{ 133 notImplemented(); 134 return false; 135} 136 137void ChromeClientWinCE::setMenubarVisible(bool) 138{ 139 notImplemented(); 140} 141 142bool ChromeClientWinCE::menubarVisible() 143{ 144 notImplemented(); 145 return false; 146} 147 148void ChromeClientWinCE::setResizable(bool) 149{ 150 notImplemented(); 151} 152 153void ChromeClientWinCE::closeWindowSoon() 154{ 155 PostMessageW(m_webView->windowHandle(), WM_CLOSE, 0, 0); 156} 157 158bool ChromeClientWinCE::canTakeFocus(FocusDirection) 159{ 160 return true; 161} 162 163void ChromeClientWinCE::takeFocus(FocusDirection) 164{ 165 unfocus(); 166} 167 168void ChromeClientWinCE::focusedElementChanged(Element*) 169{ 170 notImplemented(); 171} 172 173void ChromeClientWinCE::focusedFrameChanged(Frame*) 174{ 175} 176 177bool ChromeClientWinCE::canRunBeforeUnloadConfirmPanel() 178{ 179 return true; 180} 181 182bool ChromeClientWinCE::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) 183{ 184 return runJavaScriptConfirm(frame, message); 185} 186 187void ChromeClientWinCE::addMessageToConsole(MessageSource, MessageLevel, const String&, unsigned, unsigned, const String&) 188{ 189 notImplemented(); 190} 191 192void ChromeClientWinCE::runJavaScriptAlert(Frame*, const String& message) 193{ 194 m_webView->runJavaScriptAlert(message); 195} 196 197bool ChromeClientWinCE::runJavaScriptConfirm(Frame*, const String& message) 198{ 199 return m_webView->runJavaScriptConfirm(message); 200} 201 202bool ChromeClientWinCE::runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) 203{ 204 return m_webView->runJavaScriptPrompt(message, defaultValue, result); 205} 206 207void ChromeClientWinCE::setStatusbarText(const String&) 208{ 209 notImplemented(); 210} 211 212bool ChromeClientWinCE::shouldInterruptJavaScript() 213{ 214 notImplemented(); 215 return false; 216} 217 218KeyboardUIMode ChromeClientWinCE::keyboardUIMode() 219{ 220 return KeyboardAccessTabsToLinks; 221} 222 223IntRect ChromeClientWinCE::windowResizerRect() const 224{ 225 notImplemented(); 226 return IntRect(); 227} 228 229void ChromeClientWinCE::invalidateRootView(const IntRect&) 230{ 231 notImplemented(); 232} 233 234void ChromeClientWinCE::invalidateContentsAndRootView(const IntRect& updateRect) 235{ 236 RECT rect = updateRect; 237 InvalidateRect(m_webView->windowHandle(), &rect, FALSE); 238} 239 240void ChromeClientWinCE::invalidateContentsForSlowScroll(const IntRect& updateRect) 241{ 242 invalidateContentsAndRootView(updateRect); 243} 244 245void ChromeClientWinCE::scroll(const IntSize&, const IntRect& rectToScroll, const IntRect&) 246{ 247 invalidateContentsAndRootView(rectToScroll); 248} 249 250IntRect ChromeClientWinCE::rootViewToScreen(const IntRect& rect) const 251{ 252 notImplemented(); 253 return rect; 254} 255 256IntPoint ChromeClientWinCE::screenToRootView(const IntPoint& point) const 257{ 258 notImplemented(); 259 return point; 260} 261 262PlatformPageClient ChromeClientWinCE::platformPageClient() const 263{ 264 notImplemented(); 265 return 0; 266} 267 268void ChromeClientWinCE::contentsSizeChanged(Frame*, const IntSize&) const 269{ 270 notImplemented(); 271} 272 273void ChromeClientWinCE::scrollbarsModeDidChange() const 274{ 275 notImplemented(); 276} 277 278void ChromeClientWinCE::mouseDidMoveOverElement(const HitTestResult&, unsigned) 279{ 280 notImplemented(); 281} 282 283void ChromeClientWinCE::setToolTip(const String&, TextDirection) 284{ 285 notImplemented(); 286} 287 288void ChromeClientWinCE::print(Frame*) 289{ 290 notImplemented(); 291} 292 293#if ENABLE(SQL_DATABASE) 294void ChromeClientWinCE::exceededDatabaseQuota(Frame*, const String&, DatabaseDetails) 295{ 296 notImplemented(); 297} 298#endif 299 300void ChromeClientWinCE::reachedMaxAppCacheSize(int64_t) 301{ 302 notImplemented(); 303} 304 305void ChromeClientWinCE::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t) 306{ 307 notImplemented(); 308} 309 310#if ENABLE(TOUCH_EVENTS) 311void ChromeClientWinCE::needTouchEvents(bool) 312{ 313 notImplemented(); 314} 315#endif 316 317void ChromeClientWinCE::attachRootGraphicsLayer(Frame*, GraphicsLayer*) 318{ 319 notImplemented(); 320} 321 322void ChromeClientWinCE::setNeedsOneShotDrawingSynchronization() 323{ 324 notImplemented(); 325} 326 327void ChromeClientWinCE::scheduleCompositingLayerFlush() 328{ 329 notImplemented(); 330} 331 332void ChromeClientWinCE::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser) 333{ 334 notImplemented(); 335} 336 337void ChromeClientWinCE::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader) 338{ 339 loader->notifyFinished(Icon::createIconForFiles(filenames)); 340} 341 342void ChromeClientWinCE::setCursor(const Cursor&) 343{ 344 notImplemented(); 345} 346 347void ChromeClientWinCE::setCursorHiddenUntilMouseMoves(bool) 348{ 349 notImplemented(); 350} 351 352void ChromeClientWinCE::setLastSetCursorToCurrentCursor() 353{ 354 notImplemented(); 355} 356 357void ChromeClientWinCE::AXStartFrameLoad() 358{ 359 notImplemented(); 360} 361 362void ChromeClientWinCE::AXFinishFrameLoad() 363{ 364 notImplemented(); 365} 366 367bool ChromeClientWinCE::selectItemWritingDirectionIsNatural() 368{ 369 return false; 370} 371 372bool ChromeClientWinCE::selectItemAlignmentFollowsMenuWritingDirection() 373{ 374 return false; 375} 376 377bool ChromeClientWinCE::hasOpenedPopup() const 378{ 379 notImplemented(); 380 return false; 381} 382 383PassRefPtr<PopupMenu> ChromeClientWinCE::createPopupMenu(PopupMenuClient* client) const 384{ 385 return adoptRef(new PopupMenuWin(client)); 386} 387 388PassRefPtr<SearchPopupMenu> ChromeClientWinCE::createSearchPopupMenu(PopupMenuClient* client) const 389{ 390 return adoptRef(new SearchPopupMenuWin(client)); 391} 392 393} // namespace WebKit 394