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


C++ CefString类代码示例

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


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

示例1: OnPrintJob

bool ClientPrintHandlerGtk::OnPrintJob(
    const CefString& document_name,
    const CefString& pdf_file_path,
    CefRefPtr<CefPrintJobCallback> callback) {
  // If |printer_| is NULL then somehow the GTK printer list changed out under
  // us. In which case, just bail out.
  if (!printer_)
    return false;

  job_callback_ = callback;

  // Save the settings for next time.
  GetLastUsedSettings()->SetLastUsedSettings(gtk_settings_);

  GtkPrintJob* print_job = gtk_print_job_new(
      document_name.ToString().c_str(),
      printer_,
      gtk_settings_,
      page_setup_);
  gtk_print_job_set_source_file(print_job,
                                pdf_file_path.ToString().c_str(),
                                NULL);
  gtk_print_job_send(print_job, OnJobCompletedThunk, this, NULL);

  return true;
}
开发者ID:kaviththiranga,项目名称:developer-studio-cef-client,代码行数:26,代码来源:print_handler_gtk.cpp

示例2: cef_string_list_size

FWebBrowserPopupFeatures::FWebBrowserPopupFeatures( const CefPopupFeatures& PopupFeatures )
{
	X = PopupFeatures.x;
	bXSet = PopupFeatures.xSet ? true : false;
	Y = PopupFeatures.y;
	bYSet = PopupFeatures.ySet ? true : false;
	Width = PopupFeatures.width;
	bWidthSet = PopupFeatures.widthSet ? true : false;
	Height = PopupFeatures.height;
	bHeightSet = PopupFeatures.heightSet ? true : false;
	bMenuBarVisible = PopupFeatures.menuBarVisible ? true : false;
	bStatusBarVisible = PopupFeatures.statusBarVisible ? true : false;
	bToolBarVisible = PopupFeatures.toolBarVisible ? true : false;
	bLocationBarVisible = PopupFeatures.locationBarVisible ? true : false;
	bScrollbarsVisible = PopupFeatures.scrollbarsVisible ? true : false;
	bResizable = PopupFeatures.resizable ? true : false;
	bIsFullscreen = PopupFeatures.fullscreen ? true : false;
	bIsDialog = PopupFeatures.dialog ? true : false;

	int Count = PopupFeatures.additionalFeatures ? cef_string_list_size(PopupFeatures.additionalFeatures) : 0;
	CefString ListValue;

	for(int ListIdx = 0; ListIdx < Count; ListIdx++) 
	{
		cef_string_list_value(PopupFeatures.additionalFeatures, ListIdx, ListValue.GetWritableStruct());
		AdditionalFeatures.Add(ListValue.ToWString().c_str());
	}

}
开发者ID:colwalder,项目名称:unrealengine,代码行数:29,代码来源:WebBrowserPopupFeatures.cpp

示例3: GetBrowser

QUrl QCefWebView::url() const {
    if (GetBrowser().get()) {
        CefString url = GetBrowser()->GetMainFrame()->GetURL();
        return QUrl(QString::fromStdWString(url.ToWString()));
    }
    return QUrl();
}
开发者ID:Ali-I,项目名称:CsoundQt,代码行数:7,代码来源:qcefwebview.cpp

示例4: AppGetCommandLine

// Inject webinos.js
// The file is loaded from the webinos\test\client folder if possible.
// If this fails, the current folder is used.
void ClientApp::InjectWebinos(CefRefPtr<CefFrame> frame)
{
  CefRefPtr<CefCommandLine> commandLine = AppGetCommandLine();

  // First try and load the platform-supplied webinos.js
  std::string pzpPath = AppGetWebinosWRTConfig(NULL,NULL);
  CefString wrtPath;

  // Make sure there is a trailing separator on the path.
  if (pzpPath.length() > 0) 
  {
    if (pzpPath.find_last_of('/') == pzpPath.length()-1 || pzpPath.find_last_of('\\') == pzpPath.length()-1)
      wrtPath = pzpPath + "wrt/webinos.js";
    else
      wrtPath = pzpPath + "/wrt/webinos.js";
  }

#if defined(OS_WIN)
  base::FilePath webinosJSPath(wrtPath.ToWString().c_str());
#else
  base::FilePath webinosJSPath(wrtPath);
#endif

  LOG(INFO) << "webinos.js path is " << wrtPath;

  int64 webinosJSCodeSize;
  bool gotJSFile = base::GetFileSize(webinosJSPath, &webinosJSCodeSize);
  if (gotJSFile)
  {
    char* webinosJSCode = new char[webinosJSCodeSize+1];
    base::ReadFile(webinosJSPath, webinosJSCode, webinosJSCodeSize);
    webinosJSCode[webinosJSCodeSize] = 0;

    if (frame == NULL)
    {
      // Register as a Cef extension.
      CefRegisterExtension("webinos", webinosJSCode, NULL);
    }
    else
    {
      // Run the code in the frame javascript context right now,
      // but only if the URL refers to the widget server.
      int widgetServerPort;
      AppGetWebinosWRTConfig(NULL,&widgetServerPort);

      char injectionCandidate[MAX_URL_LENGTH];
      sprintf(injectionCandidate,"http://localhost:%d",widgetServerPort);

      std::string url = frame->GetURL();
      if (url.substr(0,strlen(injectionCandidate)) == injectionCandidate)
        frame->ExecuteJavaScript(webinosJSCode, url, 0);
    }

    delete[] webinosJSCode;
  }
  else
  {
    	LOG(ERROR) << "Can't find webinos.js";
  }
}
开发者ID:ubiapps,项目名称:ubiapps-browser,代码行数:63,代码来源:client_app.cpp

