OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 UserGestureIndicator gestureIndicator(popupsAllowed ? DefinitelyProcessingNe
wUserGesture : PossiblyProcessingUserGesture); | 486 UserGestureIndicator gestureIndicator(popupsAllowed ? DefinitelyProcessingNe
wUserGesture : PossiblyProcessingUserGesture); |
487 v8::HandleScope handleScope(toIsolate(frame)); | 487 v8::HandleScope handleScope(toIsolate(frame)); |
488 v8::Local<v8::Value> result = frame->script().executeScriptInMainWorldAndRet
urnValue(ScriptSourceCode(script)); | 488 v8::Local<v8::Value> result = frame->script().executeScriptInMainWorldAndRet
urnValue(ScriptSourceCode(script)); |
489 | 489 |
490 // Failure is reported as a null string. | 490 // Failure is reported as a null string. |
491 if (result.IsEmpty() || !result->IsString()) | 491 if (result.IsEmpty() || !result->IsString()) |
492 return WebString(); | 492 return WebString(); |
493 return toCoreString(v8::Local<v8::String>::Cast(result)); | 493 return toCoreString(v8::Local<v8::String>::Cast(result)); |
494 } | 494 } |
495 | 495 |
496 void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, cons
t WebString& target, bool notifyNeeded, void* notifyData) | 496 void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, cons
t WebString& target) |
497 { | 497 { |
498 LocalFrame* frame = m_element->document().frame(); | 498 LocalFrame* frame = m_element->document().frame(); |
499 if (!frame || !frame->loader().documentLoader()) | 499 if (!frame || !frame->loader().documentLoader()) |
500 return; // FIXME: send a notification in this case? | 500 return; // FIXME: send a notification in this case? |
501 | 501 |
502 if (notifyNeeded) { | |
503 // FIXME: This is a bit of hack to allow us to observe completion of | |
504 // our frame request. It would be better to evolve FrameLoader to | |
505 // support a completion callback instead. | |
506 OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = WebPluginLoadObserv
er::create(this, request.url(), notifyData); | |
507 #if !ENABLE(OILPAN) | |
508 m_pluginLoadObservers.append(observer.get()); | |
509 #endif | |
510 WebDataSourceImpl::setNextPluginLoadObserver(observer.release()); | |
511 } | |
512 | |
513 FrameLoadRequest frameRequest(frame->document(), request.toResourceRequest()
, target); | 502 FrameLoadRequest frameRequest(frame->document(), request.toResourceRequest()
, target); |
514 frame->loader().load(frameRequest); | 503 frame->loader().load(frameRequest); |
515 } | 504 } |
516 | 505 |
517 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) | 506 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) |
518 { | 507 { |
519 // Disallow access to the frame during dispose(), because it is not guarante
ed to | 508 // Disallow access to the frame during dispose(), because it is not guarante
ed to |
520 // be valid memory once this object has started disposal. In particular, we
might be being | 509 // be valid memory once this object has started disposal. In particular, we
might be being |
521 // disposed because the frame has already be deleted and then something else
dropped the | 510 // disposed because the frame has already be deleted and then something else
dropped the |
522 // last reference to the this object. | 511 // last reference to the this object. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 bool WebPluginContainerImpl::canProcessDrag() const | 668 bool WebPluginContainerImpl::canProcessDrag() const |
680 { | 669 { |
681 return m_webPlugin->canProcessDrag(); | 670 return m_webPlugin->canProcessDrag(); |
682 } | 671 } |
683 | 672 |
684 bool WebPluginContainerImpl::wantsWheelEvents() | 673 bool WebPluginContainerImpl::wantsWheelEvents() |
685 { | 674 { |
686 return m_wantsWheelEvents; | 675 return m_wantsWheelEvents; |
687 } | 676 } |
688 | 677 |
689 #if !ENABLE(OILPAN) | |
690 void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
* observer) | |
691 { | |
692 size_t pos = m_pluginLoadObservers.find(observer); | |
693 if (pos == kNotFound) | |
694 return; | |
695 m_pluginLoadObservers.remove(pos); | |
696 } | |
697 #endif | |
698 | |
699 // Private methods ------------------------------------------------------------- | 678 // Private methods ------------------------------------------------------------- |
700 | 679 |
701 WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPl
ugin* webPlugin) | 680 WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPl
ugin* webPlugin) |
702 : LocalFrameLifecycleObserver(element->document().frame()) | 681 : LocalFrameLifecycleObserver(element->document().frame()) |
703 , m_element(element) | 682 , m_element(element) |
704 , m_webPlugin(webPlugin) | 683 , m_webPlugin(webPlugin) |
705 , m_webLayer(nullptr) | 684 , m_webLayer(nullptr) |
706 , m_touchEventRequestType(TouchEventRequestTypeNone) | 685 , m_touchEventRequestType(TouchEventRequestTypeNone) |
707 , m_wantsWheelEvents(false) | 686 , m_wantsWheelEvents(false) |
708 , m_inDispose(false) | 687 , m_inDispose(false) |
(...skipping 15 matching lines...) Expand all Loading... |
724 #endif | 703 #endif |
725 } | 704 } |
726 | 705 |
727 void WebPluginContainerImpl::dispose() | 706 void WebPluginContainerImpl::dispose() |
728 { | 707 { |
729 m_inDispose = true; | 708 m_inDispose = true; |
730 | 709 |
731 if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_e
lement->document().frameHost()) | 710 if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_e
lement->document().frameHost()) |
732 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); | 711 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); |
733 | 712 |
734 #if !ENABLE(OILPAN) | |
735 for (const auto& observer : m_pluginLoadObservers) | |
736 observer->clearPluginContainer(); | |
737 #endif | |
738 | |
739 if (m_webPlugin) { | 713 if (m_webPlugin) { |
740 RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() ==
this); | 714 RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() ==
this); |
741 m_webPlugin->destroy(); | 715 m_webPlugin->destroy(); |
742 m_webPlugin = nullptr; | 716 m_webPlugin = nullptr; |
743 } | 717 } |
744 | 718 |
745 if (m_webLayer) { | 719 if (m_webLayer) { |
746 GraphicsLayer::unregisterContentsLayer(m_webLayer); | 720 GraphicsLayer::unregisterContentsLayer(m_webLayer); |
747 m_webLayer = nullptr; | 721 m_webLayer = nullptr; |
748 } | 722 } |
749 | 723 |
750 #if !ENABLE(OILPAN) | |
751 m_pluginLoadObservers.clear(); | |
752 #endif | |
753 m_element = nullptr; | 724 m_element = nullptr; |
754 } | 725 } |
755 | 726 |
756 #if ENABLE(OILPAN) | 727 #if ENABLE(OILPAN) |
757 void WebPluginContainerImpl::shouldDisposePlugin() | 728 void WebPluginContainerImpl::shouldDisposePlugin() |
758 { | 729 { |
759 // If the LocalFrame is still alive, but the plugin element isn't, the | 730 // If the LocalFrame is still alive, but the plugin element isn't, the |
760 // LocalFrame will set m_shouldDisposePlugin via its weak pointer | 731 // LocalFrame will set m_shouldDisposePlugin via its weak pointer |
761 // callback. This is a signal that the plugin container | 732 // callback. This is a signal that the plugin container |
762 // must dispose of its plugin when finalizing. The LocalFrame and | 733 // must dispose of its plugin when finalizing. The LocalFrame and |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 // frame view. | 974 // frame view. |
1004 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 975 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
1005 } | 976 } |
1006 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 977 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
1007 // Convert to the plugin position. | 978 // Convert to the plugin position. |
1008 for (size_t i = 0; i < cutOutRects.size(); i++) | 979 for (size_t i = 0; i < cutOutRects.size(); i++) |
1009 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 980 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
1010 } | 981 } |
1011 | 982 |
1012 } // namespace blinkf | 983 } // namespace blinkf |
OLD | NEW |