예제 #1
0
nsresult
nsResProtocolHandler::Init(nsIFile *aOmniJar)
{
    nsresult rv;
    nsCOMPtr<nsIURI> uri;
    nsCAutoString omniJarSpec;
    NS_GetURLSpecFromActualFile(aOmniJar, omniJarSpec, mIOService);

    nsCAutoString urlStr("jar:");
    urlStr += omniJarSpec;
    urlStr += "!/";

    rv = mIOService->NewURI(urlStr, nsnull, nsnull, getter_AddRefs(uri));
    NS_ENSURE_SUCCESS(rv, rv);

    // these entries should be kept in sync with the normal Init function

    // resource:/// points to jar:omni.jar!/
    SetSubstitution(EmptyCString(), uri);

    // resource://gre/ points to jar:omni.jar!/
    SetSubstitution(kGRE, uri);

    urlStr += "chrome/toolkit/res/";
    rv = mIOService->NewURI(urlStr, nsnull, nsnull, getter_AddRefs(uri));
    NS_ENSURE_SUCCESS(rv, rv);

    // resource://gre-resources/ points to jar:omni.jar!/chrome/toolkit/res/
    SetSubstitution(kGRE_RESOURCES, uri);
    return NS_OK;
}
예제 #2
0
// Open a URL by default browser
int main( int argc, char **argv )
{
  if ( argc < 2 )
  {
    fprintf( stderr, "URL argument missing\n" );
    exit( 1 );
  }
  QString urlStr( argv[1] );
  QUrl url( urlStr );
#ifdef Q_OS_WIN
  // openUrl on windows fails to open 'file://c:...' it must be 'file:///c:...' (3 slashes)
  if ( url.scheme() == "file" )
  {
    // this does not work, the drive was already removed by QT:
    //url.setPath ( "/" + url.path() );
    urlStr.replace( "file://", "file:///" );
    url.setUrl( urlStr );
    std::cout << "path reset to: " << qPrintable( url.path() ) << std::endl;
  }
#endif
  QDesktopServices::openUrl( url );
#ifdef Q_OS_WIN
  Sleep( 1000 );
#else
  sleep( 1 ); // not nice but if it exits immediately the page sometimes does not open
#endif
  exit( 0 );
}
예제 #3
0
void QtWebPageLoadClient::didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void* clientInfo)
{
    WebFrameProxy* wkframe = toImpl(frame);
    QString urlStr(wkframe->url());
    QUrl qUrl = urlStr;
    toQtWebPageLoadClient(clientInfo)->didSameDocumentNavigationForFrame(qUrl);
}
예제 #4
0
void QtWebPageLoadClient::didCommitLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
{
    if (!WKFrameIsMainFrame(frame))
        return;
    WebFrameProxy* wkframe = toImpl(frame);
    QString urlStr(wkframe->url());
    QUrl qUrl = urlStr;
    toQtWebPageLoadClient(clientInfo)->didCommitLoadForFrame(qUrl);
}
예제 #5
0
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
                                    CefRefPtr<CefFrame> frame,
                                    const CefString& url) {
  REQUIRE_UI_THREAD();

  if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
      // Set the edit window text
    std::string urlStr(url);
    gtk_entry_set_text(GTK_ENTRY(m_EditHwnd), urlStr.c_str());
  }
}
예제 #6
0
/*!
  \brief Request Steam App image.

  This downloads a graphic resource from a steam URI. Upon success we create a
  \c QPixmap out of it and send it out to the main window via signal.

  \param appID The app ID we wish the game image for.
*/
void
Steam::requestAppImage( int appID )
{
  if( appID <= 0 )
    return;

  QString urlStr( QL( "http://cdn.akamai.steamstatic.com/steam/apps/%1/"
    "header.jpg" ) );

  QUrl url( urlStr.arg( appID ) );
  QNetworkRequest request( url );

  QNetworkReply *reply = d->network->get( request );
  connectReply( reply );
}
예제 #7
0
void FBPostDialogActivity::createWindow(const QRectF &window_geometry,
                                        const QString &window_title,
                                        const QPointF &window_pos) {
  d->mFrame = new PlexyDesk::Window();
  d->mFrame->setGeometry(geometry());
  d->mFrame->setVisible(true);
  d->mFrame->setLabelName("Message Dialog");

  if (hasAttribute("title")) {
    d->mFrame->setWindowTitle(attributes()["title"].toString());
  }

  d->mFrame->setWindowFlag(PlexyDesk::Window::kRenderBackground);
  d->mFrame->setWindowFlag(PlexyDesk::Window::kTopLevelWindow);
  d->mFrame->setWindowFlag(PlexyDesk::Window::kConvertToWindowType);
  d->mFrame->setWindowFlag(PlexyDesk::Window::kRenderWindowTitle);
  d->mFrame->setWindowFlag(PlexyDesk::Window::kRenderDropShadow);

  exec();
  this->showActivity();
  // todo: invoke UI

  connect(d->mFrame, SIGNAL(closed(PlexyDesk::Widget *)), this,
          SLOT(onWidgetClosed(PlexyDesk::Widget *)));

  d->mNm = PlexyDesk::Config::getNetworkAccessManager();

  d->mWebView = new QGraphicsWebView(d->mFrame);
  d->mWebView->page()->setNetworkAccessManager(d->mNm);

  QRectF webRect(0.0, 0.0, this->geometry().width(),
                 this->geometry().height() - 64);

  d->mWebView->setGeometry(webRect);
  d->mWebView->setPos(QPoint(0.0, 72.0));
  d->mWebView->setResizesToContents(false);
  d->mWebView->show();
  QString token = attributes()["token"].toString();
  QString urlStr(QString("https://www.facebook.com/dialog/"
                         "feed?app_id=170356722999159&display=popup&caption=An%"
                         "20example%20caption&link=https%3A%2F%2Fdevelopers."
                         "facebook.com%2Fdocs%2Fdialogs%2F&redirect_uri=http://"
                         "www.facebook.com/connect/login_success.html"));
  qDebug() << Q_FUNC_INFO << urlStr;
  d->mWebView->setUrl(QUrl(urlStr));
}
예제 #8
0
void Receiver::slotLaunchTest()
{
    QPushButton *button = qobject_cast<QPushButton *>(sender());
    Q_ASSERT(button);
    const int testNumber = button->property("testNumber").toInt();
    QList<QUrl> urls;
    if (QByteArray(s_tests[testNumber].text).startsWith("runCommand")) {
        KRun::runCommand(s_tests[testNumber].exec, this);
    } else {
        if (s_tests[testNumber].url) {
            QString urlStr(s_tests[testNumber].url);
            if (urlStr == QLatin1String(testFile)) {
                urlStr = QFINDTESTDATA(testFile);
            }
            urls << QUrl::fromUserInput(urlStr);
        }
        KRun::run(s_tests[testNumber].exec, urls, this);
    }
}
예제 #9
0
파일: places.cpp 프로젝트: idaohang/mole
void PlaceModel::setUrl()
{
  for (int i = 0; i < m_index; ++i) {
    if (places[i].isEmpty()) {
      qDebug() << "places " << m_index << " not setting url "
               << "with empty parent " << i;
      stopRefill();
      return;
    }
  }

  QString urlStr(staticServerURL);
  urlStr.append("/map/");

  for (int i = 0; i < m_index; ++i) {
    urlStr.append(places[i]);
    urlStr.append("/");
  }
  urlStr.append("places.txt");

  qDebug() << "place url " << urlStr;

  UpdatingModel::setUrl(QUrl(urlStr));
}
예제 #10
0
// TODO(jat): remove suppliedUrl and update hosted.html API
NS_IMETHODIMP ExternalWrapper::Connect(const nsACString& suppliedUrl,
                                       const nsACString& sessionKey, const nsACString& aAddr,
                                       const nsACString& aModuleName, const nsACString& hostedHtmlVersion,
                                       PRBool *_retval) {
    Debug::log(Debug::Info) << "Connect(url=" <<  url << ", sessionKey="
                            << sessionKey << ", address=" << aAddr << ", module=" << aModuleName
                            << ", hostedHtmlVersion=" << hostedHtmlVersion << Debug::flush;

    // TODO: string utilities?
    nsCString urlAutoStr;
    NS_UTF16ToCString(url, NS_CSTRING_ENCODING_UTF8, urlAutoStr);
    nsCString sessionKeyAutoStr(sessionKey);
    nsCString addrAutoStr(aAddr);
    nsCString moduleAutoStr(aModuleName);
    nsCString hostedHtmlVersionAutoStr(hostedHtmlVersion);
    std::string hostedUrl(addrAutoStr.get());
    std::string urlStr(urlAutoStr.get());

    bool allowed = false;
    std::string webHost = AllowedConnections::getHostFromUrl(urlStr);
    std::string codeServer = AllowedConnections::getCodeServerFromUrl(urlStr);
    if (!AllowedConnections::matchesRule( webHost, codeServer, &allowed)) {
        // If we didn't match an existing rule, prompt the user
        allowed = askUserToAllow(urlStr);
    }
    if (!allowed) {
        *_retval = false;
        return NS_OK;
    }

    size_t index = hostedUrl.find(':');
    if (index == std::string::npos) {
        *_retval = false;
        return NS_OK;
    }
    std::string hostPart = hostedUrl.substr(0, index);
    std::string portPart = hostedUrl.substr(index + 1);

    // TODO(jat): leaks HostChannel -- need to save it in a session object and
    // return that so the host page can call a disconnect method on it at unload
    // time or when it gets GC'd.
    HostChannel* channel = new HostChannel();

    Debug::log(Debug::Debugging) << "Connecting..." << Debug::flush;

    if (!channel->connectToHost(hostPart.c_str(),
                                atoi(portPart.c_str()))) {
        *_retval = false;
        return NS_OK;
    }

    Debug::log(Debug::Debugging) << "...Connected" << Debug::flush;
    sessionHandler.reset(new FFSessionHandler(channel/*, ctx*/));

    std::string hostedHtmlVersionStr(hostedHtmlVersionAutoStr.get());
    if (!channel->init(sessionHandler.get(), BROWSERCHANNEL_PROTOCOL_VERSION,
                       BROWSERCHANNEL_PROTOCOL_VERSION, hostedHtmlVersionStr)) {
        *_retval = false;
        return NS_OK;
    }

    std::string moduleName(moduleAutoStr.get());
    std::string userAgent;

    // get the user agent
    nsresult res = getUserAgent(userAgent);
    if (NS_FAILED(res)) {
        return res;
    }

    std::string tabKeyStr = computeTabIdentity();
    std::string sessionKeyStr(sessionKeyAutoStr.get());

    LoadModuleMessage::send(*channel, urlStr, tabKeyStr, sessionKeyStr,
                            moduleName, userAgent, sessionHandler.get());

    // TODO: return session object?
    *_retval = true;
    return NS_OK;
}
예제 #11
0
PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames,
                                          const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
