28#if SO3_WEB_NAVIGATOR_BUILD == 1
32 namespace EmbeddedWebNavigator
38 if (webNavigator != 0)
43 CefRefPtr<CefFrame> cefFrame;
45 cefFrame = cefBrowser->GetMainFrame();
47 cefFrame = cefBrowser->GetFrame(frameName);
50 std::string surl = url;
52#if SCOL_PLATFORM == SCOL_PLATFORM_WINDOWS
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);
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);
63 surl = std::string(cstr);
67 csurl.FromString(surl);
70 cefFrame->LoadURL(csurl);
78 if (webNavigator != 0)
83 CefRefPtr<CefFrame> cefFrame;
85 cefFrame = cefBrowser->GetMainFrame();
87 cefFrame = cefBrowser->GetFrame(frameName);
90 std::string surl = file;
92#if SCOL_PLATFORM == SCOL_PLATFORM_WINDOWS
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);
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);
103 surl = std::string(cstr);
107 csurl.FromString(
"file:///" + surl);
110 cefFrame->LoadURL(csurl);
118 if (webNavigator != 0)
121 if (cefBrowser.get())
123 CefRefPtr<CefFrame> cefFrame;
125 cefFrame = cefBrowser->GetMainFrame();
127 cefFrame = cefBrowser->GetFrame(frameName);
130 cefFrame->LoadString(html,
"_current");
138 if (webNavigator != 0)
140 (*canGoBack) =
false;
142 if (cefBrowser.get())
143 (*canGoBack) = cefBrowser->CanGoBack();
153 if (webNavigator != 0)
156 if (cefBrowser.get())
157 cefBrowser->GoBack();
164 if (webNavigator != 0)
166 (*canGoForward) =
false;
168 if (cefBrowser.get())
169 (*canGoForward) = cefBrowser->CanGoForward();
179 if (webNavigator != 0)
182 if (cefBrowser.get())
183 cefBrowser->GoForward();
190 if (webNavigator != 0)
193 if (cefBrowser.get())
194 cefBrowser->Reload();
201 if (webNavigator != 0)
204 if (cefBrowser.get())
205 cefBrowser->ReloadIgnoreCache();
212 if (webNavigator != 0)
215 if (cefBrowser.get())
216 cefBrowser->StopLoad();
220 void WebNavigatorThread::Find(
unsigned long webNavigatorId,
int identifier,
const CefString searchText,
bool forward,
bool matchCase,
bool findNext)
223 if (webNavigator != 0)
226 if (cefBrowser.get())
227 cefBrowser->GetHost()->Find(identifier, searchText, forward, matchCase, findNext);
234 if (webNavigator != 0)
237 if (cefBrowser.get())
238 cefBrowser->GetHost()->StopFinding(clearSelection);
245 if (webNavigator != 0)
249 if (cefBrowser.get())
250 (*zoomFactor) = cefBrowser->GetHost()->GetZoomLevel();
260 if (webNavigator != 0)
263 zoomLevel = (std::min)(4.0, (std::max)(-4.0, zoomLevel));
266 if (cefBrowser.get())
267 cefBrowser->GetHost()->SetZoomLevel(zoomLevel);
274 if (webNavigator != 0)
285 if (webNavigator != 0)
288 if (cefBrowser.get())
290 CefWindowInfo windowInfo;
291 CefBrowserSettings settings;
294 windowInfo.SetAsPopup(cefBrowser->GetHost()->GetWindowHandle(),
"DevTools");
296 cefBrowser->GetHost()->ShowDevTools(windowInfo, webNavigator->
GetWebNavigatorClient(), settings, CefPoint());
304 if (webNavigator != 0)
307 if (cefBrowser.get())
308 cefBrowser->GetHost()->CloseDevTools();
315 if (webNavigator != 0)
319 if (cefBrowser.get())
321 CefRefPtr<CefFrame> cefFrame;
323 cefFrame = cefBrowser->GetMainFrame();
325 cefFrame = cefBrowser->GetFrame(frameName);
328 frameUrl->append(cefFrame->GetURL());
339 if (webNavigator != 0)
342 if (cefBrowser.get())
344 CefRefPtr<CefFrame> cefFrame;
346 cefFrame = cefBrowser->GetMainFrame();
348 cefFrame = cefBrowser->GetFrame(frameName);
359 if (webNavigator != 0)
362 if (cefBrowser.get())
364 CefRefPtr<CefFrame> cefFrame;
366 cefFrame = cefBrowser->GetMainFrame();
368 cefFrame = cefBrowser->GetFrame(frameName);
379 if (webNavigator != 0)
382 if (cefBrowser.get())
384 CefRefPtr<CefFrame> cefFrame;
386 cefFrame = cefBrowser->GetMainFrame();
388 cefFrame = cefBrowser->GetFrame(frameName);
399 if (webNavigator != 0)
402 if (cefBrowser.get())
404 CefRefPtr<CefFrame> cefFrame;
406 cefFrame = cefBrowser->GetMainFrame();
408 cefFrame = cefBrowser->GetFrame(frameName);
419 if (webNavigator != 0)
422 if (cefBrowser.get())
424 CefRefPtr<CefFrame> cefFrame;
426 cefFrame = cefBrowser->GetMainFrame();
428 cefFrame = cefBrowser->GetFrame(frameName);
439 if (webNavigator != 0)
442 if (cefBrowser.get())
444 CefRefPtr<CefFrame> cefFrame;
446 cefFrame = cefBrowser->GetMainFrame();
448 cefFrame = cefBrowser->GetFrame(frameName);
459 if (webNavigator != 0)
462 if (cefBrowser.get())
464 CefRefPtr<CefFrame> cefFrame;
466 cefFrame = cefBrowser->GetMainFrame();
468 cefFrame = cefBrowser->GetFrame(frameName);
471 cefFrame->SelectAll();
479 if (webNavigator != 0)
482 if (cefBrowser.get())
483 cefBrowser->GetHost()->Print();
490 if (webNavigator != 0)
493 if (cefBrowser.get())
495 CefRefPtr<CefFrame> cefFrame;
497 cefFrame = cefBrowser->GetMainFrame();
499 cefFrame = cefBrowser->GetFrame(frameName);
502 cefFrame->ViewSource();
510 if (webNavigator != 0)
512 frameSource->clear();
514 if (cefBrowser.get())
516 CefRefPtr<CefFrame> cefFrame;
518 cefFrame = cefBrowser->GetMainFrame();
520 cefFrame = cefBrowser->GetFrame(frameName);
525 cefFrame->GetSource(visitor);
538 if (webNavigator != 0)
542 if (cefBrowser.get())
544 CefRefPtr<CefFrame> cefFrame;
546 cefFrame = cefBrowser->GetMainFrame();
548 cefFrame = cefBrowser->GetFrame(frameName);
553 cefFrame->GetSource(visitor);
566 if (webNavigator != 0)
569 if (cefBrowser.get())
571 CefRefPtr<CefFrame> cefFrame;
573 cefFrame = cefBrowser->GetMainFrame();
575 cefFrame = cefBrowser->GetFrame(frameName);
580 std::string javascriptUrl = scriptUrl;
581 if (javascriptUrl ==
"")
582 javascriptUrl = cefFrame->GetURL();
585 cefFrame->ExecuteJavaScript(jsCode, javascriptUrl, startLine);
594 CefRefPtr<CefWaitableEvent>
event = CefWaitableEvent::CreateWaitableEvent(
true,
false);
598 event = CefWaitableEvent::CreateWaitableEvent(
true,
false);
609 CefRefPtr<CefWaitableEvent>
event = CefWaitableEvent::CreateWaitableEvent(
true,
false);
613 event = CefWaitableEvent::CreateWaitableEvent(
true,
false);
SCOL_EXPORT void SCOL_PTR_TYPE event
CefRefPtr< WebNavigatorClient > & GetWebNavigatorClient()
static WebNavigatorManager & GetSingleton()
WebNavigator * GetNavigator(unsigned long uniqueId)
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 StopLoad(unsigned long webNavigatorId)
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 Reload(unsigned long webNavigatorId)
static void Print(unsigned long webNavigatorId, const std::string frameName="")
static void SelectAll(unsigned long webNavigatorId, const std::string frameName="")
static void GoBack(unsigned long webNavigatorId)
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)