本文整理汇总了C++中PluginView::plugin方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginView::plugin方法的具体用法?C++ PluginView::plugin怎么用?C++ PluginView::plugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginView
的用法示例。
在下文中一共展示了PluginView::plugin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createJavaAppletWidget
Widget* WebFrame::createJavaAppletWidget(const IntSize& pluginSize, Element* element, const KURL& /*baseURL*/, const Vector<String>& paramNames, const Vector<String>& paramValues)
{
PluginView* pluginView = PluginView::create(core(this), pluginSize, element, KURL(), paramNames, paramValues, "application/x-java-applet", false);
// Check if the plugin can be loaded successfully
if (pluginView->plugin() && pluginView->plugin()->load())
return pluginView;
return pluginView;
}
示例2: createPlugin
Widget* WebFrameLoaderClient::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
WebView* webView = m_webFrame->webView();
COMPtr<IWebUIDelegate> ui;
if (SUCCEEDED(webView->uiDelegate(&ui)) && ui) {
COMPtr<IWebUIDelegatePrivate4> uiPrivate(Query, ui);
if (uiPrivate) {
// Assemble the view arguments in a property bag.
HashMap<String, String> viewArguments;
for (unsigned i = 0; i < paramNames.size(); i++)
viewArguments.set(paramNames[i], paramValues[i]);
COMPtr<IPropertyBag> viewArgumentsBag(AdoptCOM, COMPropertyBag<String>::adopt(viewArguments));
COMPtr<IDOMElement> containingElement(AdoptCOM, DOMElement::createInstance(element));
HashMap<String, COMVariant> arguments;
arguments.set(WebEmbeddedViewAttributesKey, viewArgumentsBag);
arguments.set(WebEmbeddedViewBaseURLKey, url.string());
arguments.set(WebEmbeddedViewContainingElementKey, containingElement);
arguments.set(WebEmbeddedViewMIMETypeKey, mimeType);
COMPtr<IPropertyBag> argumentsBag(AdoptCOM, COMPropertyBag<COMVariant>::adopt(arguments));
COMPtr<IWebEmbeddedView> view;
HRESULT result = uiPrivate->embeddedViewWithArguments(webView, m_webFrame, argumentsBag.get(), &view);
if (SUCCEEDED(result)) {
HWND parentWindow;
HRESULT hr = webView->viewWindow((OLE_HANDLE*)&parentWindow);
ASSERT(SUCCEEDED(hr));
return EmbeddedWidget::create(view.get(), element, parentWindow, pluginSize);
}
}
}
Frame* frame = core(m_webFrame);
PluginView* pluginView = PluginView::create(frame, pluginSize, element, url, paramNames, paramValues, mimeType, loadManually);
if (pluginView->status() == PluginStatusLoadedSuccessfully)
return pluginView;
COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
return pluginView;
RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
unsigned count = (unsigned)paramNames.size();
for (unsigned i = 0; i < count; i++) {
if (paramNames[i] == "pluginspage") {
static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInPageURLStringKey);
RetainPtr<CFStringRef> str(AdoptCF, paramValues[i].createCFString());
CFDictionarySetValue(userInfo.get(), key, str.get());
break;
}
}
if (!mimeType.isNull()) {
static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorMIMETypeKey);
RetainPtr<CFStringRef> str(AdoptCF, mimeType.createCFString());
CFDictionarySetValue(userInfo.get(), key, str.get());
}
String pluginName;
if (pluginView->plugin())
pluginName = pluginView->plugin()->name();
if (!pluginName.isNull()) {
static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInNameKey);
RetainPtr<CFStringRef> str(AdoptCF, pluginName.createCFString());
CFDictionarySetValue(userInfo.get(), key, str.get());
}
COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
userInfoBag->setDictionary(userInfo.get());
int errorCode = 0;
switch (pluginView->status()) {
case PluginStatusCanNotFindPlugin:
errorCode = WebKitErrorCannotFindPlugIn;
break;
case PluginStatusCanNotLoadPlugin:
errorCode = WebKitErrorCannotLoadPlugIn;
break;
default:
ASSERT_NOT_REACHED();
}
ResourceError resourceError(String(WebKitErrorDomain), errorCode, url.string(), String());
COMPtr<IWebError> error(AdoptCOM, WebError::createInstance(resourceError, userInfoBag.get()));
resourceLoadDelegate->plugInFailedWithError(webView, error.get(), getWebDataSource(frame->loader()->documentLoader()));
return pluginView;
}