//     qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType;
//     qDebug()<<"------\t url = "<<url.prettyURL();

    if (!m_webFrame)
        return 0;

    QStringList params;
    QStringList values;
    QString classid(element->getAttribute("classid"));

    for (unsigned i = 0; i < paramNames.size(); ++i) {
        params.append(paramNames[i]);
        if (paramNames[i] == "classid")
            classid = paramValues[i];
    }
    for (unsigned i = 0; i < paramValues.size(); ++i)
        values.append(paramValues[i]);

    QString urlStr(url.string());
    QUrl qurl = urlStr;

    QObject* object = 0;

    if (mimeType == "application/x-qt-plugin" || mimeType == "application/x-qt-styled-widget") {
        object = m_webFrame->page()->createPlugin(classid, qurl, params, values);
#ifndef QT_NO_STYLE_STYLESHEET
        QWidget* widget = qobject_cast<QWidget*>(object);
        if (widget && mimeType == "application/x-qt-styled-widget") {

            QString styleSheet = element->getAttribute("style");
            if (!styleSheet.isEmpty())
                styleSheet += QLatin1Char(';');

            for (unsigned i = 0; i < numqStyleSheetProperties; ++i) {
                CSSPropertyID property = qstyleSheetProperties[i];

                styleSheet += QString::fromLatin1(::getPropertyName(property));
                styleSheet += QLatin1Char(':');
                styleSheet += computedStyle(element)->getPropertyValue(property);
                styleSheet += QLatin1Char(';');
            }

            widget->setStyleSheet(styleSheet);
        }
#endif // QT_NO_STYLE_STYLESHEET
    }

        if (!object) {
            QWebPluginFactory* factory = m_webFrame->page()->pluginFactory();
            if (factory)
                object = factory->create(mimeType, qurl, params, values);
        }

        if (object) {
            QWidget* widget = qobject_cast<QWidget*>(object);
            if (widget) {
                QWidget* parentWidget = 0;
                if (m_webFrame->page()->d->client)
                    parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent());
                if (parentWidget) // don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose.
                    widget->setParent(parentWidget);
                widget->hide();
                RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget());
                w->setPlatformWidget(widget);
                // Make sure it's invisible until properly placed into the layout
                w->setFrameRect(IntRect(0, 0, 0, 0));
                return w;
            }