示例5: navigateToUrl

void QCefView::navigateToUrl(const QString& url)
{
	if (cefWindow_)
	{
		CefString strUrl;
		strUrl.FromString(url.toStdString());
		cefWindow_->cefViewHandler()->GetBrowser()->GetMainFrame()->LoadURL(strUrl);
	}
}
开发者ID:Kuraisu,项目名称:QCefView,代码行数:9,代码来源:QCefView.cpp

示例6: value

JNIEXPORT jstring JNICALL Java_org_limewire_cef_CefV8Value_1N_N_1GetStringValue
  (JNIEnv *env, jobject obj)
{
	CefRefPtr<CefV8Value> value(
		(CefV8Value*)GetCefBaseFromJNIObject(env, obj));
	if(!value.get())
		return NULL;

	CefString str = value->GetStringValue();
	return env->NewString((const jchar*)str.c_str(), str.length());
}
开发者ID:guolianwei,项目名称:cefjavawrapper,代码行数:11,代码来源:CefV8Value_N.cpp

示例7: ExecuteJavaScript

//================================================================================
// Ejecuta JavaScript
//================================================================================
void CefBasePanel::ExecuteJavaScript( const char *script )
{
    if ( !GetClient() )
        return;

    CefString code;
    code.FromASCII( script );

    CefString file;
    GetClient()->GetBrowser()->GetMainFrame()->ExecuteJavaScript( code, file, 0 );
}
开发者ID:WootsMX,项目名称:InSource,代码行数:14,代码来源:cef_basepanel.cpp

示例8: navigateToString

void QCefView::navigateToString(const QString& content, const QString& url)
{
	if (cefWindow_)
	{
		CefString strContent;
		strContent.FromString(content.toStdString());
		CefString strUrl;
		strUrl.FromString(url.toStdString());
		cefWindow_->cefViewHandler()->GetBrowser()->GetMainFrame()->LoadString(strContent, strUrl);
	}
}
开发者ID:Kuraisu,项目名称:QCefView,代码行数:11,代码来源:QCefView.cpp

示例9: OpenURL

//================================================================================
// Abre la dirección web
//================================================================================
void CefBasePanel::OpenURL( const char *address )
{
    if ( !GetClient() )
        return;

    CefString str;
    str.FromASCII( address );

    GetClient()->GetBrowser()->GetMainFrame()->LoadURL( str );
    ResizeView();

    DevMsg( "CefBasePanel::OpenURL: %s \n", address );
}
开发者ID:WootsMX,项目名称:InSource,代码行数:16,代码来源:cef_basepanel.cpp

示例10: GetIcon

