当前位置: 首页>>代码示例>>C++>>正文


C++ PluginData::supportsWebVisibleMimeType方法代码示例

本文整理汇总了C++中PluginData::supportsWebVisibleMimeType方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginData::supportsWebVisibleMimeType方法的具体用法?C++ PluginData::supportsWebVisibleMimeType怎么用?C++ PluginData::supportsWebVisibleMimeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginData的用法示例。


在下文中一共展示了PluginData::supportsWebVisibleMimeType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create

RefPtr<Document> DOMImplementation::createDocument(const String& type, Frame* frame, const URL& url)
{
    // Plugins cannot take HTML and XHTML from us, and we don't even need to initialize the plugin database for those.
    if (type == "text/html")
        return HTMLDocument::create(frame, url);
    if (type == "application/xhtml+xml")
        return Document::createXHTML(frame, url);

#if ENABLE(FTPDIR)
    // Plugins cannot take FTP from us either
    if (type == "application/x-ftp-directory")
        return FTPDirectoryDocument::create(frame, url);
#endif

    // If we want to useImageDocumentForSubframePDF, we'll let that override plugin support.
    if (frame && !frame->isMainFrame() && MIMETypeRegistry::isPDFMIMEType(type) && frame->settings().useImageDocumentForSubframePDF())
        return ImageDocument::create(*frame, url);

    PluginData* pluginData = 0;
    PluginData::AllowedPluginTypes allowedPluginTypes = PluginData::OnlyApplicationPlugins;
    if (frame && frame->page()) {
        if (frame->loader().subframeLoader().allowPlugins(NotAboutToInstantiatePlugin))
            allowedPluginTypes = PluginData::AllPlugins;

        pluginData = &frame->page()->pluginData();
    }

    // PDF is one image type for which a plugin can override built-in support.
    // We do not want QuickTime to take over all image types, obviously.
    if (MIMETypeRegistry::isPDFOrPostScriptMIMEType(type) && pluginData && pluginData->supportsWebVisibleMimeType(type, allowedPluginTypes))
        return PluginDocument::create(frame, url);
    if (Image::supportsType(type))
        return ImageDocument::create(*frame, url);

#if ENABLE(VIDEO)
    // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument
    // Key system is not applicable here.
    DOMImplementationSupportsTypeClient client(frame && frame->settings().needsSiteSpecificQuirks(), url.host());
    MediaEngineSupportParameters parameters;
    parameters.type = type;
    parameters.url = url;
    if (MediaPlayer::supportsType(parameters, &client))
        return MediaDocument::create(frame, url);
#endif

    // Everything else except text/plain can be overridden by plugins. In particular, Adobe SVG Viewer should be used for SVG, if installed.
    // Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a fundamental type that the browser is expected to handle,
    // and also serves as an optimization to prevent loading the plug-in database in the common case.
    if (type != "text/plain" && ((pluginData && pluginData->supportsWebVisibleMimeType(type, allowedPluginTypes)) || (frame && frame->loader().client().shouldAlwaysUsePluginDocument(type))))
        return PluginDocument::create(frame, url);
    if (isTextMIMEType(type))
        return TextDocument::create(frame, url);

    if (type == "image/svg+xml")
        return SVGDocument::create(frame, url);

    if (isXMLMIMEType(type))
        return Document::create(frame, url);

    return HTMLDocument::create(frame, url);
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:61,代码来源:DOMImplementation.cpp


注:本文中的PluginData::supportsWebVisibleMimeType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。