#if QT_VERSION >= 0x040600
            QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object);
            if (graphicsWidget) {
                QGraphicsObject* parentWidget = 0;
                if (m_webFrame->page()->d->client)
                    parentWidget = qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent());
                graphicsWidget->hide();
                if (parentWidget) // don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose.
                    graphicsWidget->setParentItem(parentWidget);
                RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget);
                // Make sure it's invisible until properly placed into the layout
                w->setFrameRect(IntRect(0, 0, 0, 0));
                return w;
            }
#endif
            // FIXME: make things work for widgetless plugins as well
            delete object;
    } else { // NPAPI Plugins
        Vector<String> params = paramNames;
        Vector<String> values = paramValues;
        if (mimeType == "application/x-shockwave-flash") {
            QWebPageClient* client = m_webFrame->page()->d->client;
            const bool isQWebView = client && qobject_cast<QWidget*>(client->pluginParent());
#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5)
            size_t wmodeIndex = params.find("wmode");
            if (wmodeIndex == -1) {
                // Disable XEmbed mode and force it to opaque mode
                params.append("wmode");
                values.append("opaque");
            } else if (!isQWebView) {
                // Disable transparency if client is not a QWebView
                values[wmodeIndex] = "opaque";
            }
#else
            if (!isQWebView) {
                // inject wmode=opaque when there is no client or the client is not a QWebView
                size_t wmodeIndex = params.find("wmode");
                if (wmodeIndex == -1) {
                    params.append("wmode");
                    values.append("opaque");
                } else
                    values[wmodeIndex] = "opaque";
            }
#endif
        }

        RefPtr<PluginView> pluginView = PluginView::create(m_frame, pluginSize, element, url,
            params, values, mimeType, loadManually);
        return pluginView;
    }

    return 0;
}
예제 #12
0
/* void GenVar (); */
NS_IMETHODIMP nsChlVarGenerator_1::GenVar()
{
     //Get the target class
     PRInt32 len=0;
     m_model->GetClassCount(&len);
     double minValue=INT_MAX;
     Distance ld;
     std::list<int> classids;
     for(int i=0;i<len;i++)
     {
	  nsCOMPtr<nsIAttVec> vec(nsnull);
	  m_model->GetClassAtt(i, getter_AddRefs(vec) );
	  nsCOMPtr<nsIDOMNode> node(nsnull);
	  vec->GetNode(getter_AddRefs(node));
	  nsCOMPtr<nsIDOMDocument> doc;
	  vec->GetDoc(getter_AddRefs(doc));
	  nsCOMPtr<nsIDOMHTMLDocument> html=do_QueryInterface(doc);
	  nsString docurl;
	  html->GetURL(docurl);
	  
	  nsCString url;
	  dUtil->GetLinkStr(node,0,url);
	 
	std::string urlStr(url.get());
	std::string docurlStr(NS_ConvertUTF16toUTF8(docurl).get());
	LOG<<"url:"<<urlStr<<"\n";
	LOG<<"docurl:"<<docurlStr<<"\n";
	  double tmp=ld.LD(urlStr,docurlStr);
	  LOG<<"START Value:"<<tmp<<"\n";
	  double attValue;
	  vec->GetValueByDim(0,&attValue);
	  tmp+=attValue;

	  LOG<<i<<"Second value:"<<tmp<<" Plus:"<<attValue<<"\n";
	  if(attValue==0)
	       continue;
	  vec->GetValueByDim(1,&attValue);
	  tmp-=log(attValue)/log(2);

	  LOG<<i<<"Third value:"<<tmp<<" SUB:"<<attValue<<"\n";
	  LOG<<i<<" minValue:"<<minValue<<"\n";
	  if(minValue>tmp)
	  {
	       classids.clear();
	       minValue=tmp;
	       classids.push_back(i);
	  }else if(fabs(minValue-tmp)<0.1)
	  {
	       classids.push_back(i);
	  }
	  
     }
     
     LOG<<"classid size:"<<classids.size()<<":"<<minValue<<"\n";
     if(!classids.empty())
     {
	  int MaxCount=INT_MIN;
	  int classid;
	  for(std::list<int>::iterator it=classids.begin();it!=classids.end();++it)
	  {
	       nsCOMPtr<nsIAttSet> cset(nsnull);
	       m_model->GetClassSet(*it, getter_AddRefs(cset));
	       PRInt32 tmplen=0;
	       cset->GetLength(&tmplen);
	       if(tmplen>MaxCount)
	       {
		    MaxCount=tmplen;
		    classid=*it;
	       }
	  }
	  LOG<<"classid"<<classid<<"\n";
	  nsCOMPtr<nsIAttSet> cset(nsnull);
	  m_model->GetClassSet(classid, getter_AddRefs(cset));
	  PRInt32 vlen=0;
	  cset->GetLength(&vlen);
	  int chose=-1;
	  double minatt=INT_MAX;
	  
	  string attnames=m_parm["PATH_ATTS"];
	  LOG<<"--------------------names:"<<attnames<<"\n";
	  std::vector<std::string> nameVec;
	  if(attnames.length()>0)
	       split(attnames, ";",nameVec);
	  
	  std::set<std::string> xpaths;
	  for(int i=0;i<vlen;i++)
	  {
	       nsCOMPtr<nsIAttVec> vec(nsnull);
	       cset->GetVectorByIndex(i, getter_AddRefs(vec));
	       nsresult rv;
	       nsCOMPtr<nsIXpathUtil> xpathUtil=do_CreateInstance("@nyapc.com/XPCOM/nsXpathUtil;1",&rv);
	       if (NS_FAILED(rv))
	       {
		    continue;
	       }
	       for( std::vector<std::string>::iterator it=nameVec.begin();it!=nameVec.end();++it)
	       {
		    LOG<<"-----------------"<<*it<<"\n";
		    xpathUtil->AddAttName(nsCString(it->c_str()));
	       }
	       nsCOMPtr<nsIDOMDocument> doc;
	       nsCOMPtr<nsIDOMNode> node;
	       vec->GetDoc(getter_AddRefs(doc));
	       vec->GetNode(getter_AddRefs(node));
	       xpathUtil->SetDocument(doc);
	       nsCString xpath;
	       xpathUtil->GetXpath(node, 1,xpath);
	       xpaths.insert(std::string(xpath.get()));
	  }
	  std::string name("box");
	  std::string value;
	  for(std::set<std::string>::iterator it=xpaths.begin();it!=xpaths.end();++it)
	  {
	       value+=*it;
	       std::set<std::string>::iterator tit=it;
	       ++tit;
	       if(tit!=xpaths.end())
		    value+="|";
	  }
		    
	  m_vars.insert(make_pair(name,value));
     }
     return NS_OK;
}
예제 #13
0
void URLNavigator::setURL(const KURL& url)
{
    QString urlStr(url.prettyURL());

    if (url.protocol() == "zip") {
       bool stillInside = false;
       if (KMimeType::findByPath(url.url(-1))
           ->is("application/x-zip")) {
           stillInside = true;
       }
       else {
           KURL url1 = url.upURL();
           while (url1 != url1.upURL()) {
               if (KMimeType::findByPath(url1.url(-1))
                   ->is("application/x-zip")) {
                   stillInside = true;
                   break;
               }
               url1 = url1.upURL();
           }
       }
       if (!stillInside)
       {
           // Drop the zip:/ protocol since we are not in the zip anymore
           urlStr = url.path();
       }
    }
    else if (url.protocol() == "tar")
    {
       bool stillInside = false;
       KMimeType::Ptr kmp = 
           KMimeType::findByPath(url.url(-1));
       if (kmp->is("application/x-tar") ||
           kmp->is("application/x-tarz") ||
           kmp->is("application/x-tbz") || 
           kmp->is("application/x-tgz") || 
           kmp->is("application/x-tzo")
           ) {
           stillInside = true;
       }
       else {
           KURL url1 = url.upURL();
           while (url1 != url1.upURL()) {
               KMimeType::Ptr kmp =
                   KMimeType::findByPath(url1.url(-1));
               if (kmp->is("application/x-tar") ||
                   kmp->is("application/x-tarz") ||
                   kmp->is("application/x-tbz") || 
                   kmp->is("application/x-tgz") || 
                   kmp->is("application/x-tzo")
                   ) {
                   stillInside = true;
                   break;
               }
               url1 = url1.upURL();
           }
       }
       if (!stillInside)
       {
           // Drop the tar:/ protocol since we are not in the tar anymore
           urlStr = url.path();
       }
    }


    if (urlStr.at(0) == '~') {
        // replace '~' by the home directory
        urlStr.remove(0, 1);
        urlStr.insert(0, QDir::home().path());
    }

    const KURL transformedURL(urlStr);

    if (m_historyIndex > 0) {
        // Check whether the previous element of the history has the same URL.
        // If yes, just go forward instead of inserting a duplicate history
        // element.
        const KURL& nextURL = m_history[m_historyIndex - 1].url();
        if (transformedURL == nextURL) {
            goForward();
            return;
        }
    }

    const KURL& currURL = m_history[m_historyIndex].url();
    if (currURL == transformedURL) {
        // don't insert duplicate history elements
        return;
    }

    updateHistoryElem();

    const QValueListIterator<URLNavigator::HistoryElem> it = m_history.at(m_historyIndex);
    m_history.insert(it, HistoryElem(transformedURL));
    updateContent();
    emit urlChanged(transformedURL);
    emit historyChanged();

    // Prevent an endless growing of the history: remembering
    // the last 100 URLs should be enough...
    if (m_historyIndex > 100) {
        m_history.erase(m_history.begin());
        --m_historyIndex;
    }
}
예제 #14
0
Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Element* element, const KURL& url, const Vector<String>& paramNames,
                                          const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
