| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 #include "web/WebPagePopupImpl.h" | 31 #include "web/WebPagePopupImpl.h" |
| 32 | 32 |
| 33 #include "core/dom/ContextFeatures.h" | 33 #include "core/dom/ContextFeatures.h" |
| 34 #include "core/events/MessageEvent.h" | 34 #include "core/events/MessageEvent.h" |
| 35 #include "core/exported/WebViewBase.h" |
| 35 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 36 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 37 #include "core/frame/LocalFrameClient.h" | 38 #include "core/frame/LocalFrameClient.h" |
| 38 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
| 39 #include "core/frame/VisualViewport.h" | 40 #include "core/frame/VisualViewport.h" |
| 40 #include "core/input/EventHandler.h" | 41 #include "core/input/EventHandler.h" |
| 41 #include "core/layout/api/LayoutAPIShim.h" | 42 #include "core/layout/api/LayoutAPIShim.h" |
| 42 #include "core/layout/api/LayoutViewItem.h" | 43 #include "core/layout/api/LayoutViewItem.h" |
| 43 #include "core/loader/EmptyClients.h" | 44 #include "core/loader/EmptyClients.h" |
| 44 #include "core/loader/FrameLoadRequest.h" | 45 #include "core/loader/FrameLoadRequest.h" |
| 45 #include "core/page/FocusController.h" | 46 #include "core/page/FocusController.h" |
| 46 #include "core/page/Page.h" | 47 #include "core/page/Page.h" |
| 47 #include "core/page/PagePopupClient.h" | 48 #include "core/page/PagePopupClient.h" |
| 48 #include "core/page/PagePopupSupplement.h" | 49 #include "core/page/PagePopupSupplement.h" |
| 49 #include "modules/accessibility/AXObject.h" | 50 #include "modules/accessibility/AXObject.h" |
| 50 #include "modules/accessibility/AXObjectCacheImpl.h" | 51 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 51 #include "platform/EventDispatchForbiddenScope.h" | 52 #include "platform/EventDispatchForbiddenScope.h" |
| 52 #include "platform/LayoutTestSupport.h" | 53 #include "platform/LayoutTestSupport.h" |
| 53 #include "platform/ScriptForbiddenScope.h" | 54 #include "platform/ScriptForbiddenScope.h" |
| 54 #include "platform/animation/CompositorAnimationHost.h" | 55 #include "platform/animation/CompositorAnimationHost.h" |
| 56 #include "platform/graphics/GraphicsLayer.h" |
| 55 #include "platform/heap/Handle.h" | 57 #include "platform/heap/Handle.h" |
| 56 #include "platform/instrumentation/tracing/TraceEvent.h" | 58 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 57 #include "platform/wtf/PtrUtil.h" | 59 #include "platform/wtf/PtrUtil.h" |
| 58 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" | 60 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" |
| 59 #include "public/platform/WebCursorInfo.h" | 61 #include "public/platform/WebCursorInfo.h" |
| 60 #include "public/platform/WebFloatRect.h" | 62 #include "public/platform/WebFloatRect.h" |
| 61 #include "public/web/WebAXObject.h" | 63 #include "public/web/WebAXObject.h" |
| 62 #include "public/web/WebFrameClient.h" | 64 #include "public/web/WebFrameClient.h" |
| 63 #include "public/web/WebViewClient.h" | 65 #include "public/web/WebViewClient.h" |
| 64 #include "public/web/WebWidgetClient.h" | 66 #include "public/web/WebWidgetClient.h" |
| 65 #include "web/WebInputEventConversion.h" | 67 #include "web/WebInputEventConversion.h" |
| 66 #include "web/WebLocalFrameImpl.h" | 68 #include "web/WebLocalFrameImpl.h" |
| 67 #include "web/WebSettingsImpl.h" | 69 #include "web/WebSettingsImpl.h" |
| 68 #include "web/WebViewImpl.h" | |
| 69 | 70 |
| 70 namespace blink { | 71 namespace blink { |
| 71 | 72 |
| 72 class PagePopupChromeClient final : public EmptyChromeClient { | 73 class PagePopupChromeClient final : public EmptyChromeClient { |
| 73 public: | 74 public: |
| 74 static PagePopupChromeClient* Create(WebPagePopupImpl* popup) { | 75 static PagePopupChromeClient* Create(WebPagePopupImpl* popup) { |
| 75 return new PagePopupChromeClient(popup); | 76 return new PagePopupChromeClient(popup); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void SetWindowRect(const IntRect& rect, LocalFrame&) override { | 79 void SetWindowRect(const IntRect& rect, LocalFrame&) override { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 root_layer_(0), | 262 root_layer_(0), |
| 262 root_graphics_layer_(0), | 263 root_graphics_layer_(0), |
| 263 is_accelerated_compositing_active_(false) { | 264 is_accelerated_compositing_active_(false) { |
| 264 DCHECK(client); | 265 DCHECK(client); |
| 265 } | 266 } |
| 266 | 267 |
| 267 WebPagePopupImpl::~WebPagePopupImpl() { | 268 WebPagePopupImpl::~WebPagePopupImpl() { |
| 268 DCHECK(!page_); | 269 DCHECK(!page_); |
| 269 } | 270 } |
| 270 | 271 |
| 271 bool WebPagePopupImpl::Initialize(WebViewImpl* web_view, | 272 bool WebPagePopupImpl::Initialize(WebViewBase* web_view, |
| 272 PagePopupClient* popup_client) { | 273 PagePopupClient* popup_client) { |
| 273 DCHECK(web_view); | 274 DCHECK(web_view); |
| 274 DCHECK(popup_client); | 275 DCHECK(popup_client); |
| 275 web_view_ = web_view; | 276 web_view_ = web_view; |
| 276 popup_client_ = popup_client; | 277 popup_client_ = popup_client; |
| 277 | 278 |
| 278 if (!widget_client_ || !InitializePage()) | 279 if (!widget_client_ || !InitializePage()) |
| 279 return false; | 280 return false; |
| 280 widget_client_->Show(WebNavigationPolicy()); | 281 widget_client_->Show(WebNavigationPolicy()); |
| 281 SetFocus(true); | 282 SetFocus(true); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 return WidgetClient()->WindowRect(); | 595 return WidgetClient()->WindowRect(); |
| 595 } | 596 } |
| 596 | 597 |
| 597 // WebPagePopup ---------------------------------------------------------------- | 598 // WebPagePopup ---------------------------------------------------------------- |
| 598 | 599 |
| 599 WebPagePopup* WebPagePopup::Create(WebWidgetClient* client) { | 600 WebPagePopup* WebPagePopup::Create(WebWidgetClient* client) { |
| 600 if (!client) | 601 if (!client) |
| 601 CRASH(); | 602 CRASH(); |
| 602 // A WebPagePopupImpl instance usually has two references. | 603 // A WebPagePopupImpl instance usually has two references. |
| 603 // - One owned by the instance itself. It represents the visible widget. | 604 // - One owned by the instance itself. It represents the visible widget. |
| 604 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 605 // - One owned by a WebViewBase. It's released when the WebViewBase ask the |
| 605 // WebPagePopupImpl to close. | 606 // WebPagePopupImpl to close. |
| 606 // We need them because the closing operation is asynchronous and the widget | 607 // We need them because the closing operation is asynchronous and the widget |
| 607 // can be closed while the WebViewImpl is unaware of it. | 608 // can be closed while the WebViewBase is unaware of it. |
| 608 return AdoptRef(new WebPagePopupImpl(client)).LeakRef(); | 609 return AdoptRef(new WebPagePopupImpl(client)).LeakRef(); |
| 609 } | 610 } |
| 610 | 611 |
| 611 } // namespace blink | 612 } // namespace blink |
| OLD | NEW |