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


C++ CefString::ToString方法代码示例

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


在下文中一共展示了CefString::ToString方法的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:CRDNicolasBourbaki,项目名称:chromiumembedded,代码行数:26,代码来源:print_handler_gtk.cpp

示例2: OnQuery

// Called due to cefQuery execution in binding.html.
bool QueryHandler::OnQuery(CefRefPtr<CefBrowser> browser,
                           CefRefPtr<CefFrame> frame,
                           int64 query_id,
                           const CefString& request,
                           bool persistent,
                           CefRefPtr<Callback> callback) {
  try {
    auto query = createQuery(browser, frame, request.ToString());

    if (!query)
      return false;

    CefPostTask(TID_FILE, base::Bind(&Query::execute, query, callback));
  } catch (std::exception& e) {
    auto logger = lootState_.getLogger();
    if (logger) {
      logger->error("Failed to parse CEF query request \"{}\": {}",
        request.ToString(),
        e.what());
    }
    callback->Failure(-1, e.what());
  }

  return true;
}
开发者ID:loot,项目名称:loot,代码行数:26,代码来源:query_handler.cpp

示例3: 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

示例4: GetMainURL

CefString CefControlBase::GetMainURL(const CefString& url)
{
	std::string temp = url.ToString();
	int end_pos = temp.find("#") == std::string::npos ? temp.length() : temp.find("#");
	temp = temp.substr(0, end_pos);
	return CefString(temp.c_str());
}
开发者ID:arlen7772gg,项目名称:NIM_Duilib_Framework,代码行数:7,代码来源:cef_control_base_ui.cpp

示例5: decrypt

CefString CaffeineClientApp::decrypt(const CefString &blob)
{
    string ConvertedData = blob.ToString();
    string retval;

    BYTE B64DecodeBuf[B64_BUFFER_LEN] = {0,};
    int B64DecodeBufLen = B64_BUFFER_LEN;

    if (Base64Decode(ConvertedData.data(), ConvertedData.length(), B64DecodeBuf, &B64DecodeBufLen))
    {
        DATA_BLOB DataIn = {0,};
        DATA_BLOB DataOut = {0,};

        DataIn.pbData = B64DecodeBuf;
        DataIn.cbData = B64DecodeBufLen;

        if(CryptUnprotectData(&DataIn, NULL, NULL, NULL, NULL, 0, &DataOut))
        {
            retval = string(reinterpret_cast<char *>(DataOut.pbData), static_cast<size_t>(DataOut.cbData));
            LocalFree(DataOut.pbData);
        }
    }

    return retval;
}
开发者ID:sfrancisx,项目名称:Caffeine,代码行数:25,代码来源:CaffeineClientAppWin.cpp

示例6: encrypt

//  TODO:  Dynamically size the base64 buffers
string CaffeineClientApp::encrypt(const CefString &plaintext)
{
    DATA_BLOB DataIn = {0,};
    DATA_BLOB DataOut = {0,};
    string ConvertedData = plaintext.ToString();
    string retval;
    
    DataIn.pbData = reinterpret_cast<BYTE *>(const_cast<char *>(ConvertedData.data()));
    DataIn.cbData = ConvertedData.length();

    string temp;

    if(CryptProtectData(&DataIn, TEXT("Login Token"), NULL, NULL, NULL, 0, &DataOut))
    {
        char B64Buf[B64_BUFFER_LEN] = {0,};
        int B64BufLen = B64_BUFFER_LEN;

        if (Base64Encode(DataOut.pbData, DataOut.cbData, B64Buf, &B64BufLen, ATL_BASE64_FLAG_NOCRLF))
        {
            retval = string(B64Buf);
        }

        LocalFree(DataOut.pbData);
    }

    return retval;
}
开发者ID:sfrancisx,项目名称:Caffeine,代码行数:28,代码来源:CaffeineClientAppWin.cpp

示例7: OnBeforeDownload

