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

Side by Side Diff: Source/web/FrameLoaderClientImpl.cpp

Issue 23618022: BrowserPlugin/WebView - Move plugin lifetime to DOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't store plugin (widget) pointer in RenderWidget. Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 const KURL& url, 589 const KURL& url,
590 const String& name, 590 const String& name,
591 const String& referrer, 591 const String& referrer,
592 HTMLFrameOwnerElement* ownerElement) 592 HTMLFrameOwnerElement* ownerElement)
593 { 593 {
594 FrameLoadRequest frameRequest(m_webFrame->frame()->document()->securityOrigi n(), 594 FrameLoadRequest frameRequest(m_webFrame->frame()->document()->securityOrigi n(),
595 ResourceRequest(url, referrer), name); 595 ResourceRequest(url, referrer), name);
596 return m_webFrame->createChildFrame(frameRequest, ownerElement); 596 return m_webFrame->createChildFrame(frameRequest, ownerElement);
597 } 597 }
598 598
599 bool FrameLoaderClientImpl::canCreatePluginWithoutRenderer(const String& mimeTyp e) const
600 {
601 if (!m_webFrame->client())
602 return false;
603
604 return m_webFrame->client()->canCreatePluginWithoutRenderer(mimeType);
605 }
606
599 PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( 607 PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin(
600 const IntSize& size, // FIXME: how do we use this? 608 const IntSize& size, // FIXME: how do we use this?
601 HTMLPlugInElement* element, 609 HTMLPlugInElement* element,
602 const KURL& url, 610 const KURL& url,
603 const Vector<String>& paramNames, 611 const Vector<String>& paramNames,
604 const Vector<String>& paramValues, 612 const Vector<String>& paramValues,
605 const String& mimeType, 613 const String& mimeType,
606 bool loadManually) 614 bool loadManually,
615 bool loadWithoutRenderer)
607 { 616 {
608 if (!m_webFrame->client()) 617 if (!m_webFrame->client())
609 return 0; 618 return 0;
610 619
611 WebPluginParams params; 620 WebPluginParams params;
612 params.url = url; 621 params.url = url;
613 params.mimeType = mimeType; 622 params.mimeType = mimeType;
614 params.attributeNames = paramNames; 623 params.attributeNames = paramNames;
615 params.attributeValues = paramValues; 624 params.attributeValues = paramValues;
616 params.loadManually = loadManually; 625 params.loadManually = loadManually;
617 626
618 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params ); 627 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params );
619 if (!webPlugin) 628 if (!webPlugin)
620 return 0; 629 return 0;
621 630
622 // The container takes ownership of the WebPlugin. 631 // The container takes ownership of the WebPlugin.
623 RefPtr<WebPluginContainerImpl> container = 632 RefPtr<WebPluginContainerImpl> container =
624 WebPluginContainerImpl::create(element, webPlugin); 633 WebPluginContainerImpl::create(element, webPlugin);
625 634
626 if (!webPlugin->initialize(container.get())) 635 if (!webPlugin->initialize(container.get()))
627 return 0; 636 return 0;
628 637
629 // The element might have been removed during plugin initialization! 638 // The element might have been removed during plugin initialization!
630 if (!element->renderer()) 639 if (!element->renderer() && !loadWithoutRenderer)
631 return 0; 640 return 0;
632 641
633 return container; 642 return container;
634 } 643 }
635 644
636 PassRefPtr<Widget> FrameLoaderClientImpl::createJavaAppletWidget( 645 PassRefPtr<Widget> FrameLoaderClientImpl::createJavaAppletWidget(
637 const IntSize& size, 646 const IntSize& size,
638 HTMLAppletElement* element, 647 HTMLAppletElement* element,
639 const KURL& /* baseURL */, 648 const KURL& /* baseURL */,
640 const Vector<String>& paramNames, 649 const Vector<String>& paramNames,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 return adoptPtr(m_webFrame->client()->createServiceWorkerProvider(m_webFrame , client.leakPtr())); 787 return adoptPtr(m_webFrame->client()->createServiceWorkerProvider(m_webFrame , client.leakPtr()));
779 } 788 }
780 789
781 void FrameLoaderClientImpl::didStopAllLoaders() 790 void FrameLoaderClientImpl::didStopAllLoaders()
782 { 791 {
783 if (m_webFrame->client()) 792 if (m_webFrame->client())
784 m_webFrame->client()->didAbortLoading(m_webFrame); 793 m_webFrame->client()->didAbortLoading(m_webFrame);
785 } 794 }
786 795
787 } // namespace blink 796 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698