| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebViewImpl_h | 31 #ifndef WebViewImpl_h |
| 32 #define WebViewImpl_h | 32 #define WebViewImpl_h |
| 33 | 33 |
| 34 #include "core/html/ime/InputMethodContext.h" | 34 #include "core/html/ime/InputMethodContext.h" |
| 35 #include "core/page/ContextMenuProvider.h" | |
| 36 #include "platform/geometry/IntPoint.h" | 35 #include "platform/geometry/IntPoint.h" |
| 37 #include "platform/geometry/IntRect.h" | 36 #include "platform/geometry/IntRect.h" |
| 38 #include "platform/graphics/GraphicsLayer.h" | 37 #include "platform/graphics/GraphicsLayer.h" |
| 39 #include "public/platform/WebGestureCurveTarget.h" | 38 #include "public/platform/WebGestureCurveTarget.h" |
| 40 #include "public/platform/WebLayer.h" | 39 #include "public/platform/WebLayer.h" |
| 41 #include "public/platform/WebPoint.h" | 40 #include "public/platform/WebPoint.h" |
| 42 #include "public/platform/WebRect.h" | 41 #include "public/platform/WebRect.h" |
| 43 #include "public/platform/WebSize.h" | 42 #include "public/platform/WebSize.h" |
| 44 #include "public/platform/WebString.h" | 43 #include "public/platform/WebString.h" |
| 45 #include "public/web/WebInputEvent.h" | 44 #include "public/web/WebInputEvent.h" |
| 46 #include "public/web/WebNavigationPolicy.h" | 45 #include "public/web/WebNavigationPolicy.h" |
| 47 #include "public/web/WebView.h" | 46 #include "public/web/WebView.h" |
| 48 #include "web/ChromeClientImpl.h" | 47 #include "web/ChromeClientImpl.h" |
| 49 #include "web/ContextMenuClientImpl.h" | |
| 50 #include "web/EditorClientImpl.h" | 48 #include "web/EditorClientImpl.h" |
| 51 #include "web/PageOverlayList.h" | 49 #include "web/PageOverlayList.h" |
| 52 #include "web/PageWidgetDelegate.h" | 50 #include "web/PageWidgetDelegate.h" |
| 53 #include "web/SpellCheckerClientImpl.h" | 51 #include "web/SpellCheckerClientImpl.h" |
| 54 #include "wtf/OwnPtr.h" | 52 #include "wtf/OwnPtr.h" |
| 55 #include "wtf/RefCounted.h" | 53 #include "wtf/RefCounted.h" |
| 56 #include "wtf/Vector.h" | 54 #include "wtf/Vector.h" |
| 57 | 55 |
| 58 namespace blink { | 56 namespace blink { |
| 59 | 57 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 virtual void saveImageAt(const WebPoint&) OVERRIDE; | 168 virtual void saveImageAt(const WebPoint&) OVERRIDE; |
| 171 virtual void dragSourceSystemDragEnded() OVERRIDE; | 169 virtual void dragSourceSystemDragEnded() OVERRIDE; |
| 172 virtual void spellingMarkers(WebVector<uint32_t>* markers) OVERRIDE; | 170 virtual void spellingMarkers(WebVector<uint32_t>* markers) OVERRIDE; |
| 173 virtual void removeSpellingMarkersUnderWords(const WebVector<WebString>& wor
ds) OVERRIDE; | 171 virtual void removeSpellingMarkersUnderWords(const WebVector<WebString>& wor
ds) OVERRIDE; |
| 174 virtual void setCompositorDeviceScaleFactorOverride(float) OVERRIDE; | 172 virtual void setCompositorDeviceScaleFactorOverride(float) OVERRIDE; |
| 175 virtual void setRootLayerTransform(const WebSize& offset, float scale) OVERR
IDE; | 173 virtual void setRootLayerTransform(const WebSize& offset, float scale) OVERR
IDE; |
| 176 virtual void setSelectionColors(unsigned activeBackgroundColor, | 174 virtual void setSelectionColors(unsigned activeBackgroundColor, |
| 177 unsigned activeForegroundColor, | 175 unsigned activeForegroundColor, |
| 178 unsigned inactiveBackgroundColor, | 176 unsigned inactiveBackgroundColor, |
| 179 unsigned inactiveForegroundColor) OVERRIDE; | 177 unsigned inactiveForegroundColor) OVERRIDE; |
| 180 virtual void performCustomContextMenuAction(unsigned action) OVERRIDE; | |
| 181 virtual void showContextMenu() OVERRIDE; | |
| 182 virtual void extractSmartClipData(WebRect, WebString&, WebString&, WebRect&)
OVERRIDE; | 178 virtual void extractSmartClipData(WebRect, WebString&, WebString&, WebRect&)
OVERRIDE; |
| 183 virtual void addPageOverlay(WebPageOverlay*, int /* zOrder */) OVERRIDE; | 179 virtual void addPageOverlay(WebPageOverlay*, int /* zOrder */) OVERRIDE; |
| 184 virtual void removePageOverlay(WebPageOverlay*) OVERRIDE; | 180 virtual void removePageOverlay(WebPageOverlay*) OVERRIDE; |
| 185 virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingPara
meters&) OVERRIDE; | 181 virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingPara
meters&) OVERRIDE; |
| 186 virtual bool endActiveFlingAnimation() OVERRIDE; | 182 virtual bool endActiveFlingAnimation() OVERRIDE; |
| 187 virtual void setShowPaintRects(bool) OVERRIDE; | 183 virtual void setShowPaintRects(bool) OVERRIDE; |
| 188 void setShowDebugBorders(bool); | 184 void setShowDebugBorders(bool); |
| 189 virtual void setShowFPSCounter(bool) OVERRIDE; | 185 virtual void setShowFPSCounter(bool) OVERRIDE; |
| 190 virtual void setContinuousPaintingEnabled(bool) OVERRIDE; | 186 virtual void setContinuousPaintingEnabled(bool) OVERRIDE; |
| 191 virtual void setShowScrollBottleneckRects(bool) OVERRIDE; | 187 virtual void setShowScrollBottleneckRects(bool) OVERRIDE; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 235 |
| 240 // Returns the main frame associated with this view. This may be null when | 236 // Returns the main frame associated with this view. This may be null when |
| 241 // the page is shutting down, but will be valid at all other times. | 237 // the page is shutting down, but will be valid at all other times. |
| 242 WebLocalFrameImpl* mainFrameImpl(); | 238 WebLocalFrameImpl* mainFrameImpl(); |
| 243 | 239 |
| 244 // FIXME: Temporary method to accommodate out-of-process frame ancestors; | 240 // FIXME: Temporary method to accommodate out-of-process frame ancestors; |
| 245 // will be removed when there can be multiple WebWidgets for a single page. | 241 // will be removed when there can be multiple WebWidgets for a single page. |
| 246 WebLocalFrameImpl* localFrameRootTemporary() const; | 242 WebLocalFrameImpl* localFrameRootTemporary() const; |
| 247 | 243 |
| 248 // Event related methods: | 244 // Event related methods: |
| 249 void mouseContextMenu(const WebMouseEvent&); | |
| 250 void mouseDoubleClick(const WebMouseEvent&); | 245 void mouseDoubleClick(const WebMouseEvent&); |
| 251 | 246 |
| 252 bool detectContentOnTouch(const WebPoint&); | 247 bool detectContentOnTouch(const WebPoint&); |
| 253 | 248 |
| 254 void hasTouchEventHandlers(bool); | 249 void hasTouchEventHandlers(bool); |
| 255 | 250 |
| 256 // WebGestureCurveTarget implementation for fling. | 251 // WebGestureCurveTarget implementation for fling. |
| 257 virtual bool scrollBy(const WebFloatSize& delta, const WebFloatSize& velocit
y) OVERRIDE; | 252 virtual bool scrollBy(const WebFloatSize& delta, const WebFloatSize& velocit
y) OVERRIDE; |
| 258 | 253 |
| 259 // Handles context menu events orignated via the the keyboard. These | |
| 260 // include the VK_APPS virtual key and the Shift+F10 combine. Code is | |
| 261 // based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM | |
| 262 // wParam, LPARAM lParam) in webkit\webkit\win\WebView.cpp. The only | |
| 263 // significant change in this function is the code to convert from a | |
| 264 // Keyboard event to the Right Mouse button down event. | |
| 265 bool sendContextMenuEvent(const WebKeyboardEvent&); | |
| 266 | |
| 267 void showContextMenuAtPoint(float x, float y, PassRefPtr<ContextMenuProvider
>); | |
| 268 | |
| 269 // Notifies the WebView that a load has been committed. isNewNavigation | 254 // Notifies the WebView that a load has been committed. isNewNavigation |
| 270 // will be true if a new session history item should be created for that | 255 // will be true if a new session history item should be created for that |
| 271 // load. isNavigationWithinPage will be true if the navigation does | 256 // load. isNavigationWithinPage will be true if the navigation does |
| 272 // not take the user away from the current page. | 257 // not take the user away from the current page. |
| 273 void didCommitLoad(bool isNewNavigation, bool isNavigationWithinPage); | 258 void didCommitLoad(bool isNewNavigation, bool isNavigationWithinPage); |
| 274 | 259 |
| 275 // Indicates two things: | 260 // Indicates two things: |
| 276 // 1) This view may have a new layout now. | 261 // 1) This view may have a new layout now. |
| 277 // 2) Calling layout() is a no-op. | 262 // 2) Calling layout() is a no-op. |
| 278 // After calling WebWidget::layout(), expect to get this notification | 263 // After calling WebWidget::layout(), expect to get this notification |
| 279 // unless the view did not need a layout. | 264 // unless the view did not need a layout. |
| 280 void layoutUpdated(WebLocalFrameImpl*); | 265 void layoutUpdated(WebLocalFrameImpl*); |
| 281 | 266 |
| 282 void didRemoveAllPendingStylesheet(WebLocalFrameImpl*); | 267 void didRemoveAllPendingStylesheet(WebLocalFrameImpl*); |
| 283 | 268 |
| 284 bool contextMenuAllowed() const | |
| 285 { | |
| 286 return m_contextMenuAllowed; | |
| 287 } | |
| 288 | |
| 289 void updateMainFrameLayoutSize(); | 269 void updateMainFrameLayoutSize(); |
| 290 void updatePageDefinedViewportConstraints(const ViewportDescription&); | 270 void updatePageDefinedViewportConstraints(const ViewportDescription&); |
| 291 | 271 |
| 292 // Returns the input event we're currently processing. This is used in some | 272 // Returns the input event we're currently processing. This is used in some |
| 293 // cases where the WebCore DOM event doesn't have the information we need. | 273 // cases where the WebCore DOM event doesn't have the information we need. |
| 294 static const WebInputEvent* currentInputEvent() | 274 static const WebInputEvent* currentInputEvent() |
| 295 { | 275 { |
| 296 return m_currentInputEvent; | 276 return m_currentInputEvent; |
| 297 } | 277 } |
| 298 | 278 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 virtual bool handleGestureEvent(const WebGestureEvent&) OVERRIDE; | 390 virtual bool handleGestureEvent(const WebGestureEvent&) OVERRIDE; |
| 411 virtual bool handleKeyEvent(const WebKeyboardEvent&) OVERRIDE; | 391 virtual bool handleKeyEvent(const WebKeyboardEvent&) OVERRIDE; |
| 412 virtual bool handleCharEvent(const WebKeyboardEvent&) OVERRIDE; | 392 virtual bool handleCharEvent(const WebKeyboardEvent&) OVERRIDE; |
| 413 | 393 |
| 414 InputMethodContext* inputMethodContext(); | 394 InputMethodContext* inputMethodContext(); |
| 415 | 395 |
| 416 WebViewClient* m_client; // Can be 0 (e.g. unittests, shared workers, etc.) | 396 WebViewClient* m_client; // Can be 0 (e.g. unittests, shared workers, etc.) |
| 417 WebSpellCheckClient* m_spellCheckClient; | 397 WebSpellCheckClient* m_spellCheckClient; |
| 418 | 398 |
| 419 ChromeClientImpl m_chromeClientImpl; | 399 ChromeClientImpl m_chromeClientImpl; |
| 420 ContextMenuClientImpl m_contextMenuClientImpl; | |
| 421 EditorClientImpl m_editorClientImpl; | 400 EditorClientImpl m_editorClientImpl; |
| 422 SpellCheckerClientImpl m_spellCheckerClientImpl; | 401 SpellCheckerClientImpl m_spellCheckerClientImpl; |
| 423 | 402 |
| 424 WebSize m_size; | 403 WebSize m_size; |
| 425 bool m_fixedLayoutSizeLock; | 404 bool m_fixedLayoutSizeLock; |
| 426 | 405 |
| 427 OwnPtrWillBePersistent<Page> m_page; | 406 OwnPtrWillBePersistent<Page> m_page; |
| 428 | 407 |
| 429 // An object that can be used to manipulate m_page->settings() without linki
ng | 408 // An object that can be used to manipulate m_page->settings() without linki
ng |
| 430 // against WebCore. This is lazily allocated the first time GetWebSettings() | 409 // against WebCore. This is lazily allocated the first time GetWebSettings() |
| (...skipping 10 matching lines...) Expand all Loading... |
| 441 WebPoint m_lastMouseDownPoint; | 420 WebPoint m_lastMouseDownPoint; |
| 442 | 421 |
| 443 // Keeps track of the current zoom level. 0 means no zoom, positive numbers | 422 // Keeps track of the current zoom level. 0 means no zoom, positive numbers |
| 444 // mean zoom in, negative numbers mean zoom out. | 423 // mean zoom in, negative numbers mean zoom out. |
| 445 double m_zoomLevel; | 424 double m_zoomLevel; |
| 446 | 425 |
| 447 double m_minimumZoomLevel; | 426 double m_minimumZoomLevel; |
| 448 | 427 |
| 449 double m_maximumZoomLevel; | 428 double m_maximumZoomLevel; |
| 450 | 429 |
| 451 bool m_contextMenuAllowed; | |
| 452 | |
| 453 bool m_doingDragAndDrop; | 430 bool m_doingDragAndDrop; |
| 454 | 431 |
| 455 bool m_ignoreInputEvents; | 432 bool m_ignoreInputEvents; |
| 456 | 433 |
| 457 float m_compositorDeviceScaleFactorOverride; | 434 float m_compositorDeviceScaleFactorOverride; |
| 458 WebSize m_rootLayerOffset; | 435 WebSize m_rootLayerOffset; |
| 459 float m_rootLayerScale; | 436 float m_rootLayerScale; |
| 460 | 437 |
| 461 // Webkit expects keyPress events to be suppressed if the associated keyDown | 438 // Webkit expects keyPress events to be suppressed if the associated keyDown |
| 462 // event was handled. Safari implements this behavior by peeking out the | 439 // event was handled. Safari implements this behavior by peeking out the |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 bool m_userGestureObserved; | 497 bool m_userGestureObserved; |
| 521 }; | 498 }; |
| 522 | 499 |
| 523 // We have no ways to check if the specified WebView is an instance of | 500 // We have no ways to check if the specified WebView is an instance of |
| 524 // WebViewImpl because WebViewImpl is the only implementation of WebView. | 501 // WebViewImpl because WebViewImpl is the only implementation of WebView. |
| 525 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); | 502 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); |
| 526 | 503 |
| 527 } // namespace blink | 504 } // namespace blink |
| 528 | 505 |
| 529 #endif | 506 #endif |
| OLD | NEW |