Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 1483733002: Remove support for NPObjects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "web/WebPluginContainerImpl.h" 32 #include "web/WebPluginContainerImpl.h"
33 33
34 #include "bindings/core/v8/ScriptController.h" 34 #include "bindings/core/v8/ScriptController.h"
35 #include "bindings/core/v8/ScriptSourceCode.h" 35 #include "bindings/core/v8/ScriptSourceCode.h"
36 #include "bindings/core/v8/V8Element.h" 36 #include "bindings/core/v8/V8Element.h"
37 #include "bindings/core/v8/V8NPObject.h"
38 #include "core/HTMLNames.h" 37 #include "core/HTMLNames.h"
39 #include "core/clipboard/DataObject.h" 38 #include "core/clipboard/DataObject.h"
40 #include "core/clipboard/DataTransfer.h" 39 #include "core/clipboard/DataTransfer.h"
41 #include "core/events/DragEvent.h" 40 #include "core/events/DragEvent.h"
42 #include "core/events/GestureEvent.h" 41 #include "core/events/GestureEvent.h"
43 #include "core/events/KeyboardEvent.h" 42 #include "core/events/KeyboardEvent.h"
44 #include "core/events/MouseEvent.h" 43 #include "core/events/MouseEvent.h"
45 #include "core/events/ProgressEvent.h" 44 #include "core/events/ProgressEvent.h"
46 #include "core/events/ResourceProgressEvent.h" 45 #include "core/events/ResourceProgressEvent.h"
47 #include "core/events/TouchEvent.h" 46 #include "core/events/TouchEvent.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 // We cannot compute geometry without a parent or layoutObject. 436 // We cannot compute geometry without a parent or layoutObject.
438 if (!parent() || !m_element || !m_element->layoutObject()) 437 if (!parent() || !m_element || !m_element->layoutObject())
439 return; 438 return;
440 439
441 IntRect windowRect, clipRect, unobscuredRect; 440 IntRect windowRect, clipRect, unobscuredRect;
442 Vector<IntRect> cutOutRects; 441 Vector<IntRect> cutOutRects;
443 calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects); 442 calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects);
444 m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRect s, isVisible()); 443 m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRect s, isVisible());
445 } 444 }
446 445
447 void WebPluginContainerImpl::allowScriptObjects()
448 {
449 }
450
451 void WebPluginContainerImpl::clearScriptObjects()
452 {
453 if (!frame())
454 return;
455
456 frame()->script().cleanupScriptObjectsForPlugin(this);
457 }
458
459 NPObject* WebPluginContainerImpl::scriptableObjectForElement()
460 {
461 return m_element->getNPObject();
462 }
463
464 v8::Local<v8::Object> WebPluginContainerImpl::v8ObjectForElement() 446 v8::Local<v8::Object> WebPluginContainerImpl::v8ObjectForElement()
465 { 447 {
466 LocalFrame* frame = m_element->document().frame(); 448 LocalFrame* frame = m_element->document().frame();
467 if (!frame) 449 if (!frame)
468 return v8::Local<v8::Object>(); 450 return v8::Local<v8::Object>();
469 451
470 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) 452 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
471 return v8::Local<v8::Object>(); 453 return v8::Local<v8::Object>();
472 454
473 ScriptState* scriptState = ScriptState::forMainWorld(frame); 455 ScriptState* scriptState = ScriptState::forMainWorld(frame);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 622
641 // If the plugin has been destroyed and the reference on the stack is the 623 // If the plugin has been destroyed and the reference on the stack is the
642 // only one left, then don't return the scriptable object. 624 // only one left, then don't return the scriptable object.
643 #if ENABLE(OILPAN) 625 #if ENABLE(OILPAN)
644 if (!m_webPlugin) 626 if (!m_webPlugin)
645 #else 627 #else
646 if (hasOneRef()) 628 if (hasOneRef())
647 #endif 629 #endif
648 return v8::Local<v8::Object>(); 630 return v8::Local<v8::Object>();
649 631
650 if (!object.IsEmpty()) { 632 return object;
651 // WebPlugin implementation can't provide the obsolete NPObject at the s ame time:
652 ASSERT(!m_webPlugin->scriptableObject());
653 return object;
654 }
655
656 NPObject* npObject = m_webPlugin->scriptableObject();
657 if (npObject)
658 return createV8ObjectForNPObject(isolate, npObject, 0);
659 return v8::Local<v8::Object>();
660 } 633 }
661 634
662 bool WebPluginContainerImpl::getFormValue(String& value) 635 bool WebPluginContainerImpl::getFormValue(String& value)
663 { 636 {
664 WebString webValue; 637 WebString webValue;
665 if (m_webPlugin->getFormValue(webValue)) { 638 if (m_webPlugin->getFormValue(webValue)) {
666 value = webValue; 639 value = webValue;
667 return true; 640 return true;
668 } 641 }
669 return false; 642 return false;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 // frame view. 950 // frame view.
978 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t); 951 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t);
979 } 952 }
980 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 953 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
981 // Convert to the plugin position. 954 // Convert to the plugin position.
982 for (size_t i = 0; i < cutOutRects.size(); i++) 955 for (size_t i = 0; i < cutOutRects.size(); i++)
983 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 956 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
984 } 957 }
985 958
986 } // namespace blink 959 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698