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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 UserGestureIndicator gestureIndicator(popupsAllowed ? DefinitelyProcessingNe
wUserGesture : PossiblyProcessingUserGesture); | 480 UserGestureIndicator gestureIndicator(popupsAllowed ? DefinitelyProcessingNe
wUserGesture : PossiblyProcessingUserGesture); |
481 v8::HandleScope handleScope(toIsolate(frame)); | 481 v8::HandleScope handleScope(toIsolate(frame)); |
482 v8::Local<v8::Value> result = frame->script().executeScriptInMainWorldAndRet
urnValue(ScriptSourceCode(script)); | 482 v8::Local<v8::Value> result = frame->script().executeScriptInMainWorldAndRet
urnValue(ScriptSourceCode(script)); |
483 | 483 |
484 // Failure is reported as a null string. | 484 // Failure is reported as a null string. |
485 if (result.IsEmpty() || !result->IsString()) | 485 if (result.IsEmpty() || !result->IsString()) |
486 return WebString(); | 486 return WebString(); |
487 return toCoreString(v8::Local<v8::String>::Cast(result)); | 487 return toCoreString(v8::Local<v8::String>::Cast(result)); |
488 } | 488 } |
489 | 489 |
490 void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, cons
t WebString& target, bool notifyNeeded, void* notifyData) | 490 void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, cons
t WebString& target) |
491 { | 491 { |
492 LocalFrame* frame = m_element->document().frame(); | 492 LocalFrame* frame = m_element->document().frame(); |
493 if (!frame || !frame->loader().documentLoader()) | 493 if (!frame || !frame->loader().documentLoader()) |
494 return; // FIXME: send a notification in this case? | 494 return; // FIXME: send a notification in this case? |
495 | 495 |
496 if (notifyNeeded) { | |
497 // FIXME: This is a bit of hack to allow us to observe completion of | |
498 // our frame request. It would be better to evolve FrameLoader to | |
499 // support a completion callback instead. | |
500 OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = WebPluginLoadObserv
er::create(this, request.url(), notifyData); | |
501 #if !ENABLE(OILPAN) | |
502 m_pluginLoadObservers.append(observer.get()); | |
503 #endif | |
504 WebDataSourceImpl::setNextPluginLoadObserver(observer.release()); | |
505 } | |
506 | |
507 FrameLoadRequest frameRequest(frame->document(), request.toResourceRequest()
, target); | 496 FrameLoadRequest frameRequest(frame->document(), request.toResourceRequest()
, target); |
508 frame->loader().load(frameRequest); | 497 frame->loader().load(frameRequest); |
509 } | 498 } |
510 | 499 |
511 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) | 500 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) |
512 { | 501 { |
513 // Disallow access to the frame during dispose(), because it is not guarante
ed to | 502 // Disallow access to the frame during dispose(), because it is not guarante
ed to |
514 // be valid memory once this object has started disposal. In particular, we
might be being | 503 // be valid memory once this object has started disposal. In particular, we
might be being |
515 // disposed because the frame has already be deleted and then something else
dropped the | 504 // disposed because the frame has already be deleted and then something else
dropped the |
516 // last reference to the this object. | 505 // last reference to the this object. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 bool WebPluginContainerImpl::canProcessDrag() const | 662 bool WebPluginContainerImpl::canProcessDrag() const |
674 { | 663 { |
675 return m_webPlugin->canProcessDrag(); | 664 return m_webPlugin->canProcessDrag(); |
676 } | 665 } |
677 | 666 |
678 bool WebPluginContainerImpl::wantsWheelEvents() | 667 bool WebPluginContainerImpl::wantsWheelEvents() |
679 { | 668 { |
680 return m_wantsWheelEvents; | 669 return m_wantsWheelEvents; |
681 } | 670 } |
682 | 671 |
683 #if !ENABLE(OILPAN) | |
684 void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
* observer) | |
685 { | |
686 size_t pos = m_pluginLoadObservers.find(observer); | |
687 if (pos == kNotFound) | |
688 return; | |
689 m_pluginLoadObservers.remove(pos); | |
690 } | |
691 #endif | |
692 | |
693 // Private methods ------------------------------------------------------------- | 672 // Private methods ------------------------------------------------------------- |
694 | 673 |
695 WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPl
ugin* webPlugin) | 674 WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPl
ugin* webPlugin) |
696 : LocalFrameLifecycleObserver(element->document().frame()) | 675 : LocalFrameLifecycleObserver(element->document().frame()) |
697 , m_element(element) | 676 , m_element(element) |
698 , m_webPlugin(webPlugin) | 677 , m_webPlugin(webPlugin) |
699 , m_webLayer(nullptr) | 678 , m_webLayer(nullptr) |
700 , m_touchEventRequestType(TouchEventRequestTypeNone) | 679 , m_touchEventRequestType(TouchEventRequestTypeNone) |
701 , m_wantsWheelEvents(false) | 680 , m_wantsWheelEvents(false) |
702 , m_inDispose(false) | 681 , m_inDispose(false) |
(...skipping 15 matching lines...) Expand all Loading... |
718 #endif | 697 #endif |
719 } | 698 } |
720 | 699 |
721 void WebPluginContainerImpl::dispose() | 700 void WebPluginContainerImpl::dispose() |
722 { | 701 { |
723 m_inDispose = true; | 702 m_inDispose = true; |
724 | 703 |
725 if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_e
lement->document().frameHost()) | 704 if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_e
lement->document().frameHost()) |
726 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); | 705 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); |
727 | 706 |
728 #if !ENABLE(OILPAN) | |
729 for (const auto& observer : m_pluginLoadObservers) | |
730 observer->clearPluginContainer(); | |
731 #endif | |
732 | |
733 if (m_webPlugin) { | 707 if (m_webPlugin) { |
734 RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() ==
this); | 708 RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() ==
this); |
735 m_webPlugin->destroy(); | 709 m_webPlugin->destroy(); |
736 m_webPlugin = nullptr; | 710 m_webPlugin = nullptr; |
737 } | 711 } |
738 | 712 |
739 if (m_webLayer) { | 713 if (m_webLayer) { |
740 GraphicsLayer::unregisterContentsLayer(m_webLayer); | 714 GraphicsLayer::unregisterContentsLayer(m_webLayer); |
741 m_webLayer = nullptr; | 715 m_webLayer = nullptr; |
742 } | 716 } |
743 | 717 |
744 #if !ENABLE(OILPAN) | |
745 m_pluginLoadObservers.clear(); | |
746 #endif | |
747 m_element = nullptr; | 718 m_element = nullptr; |
748 } | 719 } |
749 | 720 |
750 #if ENABLE(OILPAN) | 721 #if ENABLE(OILPAN) |
751 void WebPluginContainerImpl::shouldDisposePlugin() | 722 void WebPluginContainerImpl::shouldDisposePlugin() |
752 { | 723 { |
753 // If the LocalFrame is still alive, but the plugin element isn't, the | 724 // If the LocalFrame is still alive, but the plugin element isn't, the |
754 // LocalFrame will set m_shouldDisposePlugin via its weak pointer | 725 // LocalFrame will set m_shouldDisposePlugin via its weak pointer |
755 // callback. This is a signal that the plugin container | 726 // callback. This is a signal that the plugin container |
756 // must dispose of its plugin when finalizing. The LocalFrame and | 727 // must dispose of its plugin when finalizing. The LocalFrame and |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 // frame view. | 967 // frame view. |
997 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 968 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
998 } | 969 } |
999 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 970 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
1000 // Convert to the plugin position. | 971 // Convert to the plugin position. |
1001 for (size_t i = 0; i < cutOutRects.size(); i++) | 972 for (size_t i = 0; i < cutOutRects.size(); i++) |
1002 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 973 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
1003 } | 974 } |
1004 | 975 |
1005 } // namespace blinkf | 976 } // namespace blinkf |
OLD | NEW |