void CWebBrowserDownloadHandler::OnBeforeDownload(CefRefPtr<CefBrowser> browser, CefRefPtr<CefDownloadItem> download_item,
                                                  const CefString& suggested_name, CefRefPtr<CefBeforeDownloadCallback> callback)
{
  std::string suggestedName = suggested_name.ToString();
  std::string url = download_item->GetOriginalUrl().ToString();
  int64 totalBytes = download_item->GetTotalBytes();
  std::thread(OnBeforeDownloadProcess, this, url, totalBytes, suggestedName, callback).detach();
}
开发者ID:AlwinEsch,项目名称:web.browser.chromium,代码行数:8,代码来源:DialogDownload.cpp

示例8: OnJSDialog

bool ClientHandler::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)
{
	RLOG(message_text.ToString().c_str());
	return false;
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:8,代码来源:ClientHandler.cpp

示例9: OnTitleChange

void BrowserClient::OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title)
{
    osgViewer::Viewer::Windows ViewerWindow; 
    _viewer->getWindows(ViewerWindow); 

    if (!ViewerWindow.empty()) 
    { 
        ViewerWindow.front()->setWindowName(title.ToString()); 
    }
}
开发者ID:pelicanmapping,项目名称:osgearth-cef,代码行数:10,代码来源:BrowserClient.cpp

示例10: CreateBrowserWindowBase

void TransparentWnd::CreateBrowserWindowBase(CefString path, UINT ex_style, bool isTransparent){
	TCHAR   szPath[1000];   
	GetModuleFileName(NULL,szPath,MAX_PATH);
	wstring _path(szPath);
	_path=_path.substr(0,_path.find_last_of('\\')+1);
	replace_allW(_path, L"\\", L"/");
	CefString pathC(_path);
	std::stringstream ss;
	ss<<pathC.ToString().c_str()<<path.ToString().c_str();
	CefString s(ss.str());
	CreateBrowserWindow(s, ex_style, isTransparent);
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:12,代码来源:transparent_wnd.cpp

示例11: OnAddressChange

	void IBrowserHandler::OnAddressChange(	CefRefPtr<CefBrowser>	browser, 
											CefRefPtr<CefFrame>		frame, 
											const CefString			&url)
	{
		REQUIRE_UI_THREAD();

		if(m_browserId == browser->GetIdentifier() && frame->IsMain())
		{
			// ::SetWindowText(m_editHwnd, std::wstring(url).c_str());
			SignalsSlots::GetCurrentSignals()->SetCurrentTittle(url.ToString());
		}
	}
开发者ID:Raykk,项目名称:IBrowser,代码行数:12,代码来源:ibrowserhandler.cpp

示例12: OnTitleChange

	void IBrowserHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
									  const CefString& title) 
	{
		REQUIRE_UI_THREAD();

		CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
		if(m_browserId == browser->GetIdentifier())
		{
			hwnd = ::GetParent(::GetParent(hwnd));
		}
		// ::SetWindowText(hwnd, std::wstring(title).c_str());
		SignalsSlots::GetCurrentSignals()->SetCurrentTittle(title.ToString());
	}
开发者ID:Raykk,项目名称:IBrowser,代码行数:13,代码来源:ibrowserhandler.cpp

示例13: replaceRequest

