| 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 26 matching lines...) Expand all Loading... |
| 37 #include "sky/engine/public/platform/WebInputEvent.h" | 37 #include "sky/engine/public/platform/WebInputEvent.h" |
| 38 #include "sky/engine/public/platform/WebLayer.h" | 38 #include "sky/engine/public/platform/WebLayer.h" |
| 39 #include "sky/engine/public/platform/WebPoint.h" | 39 #include "sky/engine/public/platform/WebPoint.h" |
| 40 #include "sky/engine/public/platform/WebRect.h" | 40 #include "sky/engine/public/platform/WebRect.h" |
| 41 #include "sky/engine/public/platform/WebSize.h" | 41 #include "sky/engine/public/platform/WebSize.h" |
| 42 #include "sky/engine/public/platform/WebString.h" | 42 #include "sky/engine/public/platform/WebString.h" |
| 43 #include "sky/engine/public/web/WebNavigationPolicy.h" | 43 #include "sky/engine/public/web/WebNavigationPolicy.h" |
| 44 #include "sky/engine/public/web/WebView.h" | 44 #include "sky/engine/public/web/WebView.h" |
| 45 #include "sky/engine/web/ChromeClientImpl.h" | 45 #include "sky/engine/web/ChromeClientImpl.h" |
| 46 #include "sky/engine/web/EditorClientImpl.h" | 46 #include "sky/engine/web/EditorClientImpl.h" |
| 47 #include "sky/engine/web/PageWidgetDelegate.h" | |
| 48 #include "sky/engine/web/SpellCheckerClientImpl.h" | 47 #include "sky/engine/web/SpellCheckerClientImpl.h" |
| 49 #include "sky/engine/wtf/OwnPtr.h" | 48 #include "sky/engine/wtf/OwnPtr.h" |
| 50 #include "sky/engine/wtf/RefCounted.h" | 49 #include "sky/engine/wtf/RefCounted.h" |
| 51 #include "sky/engine/wtf/Vector.h" | 50 #include "sky/engine/wtf/Vector.h" |
| 52 | 51 |
| 53 namespace blink { | 52 namespace blink { |
| 54 | 53 |
| 55 class Frame; | 54 class Frame; |
| 56 class UserGestureToken; | 55 class UserGestureToken; |
| 57 class WebLocalFrameImpl; | 56 class WebLocalFrameImpl; |
| 58 class WebImage; | 57 class WebImage; |
| 59 class WebSettingsImpl; | 58 class WebSettingsImpl; |
| 60 | 59 |
| 61 class WebViewImpl final : public WebView | 60 class WebViewImpl final : public WebView, public RefCounted<WebViewImpl> { |
| 62 , public RefCounted<WebViewImpl> | |
| 63 , public PageWidgetEventHandler { | |
| 64 public: | 61 public: |
| 65 static WebViewImpl* create(WebViewClient*); | 62 static WebViewImpl* create(WebViewClient*); |
| 66 | 63 |
| 67 // WebWidget methods: | 64 // WebWidget methods: |
| 68 virtual void close() override; | 65 virtual void close() override; |
| 69 virtual WebSize size() override; | 66 virtual WebSize size() override; |
| 70 | 67 |
| 71 virtual void resize(const WebSize&) override; | 68 virtual void resize(const WebSize&) override; |
| 72 | 69 |
| 73 virtual void beginFrame(const WebBeginFrameArgs&) override; | 70 virtual void beginFrame(const WebBeginFrameArgs&) override; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // the page is shutting down, but will be valid at all other times. | 148 // the page is shutting down, but will be valid at all other times. |
| 152 Page* page() const | 149 Page* page() const |
| 153 { | 150 { |
| 154 return m_page.get(); | 151 return m_page.get(); |
| 155 } | 152 } |
| 156 | 153 |
| 157 // Returns the main frame associated with this view. This may be null when | 154 // Returns the main frame associated with this view. This may be null when |
| 158 // the page is shutting down, but will be valid at all other times. | 155 // the page is shutting down, but will be valid at all other times. |
| 159 WebLocalFrameImpl* mainFrameImpl(); | 156 WebLocalFrameImpl* mainFrameImpl(); |
| 160 | 157 |
| 161 // FIXME: Temporary method to accommodate out-of-process frame ancestors; | |
| 162 // will be removed when there can be multiple WebWidgets for a single page. | |
| 163 WebLocalFrameImpl* localFrameRootTemporary() const; | |
| 164 | |
| 165 // Event related methods: | 158 // Event related methods: |
| 166 void mouseDoubleClick(const WebMouseEvent&); | 159 void mouseDoubleClick(const WebMouseEvent&); |
| 167 | 160 |
| 168 // Notifies the WebView that a load has been committed. isNewNavigation | 161 // Notifies the WebView that a load has been committed. isNewNavigation |
| 169 // will be true if a new session history item should be created for that | 162 // will be true if a new session history item should be created for that |
| 170 // load. isNavigationWithinPage will be true if the navigation does | 163 // load. isNavigationWithinPage will be true if the navigation does |
| 171 // not take the user away from the current page. | 164 // not take the user away from the current page. |
| 172 void didCommitLoad(bool isNewNavigation, bool isNavigationWithinPage); | 165 void didCommitLoad(bool isNewNavigation, bool isNavigationWithinPage); |
| 173 | 166 |
| 174 // Indicates two things: | 167 // Indicates two things: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // Returns true if the view was scrolled. | 234 // Returns true if the view was scrolled. |
| 242 bool scrollViewWithKeyboard(int keyCode, int modifiers); | 235 bool scrollViewWithKeyboard(int keyCode, int modifiers); |
| 243 | 236 |
| 244 // Converts |pos| from window coordinates to contents coordinates and gets | 237 // Converts |pos| from window coordinates to contents coordinates and gets |
| 245 // the HitTestResult for it. | 238 // the HitTestResult for it. |
| 246 HitTestResult hitTestResultForWindowPos(const IntPoint&); | 239 HitTestResult hitTestResultForWindowPos(const IntPoint&); |
| 247 | 240 |
| 248 void doComposite(); | 241 void doComposite(); |
| 249 void reallocateRenderer(); | 242 void reallocateRenderer(); |
| 250 | 243 |
| 251 // PageWidgetEventHandler functions | 244 bool handleCharEvent(const WebKeyboardEvent&); |
| 252 virtual void handleMouseLeave(LocalFrame&, const WebMouseEvent&) override; | 245 bool handleGestureEvent(const WebGestureEvent&); |
| 253 virtual void handleMouseDown(LocalFrame&, const WebMouseEvent&) override; | 246 bool handleKeyEvent(const WebKeyboardEvent&); |
| 254 virtual void handleMouseUp(LocalFrame&, const WebMouseEvent&) override; | 247 bool handleMouseWheel(LocalFrame&, const WebMouseWheelEvent&); |
| 255 virtual bool handleMouseWheel(LocalFrame&, const WebMouseWheelEvent&) overri
de; | 248 bool handleTouchEvent(LocalFrame& mainFrame, const WebTouchEvent& event); |
| 256 virtual bool handleGestureEvent(const WebGestureEvent&) override; | 249 void handleMouseDown(LocalFrame&, const WebMouseEvent&); |
| 257 virtual bool handleKeyEvent(const WebKeyboardEvent&) override; | 250 void handleMouseLeave(LocalFrame&, const WebMouseEvent&); |
| 258 virtual bool handleCharEvent(const WebKeyboardEvent&) override; | 251 void handleMouseMove(LocalFrame& mainFrame, const WebMouseEvent& event); |
| 252 void handleMouseUp(LocalFrame&, const WebMouseEvent&); |
| 259 | 253 |
| 260 InputMethodContext* inputMethodContext(); | 254 InputMethodContext* inputMethodContext(); |
| 261 | 255 |
| 262 WebViewClient* m_client; // Can be 0 (e.g. unittests, shared workers, etc.) | 256 WebViewClient* m_client; // Can be 0 (e.g. unittests, shared workers, etc.) |
| 263 WebSpellCheckClient* m_spellCheckClient; | 257 WebSpellCheckClient* m_spellCheckClient; |
| 264 | 258 |
| 265 ChromeClientImpl m_chromeClientImpl; | 259 ChromeClientImpl m_chromeClientImpl; |
| 266 EditorClientImpl m_editorClientImpl; | 260 EditorClientImpl m_editorClientImpl; |
| 267 SpellCheckerClientImpl m_spellCheckerClientImpl; | 261 SpellCheckerClientImpl m_spellCheckerClientImpl; |
| 268 | 262 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 bool m_userGestureObserved; | 310 bool m_userGestureObserved; |
| 317 }; | 311 }; |
| 318 | 312 |
| 319 // We have no ways to check if the specified WebView is an instance of | 313 // We have no ways to check if the specified WebView is an instance of |
| 320 // WebViewImpl because WebViewImpl is the only implementation of WebView. | 314 // WebViewImpl because WebViewImpl is the only implementation of WebView. |
| 321 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); | 315 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); |
| 322 | 316 |
| 323 } // namespace blink | 317 } // namespace blink |
| 324 | 318 |
| 325 #endif // SKY_ENGINE_WEB_WEBVIEWIMPL_H_ | 319 #endif // SKY_ENGINE_WEB_WEBVIEWIMPL_H_ |
| OLD | NEW |