Commit c79dba31 authored by andersca's avatar andersca

WebCore:

2006-06-11  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Geoff.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9390
        Move full-frame plugins to WebCore
        
        * WebCore.vcproj/WebCore/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        Add PluginDocument
        
        * bridge/mac/FrameMac.h:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::redirectDataToPlugin):
        Call the bridge.
        
        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        Add redirectDataToPlugin which is used to redirect incoming data
        to a plugin.
        
        * bridge/mac/WebCoreViewFactory.h:
        Add pluginSupportsMIMEType which returns whether any plugins support a given MIME type.
        
        * dom/DOMImplementation.cpp:
        * dom/DOMImplementation.h:
        Get rid of createTextDocument and just create a text document explicitly when needed.
        
        * dom/Document.h:
        (WebCore::Document::isPluginDocument):
        * loader/PluginDocument.cpp: Added.
        (WebCore::PluginTokenizer::PluginTokenizer):
        (WebCore::PluginTokenizer::wantsRawData):
        (WebCore::PluginTokenizer::write):
        (WebCore::PluginTokenizer::createDocumentStructure):
        (WebCore::PluginTokenizer::writeRawData):
        (WebCore::PluginTokenizer::stopParsing):
        (WebCore::PluginTokenizer::finish):
        (WebCore::PluginTokenizer::isWaitingForScripts):
        (WebCore::PluginDocument::PluginDocument):
        (WebCore::PluginDocument::createTokenizer):
        * loader/PluginDocument.h: Added.
        (WebCore::PluginDocument::isPluginDocument):
        Add PluginDocument.
        
        * page/Frame.cpp:
        (WebCore::Frame::begin):
        Possibly create a plugin document.
        
        * page/Frame.h:
        (WebCore::Frame::redirectDataToPlugin):
        Add declaration.
        
        * platform/PlugInInfoStore.h:
        * platform/mac/PlugInInfoStoreMac.mm:
        (WebCore::PlugInInfoStore::supportsMIMEType):
        Ask WebCoreViewFactory if the MIME type is supported.

WebKit:

