本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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());
}
}
示例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);
}
示例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());
}
}
示例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());
}
示例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);
}
示例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中进程就是一个线程的容器,每个进程至少有一个线程在执行
}
}
示例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;
}