1 /* 2 * Copyright (C) 2010 Patrick Gansterer <paroga (at) 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 "Icon.h" 30 #include "NotImplemented.h" 31 #include "NavigationAction.h" 32 #include "PopupMenuWin.h" 33 #include "SearchPopupMenuWin.h" 34 #include "WebView.h" 35 #include <wtf/text/CString.h> 36 37 using namespace WebCore; 38 39 namespace WebKit { 40 41 ChromeClientWinCE::ChromeClientWinCE(WebView* webView) 42 : m_webView(webView) 43 { 44 ASSERT(m_webView); 45 } 46 47 void ChromeClientWinCE::chromeDestroyed() 48 { 49 delete this; 50 } 51 52 FloatRect ChromeClientWinCE::windowRect() 53 { 54 if (!m_webView) 55 return FloatRect(); 56 57 RECT rect; 58 m_webView->frameRect(&rect); 59 return rect; 60 } 61 62 void ChromeClientWinCE::setWindowRect(const FloatRect&) 63 { 64 notImplemented(); 65 } 66 67 FloatRect ChromeClientWinCE::pageRect() 68 { 69 return windowRect(); 70 } 71 72 float ChromeClientWinCE::scaleFactor() 73 { 74 return 1.0; 75 } 76 77 void ChromeClientWinCE::focus() 78 { 79 notImplemented(); 80 } 81 82 void ChromeClientWinCE::unfocus() 83 { 84 notImplemented(); 85 } 86 87 Page* ChromeClientWinCE::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) 88 { 89 notImplemented(); 90 return 0; 91 } 92 93 void ChromeClientWinCE::show() 94 { 95 notImplemented(); 96 } 97 98 bool ChromeClientWinCE::canRunModal() 99 { 100 notImplemented(); 101 return false; 102 } 103 104 void ChromeClientWinCE::runModal() 105 { 106 notImplemented(); 107 } 108 109 void ChromeClientWinCE::setToolbarsVisible(bool) 110 { 111 notImplemented(); 112 } 113 114 bool ChromeClientWinCE::toolbarsVisible() 115 { 116 return false; 117 } 118 119 void ChromeClientWinCE::setStatusbarVisible(bool) 120 { 121 notImplemented(); 122 } 123 124 bool ChromeClientWinCE::statusbarVisible() 125 { 126 notImplemented(); 127 return false; 128 } 129 130 void ChromeClientWinCE::setScrollbarsVisible(bool) 131 { 132 notImplemented(); 133 } 134 135 bool ChromeClientWinCE::scrollbarsVisible() 136 { 137 notImplemented(); 138 return false; 139 } 140 141 void ChromeClientWinCE::setMenubarVisible(bool) 142 { 143 notImplemented(); 144 } 145 146 bool ChromeClientWinCE::menubarVisible() 147 { 148 notImplemented(); 149 return false; 150 } 151 152 void ChromeClientWinCE::setResizable(bool) 153 { 154 notImplemented(); 155 } 156 157 void ChromeClientWinCE::closeWindowSoon() 158 { 159 PostMessageW(m_webView->windowHandle(), WM_CLOSE, 0, 0); 160 } 161 162 bool ChromeClientWinCE::canTakeFocus(FocusDirection) 163 { 164 return true; 165 } 166 167 void ChromeClientWinCE::takeFocus(FocusDirection) 168 { 169 unfocus(); 170 } 171 172 void ChromeClientWinCE::focusedNodeChanged(Node*) 173 { 174 notImplemented(); 175 } 176 177 void ChromeClientWinCE::focusedFrameChanged(Frame*) 178 { 179 } 180 181 bool ChromeClientWinCE::canRunBeforeUnloadConfirmPanel() 182 { 183 return true; 184 } 185 186 bool ChromeClientWinCE::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) 187 { 188 return runJavaScriptConfirm(frame, message); 189 } 190 191 void ChromeClientWinCE::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String&, unsigned int, const String&) 192 { 193 notImplemented(); 194 } 195 196 void ChromeClientWinCE::runJavaScriptAlert(Frame*, const String& message) 197 { 198 m_webView->runJavaScriptAlert(message); 199 } 200 201 bool ChromeClientWinCE::runJavaScriptConfirm(Frame*, const String& message) 202 { 203 return m_webView->runJavaScriptConfirm(message); 204 } 205 206 bool ChromeClientWinCE::runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) 207 { 208 return m_webView->runJavaScriptPrompt(message, defaultValue, result); 209 } 210 211 void ChromeClientWinCE::setStatusbarText(const String&) 212 { 213 notImplemented(); 214 } 215 216 bool ChromeClientWinCE::shouldInterruptJavaScript() 217 { 218 notImplemented(); 219 return false; 220 } 221 222 KeyboardUIMode ChromeClientWinCE::keyboardUIMode() 223 { 224 return KeyboardAccessTabsToLinks; 225 } 226 227 IntRect ChromeClientWinCE::windowResizerRect() const 228 { 229 notImplemented(); 230 return IntRect(); 231 } 232 233 void ChromeClientWinCE::invalidateWindow(const IntRect&, bool) 234 { 235 notImplemented(); 236 } 237 238 void ChromeClientWinCE::invalidateContentsAndWindow(const IntRect& updateRect, bool immediate) 239 { 240 RECT rect = updateRect; 241 InvalidateRect(m_webView->windowHandle(), &rect, FALSE); 242 243 if (immediate) 244 UpdateWindow(m_webView->windowHandle()); 245 } 246 247 void ChromeClientWinCE::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate) 248 { 249 invalidateContentsAndWindow(updateRect, immediate); 250 } 251 252 void ChromeClientWinCE::scroll(const IntSize&, const IntRect& rectToScroll, const IntRect&) 253 { 254 invalidateContentsAndWindow(rectToScroll, false); 255 } 256 257 IntRect ChromeClientWinCE::windowToScreen(const IntRect& rect) const 258 { 259 notImplemented(); 260 return rect; 261 } 262 263 IntPoint ChromeClientWinCE::screenToWindow(const IntPoint& point) const 264 { 265 notImplemented(); 266 return point; 267 } 268 269 PlatformPageClient ChromeClientWinCE::platformPageClient() const 270 { 271 notImplemented(); 272 return 0; 273 } 274 275 void ChromeClientWinCE::contentsSizeChanged(Frame*, const IntSize&) const 276 { 277 notImplemented(); 278 } 279 280 void ChromeClientWinCE::scrollRectIntoView(const IntRect&, const ScrollView*) const 281 { 282 notImplemented(); 283 } 284 285 void ChromeClientWinCE::scrollbarsModeDidChange() const 286 { 287 notImplemented(); 288 } 289 290 void ChromeClientWinCE::mouseDidMoveOverElement(const HitTestResult&, unsigned) 291 { 292 notImplemented(); 293 } 294 295 void ChromeClientWinCE::setToolTip(const String&, TextDirection) 296 { 297 notImplemented(); 298 } 299 300 void ChromeClientWinCE::print(Frame*) 301 { 302 notImplemented(); 303 } 304 305 #if ENABLE(DATABASE) 306 void ChromeClientWinCE::exceededDatabaseQuota(Frame*, const String&) 307 { 308 notImplemented(); 309 } 310 #endif 311 312 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 313 void ChromeClientWinCE::reachedMaxAppCacheSize(int64_t) 314 { 315 notImplemented(); 316 } 317 318 void ChromeClientWinCE::reachedApplicationCacheOriginQuota(SecurityOrigin*) 319 { 320 notImplemented(); 321 } 322 #endif 323 324 #if ENABLE(TOUCH_EVENTS) 325 void ChromeClientWinCE::needTouchEvents(bool) 326 { 327 notImplemented(); 328 } 329 #endif 330 331 #if USE(ACCELERATED_COMPOSITING) 332 void ChromeClientWinCE::attachRootGraphicsLayer(Frame*, GraphicsLayer*) 333 { 334 notImplemented(); 335 } 336 337 void ChromeClientWinCE::setNeedsOneShotDrawingSynchronization() 338 { 339 notImplemented(); 340 } 341 342 void ChromeClientWinCE::scheduleCompositingLayerSync() 343 { 344 notImplemented(); 345 } 346 #endif 347 348 void ChromeClientWinCE::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser) 349 { 350 notImplemented(); 351 } 352 353 void ChromeClientWinCE::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser) 354 { 355 chooser->iconLoaded(Icon::createIconForFiles(filenames)); 356 } 357 358 void ChromeClientWinCE::setCursor(const Cursor&) 359 { 360 notImplemented(); 361 } 362 363 void ChromeClientWinCE::setLastSetCursorToCurrentCursor() 364 { 365 notImplemented(); 366 } 367 368 void ChromeClientWinCE::formStateDidChange(const Node*) 369 { 370 notImplemented(); 371 } 372 373 void ChromeClientWinCE::requestGeolocationPermissionForFrame(Frame*, Geolocation*) 374 { 375 notImplemented(); 376 } 377 378 void ChromeClientWinCE::cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) 379 { 380 notImplemented(); 381 } 382 383 bool ChromeClientWinCE::selectItemWritingDirectionIsNatural() 384 { 385 return false; 386 } 387 388 bool ChromeClientWinCE::selectItemAlignmentFollowsMenuWritingDirection() 389 { 390 return false; 391 } 392 393 PassRefPtr<PopupMenu> ChromeClientWinCE::createPopupMenu(PopupMenuClient* client) const 394 { 395 return adoptRef(new PopupMenuWin(client)); 396 } 397 398 PassRefPtr<SearchPopupMenu> ChromeClientWinCE::createSearchPopupMenu(PopupMenuClient* client) const 399 { 400 return adoptRef(new SearchPopupMenuWin(client)); 401 } 402 403 } // namespace WebKit 404