//     qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType;
//     qDebug()<<"------\t url = "<<url.prettyURL();

    if (!m_webFrame)
        return 0;

    QStringList params;
    QStringList values;
    QString classid(element->getAttribute("classid"));

    for (int i = 0; i < paramNames.size(); ++i) {
        params.append(paramNames[i]);
        if (paramNames[i] == "classid")
            classid = paramValues[i];
    }
    for (int i = 0; i < paramValues.size(); ++i)
        values.append(paramValues[i]);

    QString urlStr(url.string());
    QUrl qurl = urlStr;

    QObject* object = 0;

    if (mimeType == "application/x-qt-plugin" || mimeType == "application/x-qt-styled-widget") {
        object = m_webFrame->page()->createPlugin(classid, qurl, params, values);
#ifndef QT_NO_STYLE_STYLESHEET
        QWidget* widget = qobject_cast<QWidget*>(object);
        if (widget && mimeType == "application/x-qt-styled-widget") {

            QString styleSheet = element->getAttribute("style");
            if (!styleSheet.isEmpty())
                styleSheet += QLatin1Char(';');

            for (int i = 0; i < numqStyleSheetProperties; ++i) {
                CSSPropertyID property = qstyleSheetProperties[i];

                styleSheet += QString::fromLatin1(::getPropertyName(property));
                styleSheet += QLatin1Char(':');
                styleSheet += computedStyle(element)->getPropertyValue(property);
                styleSheet += QLatin1Char(';');
            }

            widget->setStyleSheet(styleSheet);
        }
#endif // QT_NO_STYLE_STYLESHEET
    }