HICON TransparentWnd::GetIcon(CefString path){
	if(path.ToWString().find(L":")==-1){
		wstring _path;
		_path=url.ToWString();
		replace_allW(_path, L"\\", L"/");
		_path=_path.substr(0,_path.find_last_of('/')+1);
		path=_path.append(path);
	}
	return (HICON)::LoadImage(NULL,path.ToWString().data(),IMAGE_ICON,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE); 
	//Bitmap bm(path.ToWString().data());
	//HICON hIcon;
	//bm.GetHICON(&hIcon);
	//return hIcon;
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:14,代码来源:transparent_wnd.cpp

示例11: Download

void TransparentWnd::Download(CefString url,CefString filename){
	std::stringstream ss;
	string s=url.ToString();
	ss<<"var img = new Image();"
		<<"img.src='"<<url.ToString();
	if(s.find("?")==string::npos){
		ss<<"?t='+Date.now()+'&AlloyDesktop_download=";
	}
	else{
		ss<<"&AlloyDesktop_download=";
	}
	ss<<filename.ToString()<<"';";
	this->ExecJS(ss.str());
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:14,代码来源:transparent_wnd.cpp

示例12: sendEVentNotifyMessage

bool QCefView::sendEVentNotifyMessage(int frameId, const QString& name, const QCefEvent& event)
{
	CefRefPtr<CefProcessMessage> msg = CefProcessMessage::Create(
		TRIGGEREVENT_NOTIFY_MESSAGE);
	CefRefPtr<CefListValue> arguments = msg->GetArgumentList();

	int idx = 0;
	arguments->SetInt(idx++, frameId);

	CefString eventName = name.toStdString();
	arguments->SetString(idx++, eventName);

	CefRefPtr<CefDictionaryValue> dict = CefDictionaryValue::Create();

	CefString cefStr;
	cefStr.FromWString(event.objectName().toStdWString());
	dict->SetString("name", cefStr);

	QList<QByteArray> keys = event.dynamicPropertyNames();
	for (QByteArray key : keys)
	{
		QVariant value = event.property(key.data());
		if (value.type() == QMetaType::Bool)
		{
			dict->SetBool(key.data(), value.toBool());
		}
		else if (value.type() == QMetaType::Int || value.type() == QMetaType::UInt)
		{
			dict->SetInt(key.data(), value.toInt());
		}
		else if (value.type() == QMetaType::Double)
		{
			dict->SetDouble(key.data(), value.toDouble());
		}
		else if (value.type() == QMetaType::QString)
		{
			cefStr.FromWString(value.toString().toStdWString());
			dict->SetString(key.data(), cefStr);
		}
		else
		{
			__noop(_T("QCefView"), _T("Unknow Type!"));
		}
	}

	arguments->SetDictionary(idx++, dict);

	return cefWindow_->cefViewHandler()->TriggerEvent(msg);
}
开发者ID:Kuraisu,项目名称:QCefView,代码行数:49,代码来源:QCefView.cpp

示例13: OpenLiveBrowser

int32 OpenLiveBrowser(ExtensionString argURL, bool enableRemoteDebugging)
{
    const char *remoteDebuggingFormat = "--no-first-run --no-default-browser-check --allow-file-access-from-files --temp-profile --user-data-dir=%s --remote-debugging-port=9222";
    gchar *remoteDebugging;
    gchar *cmdline;
    int error = ERR_BROWSER_NOT_INSTALLED;
    GError *gerror = NULL;
    
    if (enableRemoteDebugging) {
        CefString appSupportDirectory = ClientApp::AppGetSupportDirectory();

        // TODO: (INGO) to better understand to string conversion issue, I need a consultant
        // here. Getting the char* from CefString I had to call ToString().c_str()
        // Calling only c_str() didn't return anything.
        gchar *userDataDir = g_strdup_printf("%s/live-dev-profile",
                                        appSupportDirectory.ToString().c_str());  
        g_message("USERDATADIR= %s", userDataDir);
        remoteDebugging = g_strdup_printf(remoteDebuggingFormat, userDataDir);
        
        g_free(userDataDir);
    } else {
        remoteDebugging = g_strdup("");
    }

    // check for supported browsers (in PATH directories)
    for (size_t i = 0; i < sizeof(browsers) / sizeof(browsers[0]); i++) {
        cmdline = g_strdup_printf("%s %s %s", browsers[i].c_str(), argURL.c_str(), remoteDebugging);

        if (g_spawn_command_line_async(cmdline, &gerror)) {
            // browser is found in os; stop iterating
            error = NO_ERROR;
        } else {
            error = ConvertGnomeErrorCode(gerror);
        }

        g_free(cmdline);
        
        if (error == NO_ERROR) {
            break;
        } else {
            g_error_free(gerror);
            gerror = NULL;
        }
    }
    
    g_free(remoteDebugging);

    return error;
}
开发者ID:ChaosDeSelva,项目名称:brackets-shell,代码行数:49,代码来源:appshell_extensions_gtk.cpp

示例14: OnJSDialog

bool CaffeineClientHandler::OnJSDialog(
    CefRefPtr<CefBrowser> browser,
    const CefString& origin_url,
    const CefString& accept_lang,
    JSDialogType dialog_type,
    const CefString& message_text,
    const CefString& default_prompt_text,
    CefRefPtr<CefJSDialogCallback> callback,
    bool& suppress_message)
{
    if (dialog_type == JSDIALOGTYPE_ALERT)
    {
#ifdef OS_WIN
        //  TODO:  Look up from the string table.
        MessageBox(m_MainHwnd, message_text.c_str(), FULL_PRODUCT, MB_OK);
#else
        wstring msg = message_text;
        alertMessage(msg);
#endif

        callback->Continue(true, message_text);
        return true;
    }


    return false;
}
开发者ID:sfrancisx,项目名称:Caffeine,代码行数:27,代码来源:CaffeineClientHandler.cpp

示例15: OpenFileDialog

CefString TransparentWnd::GetOpenName(CefString fileName){
	TCHAR szFile[4096];
	OpenFileDialog(hWnd, fileName.ToWString().data(), szFile);
	wstring d(szFile);
	CefString s(d);
	return s;
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:7,代码来源:transparent_wnd.cpp


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