Project

General

Profile

SO3Engine
SO3EmbeddedWebNavigatorThread.cpp
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2011 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21-----------------------------------------------------------------------------
22*/
23
28#if SO3_WEB_NAVIGATOR_BUILD == 1
29
30namespace SO3
31{
32 namespace EmbeddedWebNavigator
33 {
34
35 void WebNavigatorThread::LoadURL(unsigned long webNavigatorId, const std::string url, const std::string frameName)
36 {
37 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
38 if (webNavigator != 0)
39 {
40 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
41 if (cefBrowser.get())
42 {
43 CefRefPtr<CefFrame> cefFrame;
44 if (frameName == "")
45 cefFrame = cefBrowser->GetMainFrame();
46 else
47 cefFrame = cefBrowser->GetFrame(frameName);
48
49 CefString csurl;
50 std::string surl = url;
51
52#if SCOL_PLATFORM == SCOL_PLATFORM_WINDOWS
53 //Convert ANSI to UTF8
54 int length = MultiByteToWideChar(CP_ACP, 0, url.c_str(), -1, NULL, 0);
55 wchar_t* wstr = new wchar_t[length];
56 MultiByteToWideChar(CP_ACP, 0, url.c_str(), -1, wstr, length);
57
58 int wchar_count = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
59 char* cstr = new char[wchar_count];
60 WideCharToMultiByte(CP_UTF8, 0, wstr, -1, cstr, wchar_count, NULL, NULL);
61 delete[] wstr;
62
63 surl = std::string(cstr);
64 delete[] cstr;
65#endif
66
67 csurl.FromString(surl);
68
69 if (cefFrame.get())
70 cefFrame->LoadURL(csurl);
71 }
72 }
73 }
74
75 void WebNavigatorThread::LoadFile(unsigned long webNavigatorId, const std::string file, const std::string frameName)
76 {
77 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
78 if (webNavigator != 0)
79 {
80 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
81 if (cefBrowser.get())
82 {
83 CefRefPtr<CefFrame> cefFrame;
84 if (frameName == "")
85 cefFrame = cefBrowser->GetMainFrame();
86 else
87 cefFrame = cefBrowser->GetFrame(frameName);
88
89 CefString csurl;
90 std::string surl = file;
91
92#if SCOL_PLATFORM == SCOL_PLATFORM_WINDOWS
93 //Convert ANSI to UTF8
94 int length = MultiByteToWideChar(CP_ACP, 0, file.c_str(), -1, NULL, 0);
95 wchar_t* wstr = new wchar_t[length];
96 MultiByteToWideChar(CP_ACP, 0, file.c_str(), -1, wstr, length);
97
98 int wchar_count = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
99 char* cstr = new char[wchar_count];
100 WideCharToMultiByte(CP_UTF8, 0, wstr, -1, cstr, wchar_count, NULL, NULL);
101 delete[] wstr;
102
103 surl = std::string(cstr);
104 delete[] cstr;
105#endif
106
107 csurl.FromString("file:///" + surl);
108
109 if (cefFrame.get())
110 cefFrame->LoadURL(csurl);
111 }
112 }
113 }
114
115 void WebNavigatorThread::LoadHTML(unsigned long webNavigatorId, const std::string html, const std::string frameName)
116 {
117 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
118 if (webNavigator != 0)
119 {
120 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
121 if (cefBrowser.get())
122 {
123 CefRefPtr<CefFrame> cefFrame;
124 if (frameName == "")
125 cefFrame = cefBrowser->GetMainFrame();
126 else
127 cefFrame = cefBrowser->GetFrame(frameName);
128
129 if (cefFrame.get())
130 cefFrame->LoadString(html, "_current");
131 }
132 }
133 }
134
135 void WebNavigatorThread::CanGoBack(unsigned long webNavigatorId, bool* canGoBack, HANDLE synchro)
136 {
137 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
138 if (webNavigator != 0)
139 {
140 (*canGoBack) = false;
141 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
142 if (cefBrowser.get())
143 (*canGoBack) = cefBrowser->CanGoBack();
144
145 // Indicate to scol thread that the action is finished.
146 SetEvent(synchro);
147 }
148 }
149
150 void WebNavigatorThread::GoBack(unsigned long webNavigatorId)
151 {
152 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
153 if (webNavigator != 0)
154 {
155 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
156 if (cefBrowser.get())
157 cefBrowser->GoBack();
158 }
159 }
160
161 void WebNavigatorThread::CanGoForward(unsigned long webNavigatorId, bool* canGoForward, HANDLE synchro)
162 {
163 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
164 if (webNavigator != 0)
165 {
166 (*canGoForward) = false;
167 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
168 if (cefBrowser.get())
169 (*canGoForward) = cefBrowser->CanGoForward();
170
171 // Indicate to scol thread that the action is finished.
172 SetEvent(synchro);
173 }
174 }
175
176 void WebNavigatorThread::GoForward(unsigned long webNavigatorId)
177 {
178 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
179 if (webNavigator != 0)
180 {
181 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
182 if (cefBrowser.get())
183 cefBrowser->GoForward();
184 }
185 }
186
187 void WebNavigatorThread::Reload(unsigned long webNavigatorId)
188 {
189 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
190 if (webNavigator != 0)
191 {
192 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
193 if (cefBrowser.get())
194 cefBrowser->Reload();
195 }
196 }
197
198 void WebNavigatorThread::ReloadIgnoreCache(unsigned long webNavigatorId)
199 {
200 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
201 if (webNavigator != 0)
202 {
203 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
204 if (cefBrowser.get())
205 cefBrowser->ReloadIgnoreCache();
206 }
207 }
208
209 void WebNavigatorThread::StopLoad(unsigned long webNavigatorId)
210 {
211 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
212 if (webNavigator != 0)
213 {
214 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
215 if (cefBrowser.get())
216 cefBrowser->StopLoad();
217 }
218 }
219
220 void WebNavigatorThread::Find(unsigned long webNavigatorId, int identifier, const CefString searchText, bool forward, bool matchCase, bool findNext)
221 {
222 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
223 if (webNavigator != 0)
224 {
225 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
226 if (cefBrowser.get())
227 cefBrowser->GetHost()->Find(identifier, searchText, forward, matchCase, findNext);
228 }
229 }
230
231 void WebNavigatorThread::StopFinding(unsigned long webNavigatorId, bool clearSelection)
232 {
233 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
234 if (webNavigator != 0)
235 {
236 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
237 if (cefBrowser.get())
238 cefBrowser->GetHost()->StopFinding(clearSelection);
239 }
240 }
241
242 void WebNavigatorThread::GetZoomLevel(unsigned long webNavigatorId, double* zoomFactor, HANDLE synchro)
243 {
244 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
245 if (webNavigator != 0)
246 {
247 (*zoomFactor) = 0.0;
248 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
249 if (cefBrowser.get())
250 (*zoomFactor) = cefBrowser->GetHost()->GetZoomLevel();
251
252 // Indicate to scol thread that the zoom factor is filled.
253 SetEvent(synchro);
254 }
255 }
256
257 void WebNavigatorThread::SetZoomLevel(unsigned long webNavigatorId, double zoomLevel)
258 {
259 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
260 if (webNavigator != 0)
261 {
262 //clamp the zoom level to max value
263 zoomLevel = (std::min)(4.0, (std::max)(-4.0, zoomLevel));
264
265 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
266 if (cefBrowser.get())
267 cefBrowser->GetHost()->SetZoomLevel(zoomLevel);
268 }
269 }
270
271 void WebNavigatorThread::ClearHistory(unsigned long webNavigatorId)
272 {
273 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
274 if (webNavigator != 0)
275 {
276 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
277 //if (cefBrowser.get())
278 //cefBrowser->GetHost()->ClearHistory();
279 }
280 }
281
282 void WebNavigatorThread::ShowDevTools(unsigned long webNavigatorId)
283 {
284 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
285 if (webNavigator != 0)
286 {
287 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
288 if (cefBrowser.get())
289 {
290 CefWindowInfo windowInfo;
291 CefBrowserSettings settings;
292
293#if defined(_WIN32)
294 windowInfo.SetAsPopup(cefBrowser->GetHost()->GetWindowHandle(), "DevTools");
295#endif
296 cefBrowser->GetHost()->ShowDevTools(windowInfo, webNavigator->GetWebNavigatorClient(), settings, CefPoint());
297 }
298 }
299 }
300
301 void WebNavigatorThread::CloseDevTools(unsigned long webNavigatorId)
302 {
303 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
304 if (webNavigator != 0)
305 {
306 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
307 if (cefBrowser.get())
308 cefBrowser->GetHost()->CloseDevTools();
309 }
310 }
311
312 void WebNavigatorThread::GetURL(unsigned long webNavigatorId, std::string* frameUrl, HANDLE synchro, const std::string frameName)
313 {
314 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
315 if (webNavigator != 0)
316 {
317 frameUrl->clear();
318 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
319 if (cefBrowser.get())
320 {
321 CefRefPtr<CefFrame> cefFrame;
322 if (frameName == "")
323 cefFrame = cefBrowser->GetMainFrame();
324 else
325 cefFrame = cefBrowser->GetFrame(frameName);
326
327 if (cefFrame.get())
328 frameUrl->append(cefFrame->GetURL());
329 }
330
331 // Indicate to scol thread that the url string is filled.
332 SetEvent(synchro);
333 }
334 }
335
336 void WebNavigatorThread::Undo(unsigned long webNavigatorId, const std::string frameName)
337 {
338 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
339 if (webNavigator != 0)
340 {
341 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
342 if (cefBrowser.get())
343 {
344 CefRefPtr<CefFrame> cefFrame;
345 if (frameName == "")
346 cefFrame = cefBrowser->GetMainFrame();
347 else
348 cefFrame = cefBrowser->GetFrame(frameName);
349
350 if (cefFrame.get())
351 cefFrame->Undo();
352 }
353 }
354 }
355
356 void WebNavigatorThread::Redo(unsigned long webNavigatorId, const std::string frameName)
357 {
358 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
359 if (webNavigator != 0)
360 {
361 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
362 if (cefBrowser.get())
363 {
364 CefRefPtr<CefFrame> cefFrame;
365 if (frameName == "")
366 cefFrame = cefBrowser->GetMainFrame();
367 else
368 cefFrame = cefBrowser->GetFrame(frameName);
369
370 if (cefFrame.get())
371 cefFrame->Redo();
372 }
373 }
374 }
375
376 void WebNavigatorThread::Cut(unsigned long webNavigatorId, const std::string frameName)
377 {
378 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
379 if (webNavigator != 0)
380 {
381 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
382 if (cefBrowser.get())
383 {
384 CefRefPtr<CefFrame> cefFrame;
385 if (frameName == "")
386 cefFrame = cefBrowser->GetMainFrame();
387 else
388 cefFrame = cefBrowser->GetFrame(frameName);
389
390 if (cefFrame.get())
391 cefFrame->Cut();
392 }
393 }
394 }
395
396 void WebNavigatorThread::Copy(unsigned long webNavigatorId, const std::string frameName)
397 {
398 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
399 if (webNavigator != 0)
400 {
401 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
402 if (cefBrowser.get())
403 {
404 CefRefPtr<CefFrame> cefFrame;
405 if (frameName == "")
406 cefFrame = cefBrowser->GetMainFrame();
407 else
408 cefFrame = cefBrowser->GetFrame(frameName);
409
410 if (cefFrame.get())
411 cefFrame->Copy();
412 }
413 }
414 }
415
416 void WebNavigatorThread::Paste(unsigned long webNavigatorId, const std::string frameName)
417 {
418 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
419 if (webNavigator != 0)
420 {
421 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
422 if (cefBrowser.get())
423 {
424 CefRefPtr<CefFrame> cefFrame;
425 if (frameName == "")
426 cefFrame = cefBrowser->GetMainFrame();
427 else
428 cefFrame = cefBrowser->GetFrame(frameName);
429
430 if (cefFrame.get())
431 cefFrame->Paste();
432 }
433 }
434 }
435
436 void WebNavigatorThread::Delete(unsigned long webNavigatorId, const std::string frameName)
437 {
438 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
439 if (webNavigator != 0)
440 {
441 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
442 if (cefBrowser.get())
443 {
444 CefRefPtr<CefFrame> cefFrame;
445 if (frameName == "")
446 cefFrame = cefBrowser->GetMainFrame();
447 else
448 cefFrame = cefBrowser->GetFrame(frameName);
449
450 if (cefFrame.get())
451 cefFrame->Delete();
452 }
453 }
454 }
455
456 void WebNavigatorThread::SelectAll(unsigned long webNavigatorId, const std::string frameName)
457 {
458 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
459 if (webNavigator != 0)
460 {
461 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
462 if (cefBrowser.get())
463 {
464 CefRefPtr<CefFrame> cefFrame;
465 if (frameName == "")
466 cefFrame = cefBrowser->GetMainFrame();
467 else
468 cefFrame = cefBrowser->GetFrame(frameName);
469
470 if (cefFrame.get())
471 cefFrame->SelectAll();
472 }
473 }
474 }
475
476 void WebNavigatorThread::Print(unsigned long webNavigatorId, const std::string frameName)
477 {
478 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
479 if (webNavigator != 0)
480 {
481 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
482 if (cefBrowser.get())
483 cefBrowser->GetHost()->Print();
484 }
485 }
486
487 void WebNavigatorThread::ViewSource(unsigned long webNavigatorId, const std::string frameName)
488 {
489 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
490 if (webNavigator != 0)
491 {
492 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
493 if (cefBrowser.get())
494 {
495 CefRefPtr<CefFrame> cefFrame;
496 if (frameName == "")
497 cefFrame = cefBrowser->GetMainFrame();
498 else
499 cefFrame = cefBrowser->GetFrame(frameName);
500
501 if (cefFrame.get())
502 cefFrame->ViewSource();
503 }
504 }
505 }
506
507 void WebNavigatorThread::GetSource(unsigned long webNavigatorId, std::string* frameSource, HANDLE synchro, const std::string frameName)
508 {
509 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
510 if (webNavigator != 0)
511 {
512 frameSource->clear();
513 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
514 if (cefBrowser.get())
515 {
516 CefRefPtr<CefFrame> cefFrame;
517 if (frameName == "")
518 cefFrame = cefBrowser->GetMainFrame();
519 else
520 cefFrame = cefBrowser->GetFrame(frameName);
521
522 if (cefFrame.get())
523 {
524 StringVisitor* visitor = new StringVisitor();
525 cefFrame->GetSource(visitor);
526 frameSource->append(visitor->GetContent());
527 }
528 }
529
530 // Indicate to scol thread that the source string is filled.
531 SetEvent(synchro);
532 }
533 }
534
535 void WebNavigatorThread::GetText(unsigned long webNavigatorId, std::string* frameText, HANDLE synchro, const std::string frameName)
536 {
537 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
538 if (webNavigator != 0)
539 {
540 frameText->clear();
541 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
542 if (cefBrowser.get())
543 {
544 CefRefPtr<CefFrame> cefFrame;
545 if (frameName == "")
546 cefFrame = cefBrowser->GetMainFrame();
547 else
548 cefFrame = cefBrowser->GetFrame(frameName);
549
550 if (cefFrame.get())
551 {
552 StringVisitor* visitor = new StringVisitor();
553 cefFrame->GetSource(visitor);
554 frameText->append(visitor->GetContent());
555 }
556 }
557
558 // Indicate to scol thread that the source text is filled.
559 SetEvent(synchro);
560 }
561 }
562
563 void WebNavigatorThread::ExecuteJavaScript(unsigned long webNavigatorId, const std::string jsCode, const std::string scriptUrl, int startLine, const std::string frameName)
564 {
565 WebNavigator* webNavigator = WebNavigatorManager::GetSingleton().GetNavigator(webNavigatorId);
566 if (webNavigator != 0)
567 {
568 CefRefPtr<CefBrowser> cefBrowser = webNavigator->GetWebNavigatorClient()->GetBrowser();
569 if (cefBrowser.get())
570 {
571 CefRefPtr<CefFrame> cefFrame;
572 if (frameName == "")
573 cefFrame = cefBrowser->GetMainFrame();
574 else
575 cefFrame = cefBrowser->GetFrame(frameName);
576
577 if (cefFrame.get())
578 {
579 // Default url
580 std::string javascriptUrl = scriptUrl;
581 if (javascriptUrl == "")
582 javascriptUrl = cefFrame->GetURL();
583
584 // Execute JS
585 cefFrame->ExecuteJavaScript(jsCode, javascriptUrl, startLine);
586 }
587 }
588 }
589 }
590
591 void WebNavigatorThread::SetCookie(std::string url, CefCookie cookie, bool* result, HANDLE synchro)
592 {
593 // Create cookie
594 CefRefPtr<CefWaitableEvent> event = CefWaitableEvent::CreateWaitableEvent(true, false);
595 CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager(new CompletionCallback(event));
596 event->Wait();
597
598 event = CefWaitableEvent::CreateWaitableEvent(true, false);
599 *result = manager->SetCookie(url, cookie, new SetCookieCallback(event));
600 event->Wait();
601
602 // Indicate to scol thread that the cookie creation is processed
603 SetEvent(synchro);
604 }
605
606 void WebNavigatorThread::DeleteCookies(std::string url, std::string cookie_name, bool* result, HANDLE synchro)
607 {
608 // Delete cookie(s)?
609 CefRefPtr<CefWaitableEvent> event = CefWaitableEvent::CreateWaitableEvent(true, false);
610 CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager(new CompletionCallback(event));
611 event->Wait();
612
613 event = CefWaitableEvent::CreateWaitableEvent(true, false);
614 *result = manager->DeleteCookies(url, cookie_name, new DeleteCookiesCallback(event));
615 event->Wait();
616
617 // Indicate to scol thread that the cookie creation is processed
618 SetEvent(synchro);
619 }
620 }
621}
622
623#endif
SCOL_EXPORT void SCOL_PTR_TYPE event
Definition SO3SCOL.cpp:5128
CefRefPtr< WebNavigatorClient > & GetWebNavigatorClient()
static void Delete(unsigned long webNavigatorId, const std::string frameName="")
static void ClearHistory(unsigned long webNavigatorId)
static void Find(unsigned long webNavigatorId, int identifier, const CefString searchText, bool forward, bool matchCase, bool findNext)
static void ReloadIgnoreCache(unsigned long webNavigatorId)
static void GetSource(unsigned long webNavigatorId, std::string *frameSource, HANDLE synchro, const std::string frameName="")
static void CanGoBack(unsigned long webNavigatorId, bool *canGoBack, HANDLE synchro)
static void Cut(unsigned long webNavigatorId, const std::string frameName="")
static void CloseDevTools(unsigned long webNavigatorId)
static void GoForward(unsigned long webNavigatorId)
static void LoadHTML(unsigned long webNavigatorId, const std::string html, const std::string frameName="")
static void LoadFile(unsigned long webNavigatorId, const std::string file, const std::string frameName="")
static void LoadURL(unsigned long webNavigatorId, const std::string url, const std::string frameName="")
static void DeleteCookies(std::string url, std::string cookie_name, bool *result, HANDLE synchro)
static void Print(unsigned long webNavigatorId, const std::string frameName="")
static void SelectAll(unsigned long webNavigatorId, const std::string frameName="")
static void StopFinding(unsigned long webNavigatorId, bool clearSelection)
static void CanGoForward(unsigned long webNavigatorId, bool *canGoForward, HANDLE synchro)
static void Copy(unsigned long webNavigatorId, const std::string frameName="")
static void GetZoomLevel(unsigned long webNavigatorId, double *zoomFactor, HANDLE synchro)
static void GetURL(unsigned long webNavigatorId, std::string *frameUrl, HANDLE synchro, const std::string frameName="")
static void Undo(unsigned long webNavigatorId, const std::string frameName="")
static void GetText(unsigned long webNavigatorId, std::string *frameText, HANDLE synchro, const std::string frameName="")
static void ShowDevTools(unsigned long webNavigatorId)
static void SetCookie(std::string url, CefCookie cookie, bool *result, HANDLE synchro)
static void Redo(unsigned long webNavigatorId, const std::string frameName="")
static void ViewSource(unsigned long webNavigatorId, const std::string frameName="")
static void Paste(unsigned long webNavigatorId, const std::string frameName="")
static void ExecuteJavaScript(unsigned long webNavigatorId, const std::string jsCode, const std::string scriptUrl, int startLine, const std::string frameName="")
static void SetZoomLevel(unsigned long webNavigatorId, double zoomLevel)