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

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: Revised method for widget lifetime management. Created 7 years 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 const KURL& url, 593 const KURL& url,
594 const String& name, 594 const String& name,
595 const String& referrer, 595 const String& referrer,
596 HTMLFrameOwnerElement* ownerElement) 596 HTMLFrameOwnerElement* ownerElement)
597 { 597 {
598 FrameLoadRequest frameRequest(m_webFrame->frame()->document()->securityOrigi n(), 598 FrameLoadRequest frameRequest(m_webFrame->frame()->document()->securityOrigi n(),
599 ResourceRequest(url, referrer), name); 599 ResourceRequest(url, referrer), name);
600 return m_webFrame->createChildFrame(frameRequest, ownerElement); 600 return m_webFrame->createChildFrame(frameRequest, ownerElement);
601 } 601 }
602 602
603 bool FrameLoaderClientImpl::canCreatePluginWithoutRenderer(const String& mimeTyp e) const
604 {
605 if (!m_webFrame->client())
606 return false;
607
608 return m_webFrame->client()->canCreatePluginWithoutRenderer(mimeType);
609 }
610
603 PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( 611 PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin(
604 const IntSize& size, // FIXME: how do we use this? 612 const IntSize& size, // FIXME: how do we use this?
605 HTMLPlugInElement* element, 613 HTMLPlugInElement* element,
606 const KURL& url, 614 const KURL& url,
607 const Vector<String>& paramNames, 615 const Vector<String>& paramNames,
608 const Vector<String>& paramValues, 616 const Vector<String>& paramValues,
609 const String& mimeType, 617 const String& mimeType,
610 bool loadManually) 618 bool loadManually,
619 PluginLoadType loadType)
611 { 620 {
612 if (!m_webFrame->client()) 621 if (!m_webFrame->client())
613 return 0; 622 return 0;
614 623
615 WebPluginParams params; 624 WebPluginParams params;
616 params.url = url; 625 params.url = url;
617 params.mimeType = mimeType; 626 params.mimeType = mimeType;
618 params.attributeNames = paramNames; 627 params.attributeNames = paramNames;
619 params.attributeValues = paramValues; 628 params.attributeValues = paramValues;
620 params.loadManually = loadManually; 629 params.loadManually = loadManually;
621 630
622 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params ); 631 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params );
623 if (!webPlugin) 632 if (!webPlugin)
624 return 0; 633 return 0;
625 634
626 // The container takes ownership of the WebPlugin. 635 // The container takes ownership of the WebPlugin.
627 RefPtr<WebPluginContainerImpl> container = 636 RefPtr<WebPluginContainerImpl> container =
628 WebPluginContainerImpl::create(element, webPlugin); 637 WebPluginContainerImpl::create(element, webPlugin);
629 638
630 if (!webPlugin->initialize(container.get())) 639 if (!webPlugin->initialize(container.get()))
631 return 0; 640 return 0;
632 641
633 // The element might have been removed during plugin initialization! 642 // The element might have been removed during plugin initialization!
634 if (!element->renderer()) 643 if (!element->renderer() && loadType != PluginLoadWithoutRenderer)
635 return 0; 644 return 0;
636 645
637 return container; 646 return container;
638 } 647 }
639 648
640 PassRefPtr<Widget> FrameLoaderClientImpl::createJavaAppletWidget( 649 PassRefPtr<Widget> FrameLoaderClientImpl::createJavaAppletWidget(
641 const IntSize& size, 650 const IntSize& size,
642 HTMLAppletElement* element, 651 HTMLAppletElement* element,
643 const KURL& /* baseURL */, 652 const KURL& /* baseURL */,
644 const Vector<String>& paramNames, 653 const Vector<String>& paramNames,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 return adoptPtr(m_webFrame->client()->createServiceWorkerProvider(m_webFrame , client.leakPtr())); 791 return adoptPtr(m_webFrame->client()->createServiceWorkerProvider(m_webFrame , client.leakPtr()));
783 } 792 }
784 793
785 void FrameLoaderClientImpl::didStopAllLoaders() 794 void FrameLoaderClientImpl::didStopAllLoaders()
786 { 795 {
787 if (m_webFrame->client()) 796 if (m_webFrame->client())
788 m_webFrame->client()->didAbortLoading(m_webFrame); 797 m_webFrame->client()->didAbortLoading(m_webFrame);
789 } 798 }
790 799
791 } // namespace blink 800 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698