void TransparentWnd::replaceRequest(CefString request, LPVOID pParam){
	EnterCriticalSection(&cs);
	MelodyProxy::ProxyParam* pProxyParam=(MelodyProxy::ProxyParam*)pParam;
	if(IsBadReadPtr(pProxyParam,sizeof(MelodyProxy::ProxyParam))){
		LeaveCriticalSection(&cs);
		return;
	}
	pProxyParam->isReplaceRequest=true;
	strcpy(pProxyParam->Request,request.ToString().c_str());
	::PulseEvent(pProxyParam->ResponseOK);
	::WaitForSingleObject(pProxyParam->ResponseEnd,3000);
	LeaveCriticalSection(&cs);
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:13,代码来源:transparent_wnd.cpp

示例14: CreateBrowser

void TransparentWnd::CreateBrowser(CefString url, CefString param){
	HANDLE m_hRead;
	HANDLE m_hWrite;
	SECURITY_ATTRIBUTES sa;   // 父进程传递给子进程的一些信息
	sa.bInheritHandle = TRUE; // 还记得我上面的提醒吧,这个来允许子进程继承父进程的管道句柄
	sa.lpSecurityDescriptor = NULL;
	sa.nLength = sizeof(SECURITY_ATTRIBUTES);
	if (!CreatePipe(&m_hRead, &m_hWrite, &sa, 0))
	{
		return;
	}

	STARTUPINFO sui;    
	PROCESS_INFORMATION pi; // 保存了所创建子进程的信息
	ZeroMemory(&sui, sizeof(STARTUPINFO)); // 对一个内存区清零,最好用ZeroMemory, 它的速度要快于memset
	sui.cb = sizeof(STARTUPINFO);
	sui.dwFlags = STARTF_USESTDHANDLES;

	sui.hStdInput = m_hRead;
	sui.hStdOutput = m_hWrite;
	/* 以上两行也许大家要有些疑问,为什么把管道读句柄(m_hRead)赋值给了hStdInput, 因为管道是双向的,对于父进程写的一端正好是子进程读的一端,而m_hRead就是父进程中对管道读的一端, 自然要把这个句柄给子进程让它来写数据了(sui是父进程传给子进程的数据结构,里面包含了一些父进程要告诉子进程的一些信息),反之一样*/
	sui.hStdError = GetStdHandle(STD_ERROR_HANDLE);
	TCHAR   szPath[1000];   
	GetModuleFileName(NULL,szPath,MAX_PATH);
	DWORD d;
	if(::WriteFile(m_hWrite,param.ToString().c_str(),strlen(param.ToString().c_str()),&d,NULL)==FALSE){
		MessageBox(NULL,L"写入失败",L"错误",0);
	}
	if (!CreateProcess(szPath, (LPWSTR)url.ToWString().c_str(), NULL, NULL, TRUE, 0, NULL, NULL, &sui, &pi))
	{
		CloseHandle(m_hRead);
		CloseHandle(m_hWrite);
	}
	else
	{
		CloseHandle(pi.hProcess); // 子进程的进程句柄
		CloseHandle(pi.hThread); // 子进程的线程句柄,windows中进程就是一个线程的容器,每个进程至少有一个线程在执行
	}
}
开发者ID:guodayang,项目名称:MelodyDebug,代码行数:39,代码来源:transparent_wnd.cpp

示例15: Connect

bool CSJsSocket::Connect(const CefString &hostname, int port)
{
    int s = socket(AF_INET, SOCK_STREAM, 0);
    struct hostent *he;
    struct sockaddr_in saddr = {0};
    
    saddr.sin_addr.s_addr = inet_addr(hostname.ToString().c_str());
    if (saddr.sin_addr.s_addr == INADDR_NONE)
    {
        he = gethostbyname(hostname.ToString().c_str());
        if (he)
            memcpy(&saddr.sin_addr.s_addr, he->h_addr_list[0], he->h_length);
    }
    
    saddr.sin_port = htons(port);
	saddr.sin_family = AF_INET;
    
    if (connect(s, (struct sockaddr *)&saddr, sizeof(saddr)) == 0)
    {
        mSocket = s;
        
        if (mOpenCallback)
        {
            CefV8ValueList args;
            CefRefPtr<CefV8Value> retval;
            CefRefPtr<CefV8Exception> exception;     
            
            mOpenCallback->ExecuteFunctionWithContext(mOpenContext, NULL, args, retval, exception, false);                        
        }
        
        event_set(&mEventRead, mSocket, EV_READ|EV_PERSIST, &CSJsSocket::OnReadStatic, this);
        event_add(&mEventRead, NULL);        
        
        return true;
    }
    
    return false;    
}
开发者ID:cleanslate,项目名称:CleanSlate,代码行数:38,代码来源:CSJsSocket.cpp


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