Esempio n. 1
0
bool FWebBrowserHandler::ShowDevTools(const CefRefPtr<CefBrowser>& Browser)
{
	CefPoint Point;
	CefString TargetUrl = "chrome-devtools://devtools/devtools.html";
	CefString TargetFrameName = "devtools";
	CefPopupFeatures PopupFeatures;
	CefWindowInfo WindowInfo;
	CefRefPtr<CefClient> NewClient;
	CefBrowserSettings BrowserSettings;
	bool NoJavascriptAccess = false;

	PopupFeatures.xSet = false;
	PopupFeatures.ySet = false;
	PopupFeatures.heightSet = false;
	PopupFeatures.widthSet = false;
	PopupFeatures.locationBarVisible = false;
	PopupFeatures.menuBarVisible = false;
	PopupFeatures.toolBarVisible  = false;
	PopupFeatures.statusBarVisible  = false;
	PopupFeatures.resizable = true;
	PopupFeatures.additionalFeatures = cef_string_list_alloc();

	// Override the parent window setting for transparency, as the Dev Tools require a solid background
	CefString OverrideTransparencyFeature = "Epic_NoTransparency";
	cef_string_list_append(PopupFeatures.additionalFeatures, OverrideTransparencyFeature.GetStruct());

	// Set max framerate to maximum supported.
	BrowserSettings.windowless_frame_rate = 60;
	// Disable plugins
	BrowserSettings.plugins = STATE_DISABLED;
	// Dev Tools look best with a white background color
	BrowserSettings.background_color = CefColorSetARGB(255, 255, 255, 255);

	// OnBeforePopup already takes care of all the details required to ask the host application to create a new browser window.
	bool bSuppressWindowCreation = OnBeforePopup(Browser, Browser->GetFocusedFrame(), TargetUrl, TargetFrameName, PopupFeatures, WindowInfo, NewClient, BrowserSettings, &NoJavascriptAccess);

	if(! bSuppressWindowCreation)
	{
		Browser->GetHost()->ShowDevTools(WindowInfo, NewClient, BrowserSettings, Point);
	}
	return !bSuppressWindowCreation;
}
Esempio n. 2
0
void Win32Host::RunLoop(const string & plugin_path)
{
#define TEST_SINGLE_THREADED_MESSAGE_LOOP
#ifdef TEST_SINGLE_THREADED_MESSAGE_LOOP
	// Initialize the CEF with messages processed using the current application's
	// message loop.
	settings.multi_threaded_message_loop = false;
#else
	// Initialize the CEF with messages processed using a separate UI thread.
	settings.multi_threaded_message_loop = true;
#endif

	// Setting private plugin path.
	CefString str(plugin_path);
	settings.extra_plugin_paths = cef_string_list_alloc();
	cef_string_list_append(settings.extra_plugin_paths, str.GetStruct());

	browserDefaults.web_security_disabled = true;
	//  CefInitialize(settings, browserDefaults);

	HACCEL hAccelTable = NULL;// LoadAccelerators(::GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_blah));

	MSG msg;
	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0))
	{
#ifdef TEST_SINGLE_THREADED_MESSAGE_LOOP
		// Allow the CEF to do its message loop processing.
		CefDoMessageLoopWork();
#endif

		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

}
// CEF_EXPORT cef_string_list_t cef_string_list_alloc();
static cef_string_list_t cfx_string_list_alloc() {
    return cef_string_list_alloc();
}