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


C++ PluginData类代码示例

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


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

示例1: findPluginMIMETypeFromURL

static String findPluginMIMETypeFromURL(Page* page, const String& url)
{
    if (!url)
        return String();

    size_t dotIndex = url.reverseFind('.');
    if (dotIndex == notFound)
        return String();

    String extension = url.substring(dotIndex + 1);

    PluginData* pluginData = page->pluginData();
    if (!pluginData)
        return String();

    for (size_t i = 0; i < pluginData->mimes().size(); ++i) {
        const MimeClassInfo& mimeClassInfo = pluginData->mimes()[i];
        for (size_t j = 0; j < mimeClassInfo.extensions.size(); ++j) {
            if (equalIgnoringCase(extension, mimeClassInfo.extensions[j]))
                return mimeClassInfo.type;
        }
    }

    return String();
}
开发者ID:yllan,项目名称:webkit,代码行数:25,代码来源:SubframeLoader.cpp

示例2: logPluginRequest

static void logPluginRequest(Page* page, const String& mimeType, const String& url, bool success)
{
    if (!page || !page->settings()->diagnosticLoggingEnabled())
        return;

    String newMIMEType = mimeType;
    if (!newMIMEType) {
        // Try to figure out the MIME type from the URL extension.
        newMIMEType = findPluginMIMETypeFromURL(page, url);
        if (!newMIMEType)
            return;
    }

    PluginData* pluginData = page->pluginData();
    String pluginFile = pluginData ? pluginData->pluginFileForMimeType(newMIMEType) : String();
    String description = !pluginFile ? newMIMEType : pluginFile;

    ChromeClient* client = page->chrome().client();
    client->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), description, DiagnosticLoggingKeys::noopKey());

    if (!page->hasSeenAnyPlugin())
        client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString(), DiagnosticLoggingKeys::noopKey());
    
    if (!page->hasSeenPlugin(description))
        client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), description, DiagnosticLoggingKeys::noopKey());

    page->sawPlugin(description);
}
开发者ID:yllan,项目名称:webkit,代码行数:28,代码来源:SubframeLoader.cpp

示例3: canShowMIMEType

static bool canShowMIMEType(const String& mimeType, LocalFrame* frame)
{
    if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported)
        return true;
    PluginData* pluginData = frame->pluginData();
    return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mimeType);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,代码来源:DocumentLoader.cpp

示例4: pluginData

unsigned DOMPluginArray::length() const
{
    PluginData* data = pluginData();
    if (!data)
        return 0;
    return data->plugins().size();
}
开发者ID:kjthegod,项目名称:WebKit,代码行数:7,代码来源:DOMPluginArray.cpp

示例5: canShowMIMEType

static bool canShowMIMEType(const String& mimeType, Page* page)
{
    if (blink::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == blink::WebMimeRegistry::IsSupported)
        return true;
    PluginData* pluginData = page->pluginData();
    return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mimeType);
}
开发者ID:rzr,项目名称:blink-crosswalk,代码行数:7,代码来源:DocumentLoader.cpp

示例6: getPluginData

unsigned DOMMimeTypeArray::length() const
{
    PluginData* data = getPluginData();
    if (!data)
        return 0;
    return data->mimes().size();
}
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:7,代码来源:DOMMimeTypeArray.cpp

示例7: quitPlugin

void WelcomeWindow::quitPlugin() {
	//Unloads and disables the plugin
	//We don't want the welcome plugin at every QuarkPlayer start
	//just at the very first start
	PluginData pluginData = PluginManager::instance().pluginData(uuid());
	pluginData.setEnabled(false);
	PluginManager::instance().deletePlugin(pluginData);
}
开发者ID:vilkov,项目名称:phonon-vlc-mplayer,代码行数:8,代码来源:WelcomeWindow.cpp

示例8: ENABLE

PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame* frame, bool inViewSourceMode)
{
    if (inViewSourceMode) {
        if (type == "text/html" || type == "application/xhtml+xml" || type == "image/svg+xml" || isTextMIMEType(type) || isXMLMIMEType(type))
            return HTMLViewSourceDocument::create(frame, type);
    }

    // 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);
    if (type == "application/xhtml+xml")
        return Document::createXHTML(frame);
        
#if ENABLE(FTPDIR)
    // Plugins cannot take FTP from us either
    if (type == "application/x-ftp-directory")
        return FTPDirectoryDocument::create(frame);
#endif

    PluginData* pluginData = 0;
    if (frame && frame->page() && frame->page()->settings()->arePluginsEnabled())
        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 ((type == "application/pdf" || type == "text/pdf") && pluginData && pluginData->supportsMimeType(type))
        return PluginDocument::create(frame);
    if (Image::supportsType(type))
        return ImageDocument::create(frame);

#if ENABLE(VIDEO)
     // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument
     if (MediaPlayer::supportsType(type))
         return MediaDocument::create(frame);
#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->supportsMimeType(type)) 
        return PluginDocument::create(frame);
    if (isTextMIMEType(type))
        return TextDocument::create(frame);

#if ENABLE(SVG)
    if (type == "image/svg+xml") {
#if ENABLE(DASHBOARD_SUPPORT)    
        Settings* settings = frame ? frame->settings() : 0;
        if (!settings || !settings->usesDashboardBackwardCompatibilityMode())
#endif
            return SVGDocument::create(frame);
    }
#endif
    if (isXMLMIMEType(type))
        return Document::create(frame);

    return HTMLDocument::create(frame);
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:58,代码来源:DOMImplementation.cpp

示例9: ENABLE

PassRefPtr<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

    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->supportsMimeType(type, allowedPluginTypes))
        return PluginDocument::create(frame, url);
    if (Image::supportsType(type))
        return ImageDocument::create(frame, url);