#if QT_VERSION >= 0x040400
        if (!object) {
            QWebPluginFactory* factory = m_webFrame->page()->pluginFactory();
            if (factory)
                object = factory->create(mimeType, qurl, params, values);
        }
#endif

        if (object) {
            QWidget* widget = qobject_cast<QWidget*>(object);
            if (widget) {
                QWidget* view = m_webFrame->page()->view();
                if (view)
                    widget->setParent(view);
                QtPluginWidget* w = new QtPluginWidget();
                w->setPlatformWidget(widget);
                // Make sure it's invisible until properly placed into the layout
                w->setFrameRect(IntRect(0, 0, 0, 0));
                return w;
            }
            // FIXME: make things work for widgetless plugins as well
            delete object;
    } else { // NPAPI Plugins
        PluginView* pluginView = PluginView::create(m_frame, pluginSize, element, url,
            paramNames, paramValues, mimeType, loadManually);
        return pluginView;
    }

    return 0;
}
/// <summary>
/// Encodes an url (or string) to make it comply to RFC2396 by replacing
/// illegal characters
/// Some device descriptions may include a "+" that needs to be replaced (e.g. GeForce 9800 GTX+/PCI/SSE2)
/// </summary>
/// <param name="url">Url (or string) to be encoded</param>
/// <returns></returns>
string VulkanDatabase::encodeUrl(string url)
{
    QString urlStr(QString::fromStdString(url));
    urlStr.replace("+", "%2B");
    return urlStr.toStdString();
}