2006-06-11  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Tim.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9390
        Move full-frame plugins to WebCore

        * Plugins/WebBaseNetscapePluginStream.h:
        * Plugins/WebBaseNetscapePluginStream.m:
        (-[WebBaseNetscapePluginStream instance]):
        Add instance method which returns the plugin instance.
        
        * Plugins/WebBasePluginPackage.h:
        Add WebPluginManualLoader protocol
        
        * Plugins/WebNetscapePluginDocumentView.h: Removed.
        * Plugins/WebNetscapePluginDocumentView.m: Removed.

        * Plugins/WebNetscapePluginEmbeddedView.h:
        * Plugins/WebNetscapePluginEmbeddedView.m:
        (-[WebNetscapePluginEmbeddedView initWithFrame:plugin:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:]):
        (-[WebNetscapePluginEmbeddedView dealloc]):
        (-[WebNetscapePluginEmbeddedView didStart]):
        (-[WebNetscapePluginEmbeddedView pluginView:receivedResponse:]):
        (-[WebNetscapePluginEmbeddedView pluginView:receivedData:]):
        (-[WebNetscapePluginEmbeddedView pluginView:receivedError:]):
        (-[WebNetscapePluginEmbeddedView pluginViewFinishedLoading:]):
        (-[WebNetscapePluginEmbeddedView redeliverStream]):
        Make WebNetscapePluginEmbeddedView support the WebPluginManualLoader protocol. It creates a plugin stream and feeds the
        data manually. Much of this code has been copied from WebNetscapePluginRepresentation.

        * Plugins/WebNetscapePluginRepresentation.h: Removed.
        * Plugins/WebNetscapePluginRepresentation.m: Removed.

        * Plugins/WebPluginController.h:
        * Plugins/WebPluginController.m:
        (-[WebPluginController pluginView:receivedResponse:]):
        (-[WebPluginController pluginView:receivedData:]):
        (-[WebPluginController pluginView:receivedError:]):
        (-[WebPluginController pluginViewFinishedLoading:]):
        Make WebPluginController support the WebPluginManualLoader protocol so it can feed data manually to WebKit plugins.

        * Plugins/WebPluginDatabase.m:        
        (-[WebPluginDatabase refresh]):
        Use WebHTMLView and WebHTMLRepresentation when registering/unregistering plug-in MIME types.
        
        * Plugins/WebPluginDocumentView.h: Removed.
        * Plugins/WebPluginDocumentView.m: Removed.

        * WebCoreSupport/WebFrameBridge.m:
        (-[WebFrameBridge pluginViewWithPackage:attributeNames:attributeValues:baseURL:DOMElement:loadManually:]):
        (-[WebFrameBridge viewForPluginWithURL:attributeNames:attributeValues:MIMEType:DOMElement:loadManually:]):
        Add loadManually argument.
        
        (-[WebFrameBridge redirectDataToPlugin:]):
        Call down to the HTML representation.
        
        (-[WebFrameBridge viewForJavaAppletWithFrame:attributeNames:attributeValues:baseURL:DOMElement:]):
        Pass NO to loadManually.
        
        (-[WebFrameBridge determineObjectFromMIMEType:URL:]):
        Explicitly check if the MIME type is supported by a plug-in instead of checking the view class.
        
        * WebCoreSupport/WebViewFactory.m:
        (-[WebViewFactory pluginSupportsMIMEType:]):
        New function which returns whether any plugins support a given MIME type.
        
        * WebKit.xcodeproj/project.pbxproj:
        Update for removed files.
        
        * WebView/WebFrame.m:
        (-[WebFrame _reloadForPluginChanges]):
        Remove view type checks.
        
        (-[WebFrame _recursive_pauseNullEventsForAllNetscapePlugins]):
        (-[WebFrame _recursive_resumeNullEventsForAllNetscapePlugins]):
        Remove FIXME comments.
        
        * WebView/WebHTMLRepresentation.m:
        (-[WebHTMLRepresentation _redirectDataToManualLoader:forPluginView:]):        
        New function which redirects incoming data to a manual loader.
        
        (-[WebHTMLRepresentation receivedData:withDataSource:]):
        (-[WebHTMLRepresentation receivedError:withDataSource:]):
        (-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
        Optionally redirect incoming data.
        
        * WebView/WebHTMLRepresentationPrivate.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14811 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7c7373c1
2006-06-11 Anders Carlsson <acarlsson@apple.com>
Reviewed by Geoff.
http://bugzilla.opendarwin.org/show_bug.cgi?id=9390
Move full-frame plugins to WebCore
* WebCore.vcproj/WebCore/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
Add PluginDocument
* bridge/mac/FrameMac.h:
* bridge/mac/FrameMac.mm:
(WebCore::FrameMac::redirectDataToPlugin):
Call the bridge.
* bridge/mac/WebCoreFrameBridge.h:
* bridge/mac/WebCoreFrameBridge.mm:
Add redirectDataToPlugin which is used to redirect incoming data
to a plugin.
* bridge/mac/WebCoreViewFactory.h:
Add pluginSupportsMIMEType which returns whether any plugins support a given MIME type.
* dom/DOMImplementation.cpp:
* dom/DOMImplementation.h:
Get rid of createTextDocument and just create a text document explicitly when needed.
* dom/Document.h:
(WebCore::Document::isPluginDocument):
* loader/PluginDocument.cpp: Added.
(WebCore::PluginTokenizer::PluginTokenizer):
(WebCore::PluginTokenizer::wantsRawData):
(WebCore::PluginTokenizer::write):
(WebCore::PluginTokenizer::createDocumentStructure):
(WebCore::PluginTokenizer::writeRawData):
(WebCore::PluginTokenizer::stopParsing):
(WebCore::PluginTokenizer::finish):
(WebCore::PluginTokenizer::isWaitingForScripts):
(WebCore::PluginDocument::PluginDocument):
(WebCore::PluginDocument::createTokenizer):
* loader/PluginDocument.h: Added.
(WebCore::PluginDocument::isPluginDocument):
Add PluginDocument.
* page/Frame.cpp:
(WebCore::Frame::begin):
Possibly create a plugin document.
* page/Frame.h:
(WebCore::Frame::redirectDataToPlugin):
Add declaration.
* platform/PlugInInfoStore.h:
* platform/mac/PlugInInfoStoreMac.mm:
(WebCore::PlugInInfoStore::supportsMIMEType):
Ask WebCoreViewFactory if the MIME type is supported.
2006-06-10 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by hyatt.
......
......@@ -1146,6 +1146,14 @@
RelativePath="..\..\loader\loader.h"
>
</File>
<File
RelativePath="..\..\loader\PluginDocument.cpp"
>
</File>
<File
RelativePath="..\..\loader\PluginDocument.h"
>
</File>
<File
RelativePath="..\..\loader\Request.cpp"
>
......
......@@ -106,6 +106,8 @@
1A85B2B60A1B2AC700D8C87C /* JSHTMLDivElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A85B2B40A1B2AC700D8C87C /* JSHTMLDivElement.cpp */; };
1A85B2B70A1B2AC700D8C87C /* JSHTMLDivElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A85B2B50A1B2AC700D8C87C /* JSHTMLDivElement.h */; };
1A9EF4570A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A9EF4560A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp */; };
1AC694C70A3B1676003F5049 /* PluginDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC694C50A3B1676003F5049 /* PluginDocument.cpp */; };
1AC694C80A3B1676003F5049 /* PluginDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC694C60A3B1676003F5049 /* PluginDocument.h */; };
1AE2AA1E0A1CDAB400B42B25 /* JSHTMLAreaElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE2AA0A0A1CDAB300B42B25 /* JSHTMLAreaElement.cpp */; };
1AE2AA1F0A1CDAB400B42B25 /* JSHTMLAreaElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE2AA0B0A1CDAB300B42B25 /* JSHTMLAreaElement.h */; };
1AE2AA200A1CDAB400B42B25 /* JSHTMLBaseFontElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE2AA0C0A1CDAB300B42B25 /* JSHTMLBaseFontElement.cpp */; };
......@@ -1534,23 +1536,6 @@
FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418E097596C9000540BE /* SVGImageLoader.h */; };
/* End PBXBuildFile section */
/* Begin PBXBuildStyle section */
BCC0C2960A3792E6008CD7AD /* Development */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = NO;
};
name = Development;
};
BCC0C2970A3792E6008CD7AD /* Deployment */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = YES;
};
name = Deployment;
};
/* End PBXBuildStyle section */
/* Begin PBXContainerItemProxy section */
DD041FF009D9E3250010AF2A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
......@@ -1674,6 +1659,8 @@
1A85B2B40A1B2AC700D8C87C /* JSHTMLDivElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDivElement.cpp; sourceTree = "<group>"; };
1A85B2B50A1B2AC700D8C87C /* JSHTMLDivElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLDivElement.h; sourceTree = "<group>"; };
1A9EF4560A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCanvasRenderingContext2DCustom.cpp; sourceTree = "<group>"; };
1AC694C50A3B1676003F5049 /* PluginDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PluginDocument.cpp; sourceTree = "<group>"; };
1AC694C60A3B1676003F5049 /* PluginDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginDocument.h; sourceTree = "<group>"; };
1AE2A9F00A1CDA5700B42B25 /* HTMLAreaElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = HTMLAreaElement.idl; sourceTree = "<group>"; };
1AE2A9F10A1CDA5700B42B25 /* HTMLBaseFontElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = HTMLBaseFontElement.idl; sourceTree = "<group>"; };
1AE2A9F20A1CDA5700B42B25 /* HTMLBodyElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = HTMLBodyElement.idl; sourceTree = "<group>"; };
......@@ -4910,6 +4897,8 @@
93ABCE5E06E1A42E0085925B /* FormData.h */,
1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */,
1A820D900A13EBA600AF843C /* ImageDocument.h */,
1AC694C50A3B1676003F5049 /* PluginDocument.cpp */,
1AC694C60A3B1676003F5049 /* PluginDocument.h */,
BCB16C130979C3BD00467741 /* loader.cpp */,
BCB16C140979C3BD00467741 /* loader.h */,
BCB16C150979C3BD00467741 /* Request.cpp */,
......@@ -6235,6 +6224,7 @@
4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */,
4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */,
4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */,
1AC694C80A3B1676003F5049 /* PluginDocument.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -6268,12 +6258,6 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
buildSettings = {
};
buildStyles = (
BCC0C2960A3792E6008CD7AD /* Development */,
BCC0C2970A3792E6008CD7AD /* Deployment */,
);
hasScannedForEncodings = 1;
knownRegions = (
English,
......@@ -7076,6 +7060,7 @@
4E1959290A39DACC00220FE5 /* MediaQuery.cpp in Sources */,
4E19592B0A39DACC00220FE5 /* MediaQueryEvaluator.cpp in Sources */,
4E19592D0A39DACC00220FE5 /* MediaQueryExp.cpp in Sources */,
1AC694C70A3B1676003F5049 /* PluginDocument.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -136,6 +136,8 @@ public:
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
virtual Plugin* createPlugin(Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType);
virtual void redirectDataToPlugin(Widget* pluginWidget);
virtual Frame* createFrame(const KURL& url, const String& name, RenderPart* renderer, const String& referrer);
virtual void scheduleClose();
......
......@@ -524,12 +524,18 @@ Plugin* FrameMac::createPlugin(Element* element, const KURL& url, const Vector<S
attributeNames:nsArray(paramNames)
attributeValues:nsArray(paramValues)
MIMEType:mimeType
DOMElement:(element ? [DOMElement _elementWith:element] : nil)]));
DOMElement:(element ? [DOMElement _elementWith:element] : nil)
loadManually:d->m_doc->isPluginDocument()]));
END_BLOCK_OBJC_EXCEPTIONS;
return 0;
}
void FrameMac::redirectDataToPlugin(Widget* pluginWidget)
{
[_bridge redirectDataToPlugin:pluginWidget->getView()];
}
Frame* FrameMac::createFrame(const KURL& url, const String& name, RenderPart* renderer, const String& referrer)
{
......
......@@ -591,12 +591,14 @@ typedef enum {
attributeNames:(NSArray *)attributeNames
attributeValues:(NSArray *)attributeValues
MIMEType:(NSString *)MIMEType
DOMElement:(DOMElement *)element;
DOMElement:(DOMElement *)element
loadManually:(BOOL)loadManually;
- (NSView *)viewForJavaAppletWithFrame:(NSRect)frame
attributeNames:(NSArray *)attributeNames
attributeValues:(NSArray *)attributeValues
baseURL:(NSURL *)baseURL
DOMElement:(DOMElement *)element;
- (void)redirectDataToPlugin:(NSView *)pluginView;
- (BOOL)saveDocumentToPageCache:(id)documentInfo;
......
......@@ -52,6 +52,7 @@
#import "ModifySelectionListLevel.h"
#import "MoveSelectionCommand.h"
#import "Page.h"
#import "PlugInInfoStore.h"
#import "RenderView.h"
#import "RenderImage.h"
#import "RenderPart.h"
......@@ -2559,7 +2560,8 @@ static NSCharacterSet *_getPostSmartSet(void)
String mimeType = m_frame->resourceRequest().m_responseMIMEType;
if (WebCore::DOMImplementation::isTextMIMEType(mimeType) ||
Image::supportsType(mimeType))
Image::supportsType(mimeType) ||
PlugInInfoStore::supportsMIMEType(mimeType))
return NO;
return YES;
......
......@@ -35,6 +35,7 @@
- (NSArray *)pluginsInfo; // array of id <WebCorePluginInfo>
- (void)refreshPlugins:(BOOL)reloadPages;
- (BOOL)pluginSupportsMIMEType:(NSString *)MIMEType;
- (NSString *)inputElementAltText;
- (NSString *)resetButtonDefaultLabel;
......
......@@ -180,11 +180,6 @@ PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(FrameView* v)
return new HTMLDocument(this, v);
}
PassRefPtr<TextDocument> DOMImplementation::createTextDocument(FrameView *v)
{
return new TextDocument(this, v);
}
DOMImplementation* DOMImplementation::instance()
{
static RefPtr<DOMImplementation> i = new DOMImplementation;
......
......@@ -61,7 +61,6 @@ public:
// Other methods (not part of DOM)
PassRefPtr<Document> createDocument(FrameView* = 0);
PassRefPtr<HTMLDocument> createHTMLDocument(FrameView* = 0);
PassRefPtr<TextDocument> createTextDocument(FrameView* v = 0);
// Returns the static instance of this class - only one instance of this class should
// ever be present, and is used as a factory method for creating Document objects
......
......@@ -213,7 +213,8 @@ public:
// Other methods (not part of DOM)
virtual bool isDocumentNode() const { return true; }
virtual bool isHTMLDocument() const { return false; }
virtual bool isPluginDocument() const { return false; }
CSSStyleSelector* styleSelector() const { return m_styleSelector; }
Element* getElementByAccessKey(const String& key) const;
......
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "PluginDocument.h"
#include "Frame.h"
#include "Element.h"
#include "HTMLNames.h"
#include "RenderWidget.h"
#include "SegmentedString.h"
#include "Text.h"
#include "HTMLEmbedElement.h"
#include "xml_tokenizer.h"
namespace WebCore {
using namespace HTMLNames;
class PluginTokenizer : public Tokenizer {
public:
PluginTokenizer(Document* doc) : m_doc(doc), m_embedElement(0) {}
virtual bool write(const SegmentedString&, bool appendData);
virtual void stopParsing();
virtual void finish();
virtual bool isWaitingForScripts() const;
virtual bool wantsRawData() const { return true; }
virtual bool writeRawData(const char* data, int len);
void createDocumentStructure();
private:
Document* m_doc;
HTMLEmbedElement* m_embedElement;
};
bool PluginTokenizer::write(const SegmentedString& s, bool appendData)
{
ASSERT_NOT_REACHED();
return false;
}
void PluginTokenizer::createDocumentStructure()
{
ExceptionCode ec;
RefPtr<Element> rootElement = m_doc->createElementNS(xhtmlNamespaceURI, "html", ec);
m_doc->appendChild(rootElement, ec);
RefPtr<Element> body = m_doc->createElementNS(xhtmlNamespaceURI, "body", ec);
body->setAttribute(marginwidthAttr, "0");
body->setAttribute(marginheightAttr, "0");
rootElement->appendChild(body, ec);
RefPtr<Element> embedElement = m_doc->createElementNS(xhtmlNamespaceURI, "embed", ec);
m_embedElement = static_cast<HTMLEmbedElement*>(embedElement.get());
m_embedElement->setAttribute(widthAttr, "100%");
m_embedElement->setAttribute(heightAttr, "100%");
m_embedElement->setAttribute(nameAttr, "plugin");
m_embedElement->setSrc(m_doc->URL());
m_embedElement->setType(m_doc->frame()->resourceRequest().m_responseMIMEType);
body->appendChild(embedElement, ec);
}
bool PluginTokenizer::writeRawData(const char* data, int len)
{
if (!m_embedElement) {
createDocumentStructure();
m_doc->frame()->redirectDataToPlugin(static_cast<RenderWidget*>(m_embedElement->renderer())->widget());
return false;
}
ASSERT_NOT_REACHED();
return false;
}
void PluginTokenizer::stopParsing()
{
Tokenizer::stopParsing();
}
void PluginTokenizer::finish()
{
if (!m_parserStopped)
m_doc->finishedParsing();
}
bool PluginTokenizer::isWaitingForScripts() const
{
// A plugin document is never waiting for scripts
return false;
}
PluginDocument::PluginDocument(DOMImplementation* _implementation, FrameView* v)
: HTMLDocument(_implementation, v)
{
setParseMode(Compat);
}
Tokenizer* PluginDocument::createTokenizer()
{
return new PluginTokenizer(this);
}
}
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PluginDocument_h
#define PluginDocument_h
#include "HTMLDocument.h"
namespace WebCore {
class DOMImplementation;
class FrameView;
class PluginDocument : public HTMLDocument
{
public:
PluginDocument(DOMImplementation*, FrameView* = 0);
virtual bool isPluginDocument() const { return true; }
virtual Tokenizer* createTokenizer();
};
}
#endif // ImageDocument_h
......@@ -57,6 +57,8 @@
#include "NodeList.h"
#include "Page.h"
#include "Plugin.h"
#include "PluginDocument.h"
#include "PlugInInfoStore.h"
#include "RenderPart.h"
#include "RenderTheme.h"
#include "RenderView.h"
......@@ -614,8 +616,10 @@ void Frame::begin(const KURL& url)
d->m_doc = DOMImplementation::instance()->createDocument(d->m_view.get());
else if (DOMImplementation::isTextMIMEType(d->m_request.m_responseMIMEType))
d->m_doc = new TextDocument(DOMImplementation::instance(), d->m_view.get());
else if (Image::supportsType(d->m_request.m_responseMIMEType))
else if (Image::supportsType(d->m_request.m_responseMIMEType))
d->m_doc = new ImageDocument(DOMImplementation::instance(), d->m_view.get());
else if (PlugInInfoStore::supportsMIMEType(d->m_request.m_responseMIMEType))
d->m_doc = new PluginDocument(DOMImplementation::instance(), d->m_view.get());
else
d->m_doc = DOMImplementation::instance()->createHTMLDocument(d->m_view.get());
......
......@@ -568,12 +568,13 @@ public:
virtual bool passWheelEventToChildWidget(Node*) = 0;
virtual bool lastEventIsMouseUp() const = 0;
virtual String overrideMediaType() const = 0;
virtual void redirectDataToPlugin(Widget* pluginWidget) { }
protected:
virtual Plugin* createPlugin(Element* node, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType) = 0;
virtual Frame* createFrame(const KURL& url, const String& name, RenderPart* renderer, const String& referrer) = 0;
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0;
virtual void redirectionTimerFired(Timer<Frame>*);
virtual void redirectionTimerFired(Timer<Frame>*);
public:
void loadDone();
......
......@@ -50,7 +50,8 @@ struct PluginInfo {
class PlugInInfoStore {
public:
PluginInfo *createPluginInfoForPluginAtIndex(unsigned);
unsigned pluginCount() const;
unsigned pluginCount() const;
static bool supportsMIMEType(const String& mimeType);
};
void refreshPlugins(bool reloadOpenPages);
......
......@@ -74,6 +74,15 @@ unsigned PlugInInfoStore::pluginCount() const
return 0;
}
bool PlugInInfoStore::supportsMIMEType(const String& mimeType)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] pluginSupportsMIMEType:mimeType];
END_BLOCK_OBJC_EXCEPTIONS;
return NO;
}
void refreshPlugins(bool reloadOpenPages)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
......
2006-06-11 Anders Carlsson <acarlsson@apple.com>
Reviewed by Tim.
http://bugzilla.opendarwin.org/show_bug.cgi?id=9390
Move full-frame plugins to WebCore
* Plugins/WebBaseNetscapePluginStream.h:
* Plugins/WebBaseNetscapePluginStream.m:
(-[WebBaseNetscapePluginStream instance]):
Add instance method which returns the plugin instance.
* Plugins/WebBasePluginPackage.h:
Add WebPluginManualLoader protocol
* Plugins/WebNetscapePluginDocumentView.h: Removed.
* Plugins/WebNetscapePluginDocumentView.m: Removed.
* Plugins/WebNetscapePluginEmbeddedView.h:
* Plugins/WebNetscapePluginEmbeddedView.m:
(-[WebNetscapePluginEmbeddedView initWithFrame:plugin:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:]):
(-[WebNetscapePluginEmbeddedView dealloc]):
(-[WebNetscapePluginEmbeddedView didStart]):
(-[WebNetscapePluginEmbeddedView pluginView:receivedResponse:]):
(-[WebNetscapePluginEmbeddedView pluginView:receivedData:]):
(-[WebNetscapePluginEmbeddedView pluginView:receivedError:]):
(-[WebNetscapePluginEmbeddedView pluginViewFinishedLoading:]):
(-[WebNetscapePluginEmbeddedView redeliverStream]):
Make WebNetscapePluginEmbeddedView support the WebPluginManualLoader protocol. It creates a plugin stream and feeds the
data manually. Much of this code has been copied from WebNetscapePluginRepresentation.
* Plugins/WebNetscapePluginRepresentation.h: Removed.
* Plugins/WebNetscapePluginRepresentation.m: Removed.
* Plugins/WebPluginController.h:
* Plugins/WebPluginController.m:
(-[WebPluginController pluginView:receivedResponse:]):
(-[WebPluginController pluginView:receivedData:]):
(-[WebPluginController pluginView:receivedError:]):
(-[WebPluginController pluginViewFinishedLoading:]):
Make WebPluginController support the WebPluginManualLoader protocol so it can feed data manually to WebKit plugins.
* Plugins/WebPluginDatabase.m:
(-[WebPluginDatabase refresh]):
Use WebHTMLView and WebHTMLRepresentation when registering/unregistering plug-in MIME types.
* Plugins/WebPluginDocumentView.h: Removed.
* Plugins/WebPluginDocumentView.m: Removed.
* WebCoreSupport/WebFrameBridge.m:
(-[WebFrameBridge pluginViewWithPackage:attributeNames:attributeValues:baseURL:DOMElement:loadManually:]):
(-[WebFrameBridge viewForPluginWithURL:attributeNames:attributeValues:MIMEType:DOMElement:loadManually:]):
Add loadManually argument.
(-[WebFrameBridge redirectDataToPlugin:]):
Call down to the HTML representation.
(-[WebFrameBridge viewForJavaAppletWithFrame:attributeNames:attributeValues:baseURL:DOMElement:]):
Pass NO to loadManually.
(-[WebFrameBridge determineObjectFromMIMEType:URL:]):
Explicitly check if the MIME type is supported by a plug-in instead of checking the view class.
* WebCoreSupport/WebViewFactory.m:
(-[WebViewFactory pluginSupportsMIMEType:]):
New function which returns whether any plugins support a given MIME type.
* WebKit.xcodeproj/project.pbxproj:
Update for removed files.
* WebView/WebFrame.m:
(-[WebFrame _reloadForPluginChanges]):
Remove view type checks.
(-[WebFrame _recursive_pauseNullEventsForAllNetscapePlugins]):
(-[WebFrame _recursive_resumeNullEventsForAllNetscapePlugins]):
Remove FIXME comments.
* WebView/WebHTMLRepresentation.m:
(-[WebHTMLRepresentation _redirectDataToManualLoader:forPluginView:]):
New function which redirects incoming data to a manual loader.
(-[WebHTMLRepresentation receivedData:withDataSource:]):
(-[WebHTMLRepresentation receivedError:withDataSource:]):
(-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
Optionally redirect incoming data.
* WebView/WebHTMLRepresentationPrivate.h:
2006-06-09 John Sullivan <sullivan@apple.com>
Reviewed by Tim Omernick and Dave Hyatt.
......
......@@ -72,6 +72,7 @@
- (void)setPluginPointer:(NPP)pluginPointer;
- (uint16)transferMode;
- (NPP)instance;
- (void)startStreamResponseURL:(NSURL *)theResponseURL
expectedContentLength:(long long)expectedContentLength
......
......@@ -142,6 +142,11 @@ - (uint16)transferMode
return transferMode;
}
- (NPP)instance
{
return instance;
}
- (void)setRequestURL:(NSURL *)theRequestURL
{
[theRequestURL retain];
......
......@@ -29,6 +29,13 @@
#import <WebCore/WebCoreViewFactory.h>
#import <WebKit/npfunctions.h>
@protocol WebPluginManualLoader
- (void)pluginView:(NSView *)pluginView receivedResponse:(NSURLResponse *)response;
- (void)pluginView:(NSView *)pluginView receivedData:(NSData *)data;
- (void)pluginView:(NSView *)pluginView receivedError:(NSError *)error;
- (void)pluginViewFinishedLoading:(NSView *)pluginView;
@end
#define WebPluginExtensionsKey @"WebPluginExtensions"