#if ENABLE(VIDEO) && !ENABLE(PLUGIN_PROXY_FOR_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->supportsMimeType(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:xtturing,项目名称:webkit,代码行数:57,代码来源:DOMImplementation.cpp

示例10: getPluginData

DOMMimeType* DOMMimeTypeArray::item(unsigned index) {
  PluginData* data = getPluginData();
  if (!data)
    return nullptr;
  const Vector<MimeClassInfo>& mimes = data->mimes();
  if (index >= mimes.size())
    return nullptr;
  return DOMMimeType::create(data, frame(), index);
}
开发者ID:mirror,项目名称:chromium,代码行数:9,代码来源:DOMMimeTypeArray.cpp

示例11: getPluginData

PassRefPtr<MimeType> MimeTypeArray::item(unsigned index)
{
    PluginData* data = getPluginData();
    if (!data)
        return 0;
    const Vector<MimeClassInfo*>& mimes = data->mimes();
    if (index >= mimes.size())
        return 0;
    return MimeType::create(data, index).get();
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:10,代码来源:MimeTypeArray.cpp

示例12: getPluginData

unsigned DOMMimeTypeArray::length() const
{
    PluginData* data = getPluginData();
    if (!data)
        return 0;

    Vector<MimeClassInfo> mimes;
    Vector<size_t> mimePluginIndices;
    data->getWebVisibleMimesAndPluginIndices(mimes, mimePluginIndices);
    return mimes.size();
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:11,代码来源:DOMMimeTypeArray.cpp

示例13: create

PassRefPtrWillBeRawPtr<Document> DOMImplementation::createDocument(const String& type, const DocumentInit& init, bool inViewSourceMode)
{
    if (inViewSourceMode)
        return HTMLViewSourceDocument::create(init, type);

    // 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(init);
    if (type == "application/xhtml+xml" || type == "application/vnd.wap.xhtml+xml")
        return XMLDocument::createXHTML(init);
    if (type == "text/vnd.wap.wml")
        return XMLDocument::createWML(init);

    PluginData* pluginData = 0;
    if (init.frame() && init.frame()->page() && init.frame()->loader().allowPlugins(NotAboutToInstantiatePlugin))
        pluginData = init.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 ((type == "application/pdf" || type == "text/pdf") && pluginData && pluginData->supportsMimeType(type))
        return PluginDocument::create(init);
    if (Image::supportsType(type))
        return ImageDocument::create(init);

    // Check to see if the type can be played by our media player, if so create a MediaDocument
    if (HTMLMediaElement::supportsType(ContentType(type)))
        return MediaDocument::create(init);

    // Everything else except text/plain can be overridden by plugins. In particular, Adobe SVG Viewer should be used for SVG, if installed.
    // Disallowing plugins to use text/plain prevents plugins from hijacking a fundamental type that the browser is expected to handle,
    // and also serves as an optimization to prevent loading the plugin database in the common case.
    if (type != "text/plain" && pluginData && pluginData->supportsMimeType(type))
        return PluginDocument::create(init);
    if (isTextMIMEType(type))
        return TextDocument::create(init);
    if (type == "image/svg+xml")
        return XMLDocument::createSVG(init);
    if (isXMLMIMEType(type))
        return XMLDocument::create(init);

    return HTMLDocument::create(init);
}
开发者ID:vadimtk,项目名称:chrome4sdp,代码行数:42,代码来源:DOMImplementation.cpp

示例14: getObjectContentType

ObjectContentType FrameLoaderClientImpl::getObjectContentType(
    const KURL& url,
    const String& explicitMimeType,
    bool shouldPreferPlugInsForImages) {
  // This code is based on Apple's implementation from
  // WebCoreSupport/WebFrameBridge.mm.

  String mimeType = explicitMimeType;
  if (mimeType.isEmpty()) {
    // Try to guess the MIME type based off the extension.
    String filename = url.lastPathComponent();
    int extensionPos = filename.reverseFind('.');
    if (extensionPos >= 0) {
      String extension = filename.substring(extensionPos + 1);
      mimeType = MIMETypeRegistry::getWellKnownMIMETypeForExtension(extension);
    }

    if (mimeType.isEmpty())
      return ObjectContentFrame;
  }

  // If Chrome is started with the --disable-plugins switch, pluginData is 0.
  PluginData* pluginData = m_webFrame->frame()->pluginData();
  bool plugInSupportsMIMEType =
      pluginData && pluginData->supportsMimeType(mimeType);

  if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
    return shouldPreferPlugInsForImages && plugInSupportsMIMEType
               ? ObjectContentNetscapePlugin
               : ObjectContentImage;

  if (plugInSupportsMIMEType)
    return ObjectContentNetscapePlugin;

  if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
    return ObjectContentFrame;

  return ObjectContentNone;
}
开发者ID:mirror,项目名称:chromium,代码行数:39,代码来源:FrameLoaderClientImpl.cpp


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