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


C++ CefWindowInfo::SetAsWindowless方法代码示例

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


在下文中一共展示了CefWindowInfo::SetAsWindowless方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Initialise

void CWebView::Initialise ()
{
    // Initialise the web session (which holds the actual settings) in in-memory mode
    CefBrowserSettings browserSettings;
    browserSettings.windowless_frame_rate = g_pCore->GetFrameRateLimit ();
    browserSettings.javascript_access_clipboard = cef_state_t::STATE_DISABLED;
    browserSettings.java = cef_state_t::STATE_DISABLED;
    browserSettings.caret_browsing = cef_state_t::STATE_ENABLED;
    browserSettings.universal_access_from_file_urls = cef_state_t::STATE_DISABLED; // Also filtered by resource interceptor, but set this nevertheless
    browserSettings.file_access_from_file_urls = cef_state_t::STATE_DISABLED;
    browserSettings.webgl = cef_state_t::STATE_ENABLED;
    browserSettings.javascript_open_windows = cef_state_t::STATE_DISABLED;

    bool bEnabledPlugins = g_pCore->GetWebCore ()->GetPluginsEnabled ();
    browserSettings.plugins = bEnabledPlugins ? cef_state_t::STATE_ENABLED : cef_state_t::STATE_DISABLED;
    if ( !m_bIsLocal )
    {
        bool bEnabledJavascript = g_pCore->GetWebCore ()->GetRemoteJavascriptEnabled ();
        browserSettings.javascript = bEnabledJavascript ? cef_state_t::STATE_ENABLED : cef_state_t::STATE_DISABLED;
    }

    CefWindowInfo windowInfo;
    windowInfo.SetAsWindowless ( g_pCore->GetHookedWindow (), m_bIsTransparent );
    
    CefBrowserHost::CreateBrowser ( windowInfo, this, "", browserSettings, nullptr );
}
开发者ID:stymR,项目名称:mtasa-blue,代码行数:26,代码来源:CWebView.cpp

示例2: OnBeforePopup

bool FWebBrowserHandler::OnBeforePopup( CefRefPtr<CefBrowser> Browser,
									   CefRefPtr<CefFrame> Frame,
									   const CefString& TargetUrl,
									   const CefString& TArgetFrameName,
									   const CefPopupFeatures& PopupFeatures,
									   CefWindowInfo& WindowInfo,
									   CefRefPtr<CefClient>& Client,
									   CefBrowserSettings& Settings,
									   bool* NoJavascriptAccess )
{

	// By default, we ignore any popup requests unless they are handled by us in some way.
	bool bSupressCEFWindowCreation = true;
	TSharedPtr<FWebBrowserWindow> BrowserWindow = BrowserWindowPtr.Pin();

	if (BrowserWindow.IsValid())
	{
		bSupressCEFWindowCreation = BrowserWindow->OnCefBeforePopup(TargetUrl, TArgetFrameName);

		if(!bSupressCEFWindowCreation)
		{
			if(BrowserWindow->SupportsNewWindows())
			{
				CefRefPtr<FWebBrowserHandler> NewHandler(new FWebBrowserHandler);
				NewHandler->SetBrowserWindowParent(BrowserWindow);
				NewHandler->SetPopupFeatures(MakeShareable(new FWebBrowserPopupFeatures(PopupFeatures)));
				Client = NewHandler;
				
				CefWindowHandle ParentWindowHandle = BrowserWindow->GetCefBrowser()->GetHost()->GetWindowHandle();

				// Allow overriding transparency setting for child windows
				bool bUseTransparency = BrowserWindow->UseTransparency()
										? NewHandler->BrowserPopupFeatures->GetAdditionalFeatures().Find(TEXT("Epic_NoTransparency")) == INDEX_NONE
										: NewHandler->BrowserPopupFeatures->GetAdditionalFeatures().Find(TEXT("Epic_UseTransparency")) != INDEX_NONE;

				// Always use off screen rendering so we can integrate with our windows
				WindowInfo.SetAsWindowless(ParentWindowHandle, bUseTransparency);

				// We need to rely on CEF to create our window so we set the WindowInfo, BrowserSettings, Client, and then return false
				bSupressCEFWindowCreation = false;
			}
			else
			{
				bSupressCEFWindowCreation = true;
			}
		}
	}

	return bSupressCEFWindowCreation; 
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:50,代码来源:WebBrowserHandler.cpp

示例3: NewWindow

TSharedPtr<IWebBrowserWindow> FWebBrowserSingleton::CreateBrowserWindow(
	void* OSWindowHandle, 
	FString InitialURL, 
	uint32 Width, 
	uint32 Height, 
	bool bUseTransparency,
	bool bThumbMouseButtonNavigation,
	TOptional<FString> ContentsToLoad, 
	bool ShowErrorMessage,
	FColor BackgroundColor)
{
#if WITH_CEF3
	// Create new window
	TSharedPtr<FWebBrowserWindow> NewWindow(new FWebBrowserWindow(FIntPoint(Width, Height), InitialURL, ContentsToLoad, ShowErrorMessage, bThumbMouseButtonNavigation, bUseTransparency));

	// WebBrowserHandler implements browser-level callbacks.
	CefRefPtr<FWebBrowserHandler> NewHandler(new FWebBrowserHandler);
	NewWindow->SetHandler(NewHandler);

	// Information used when creating the native window.
	CefWindowHandle WindowHandle = (CefWindowHandle)OSWindowHandle; // TODO: check this is correct for all platforms
	CefWindowInfo WindowInfo;

	// Always use off screen rendering so we can integrate with our windows
	WindowInfo.SetAsWindowless(WindowHandle, bUseTransparency);

	// Specify CEF browser settings here.
	CefBrowserSettings BrowserSettings;
	
	// Set max framerate to maximum supported.
	BrowserSettings.windowless_frame_rate = 60;
	BrowserSettings.background_color = CefColorSetARGB(BackgroundColor.A, BackgroundColor.R, BackgroundColor.G, BackgroundColor.B);

	// Disable plugins
	BrowserSettings.plugins = STATE_DISABLED;

	CefString URL = *InitialURL;

	// Create the CEF browser window.
	if (CefBrowserHost::CreateBrowser(WindowInfo, NewHandler.get(), URL, BrowserSettings, NULL))
	{
		WindowInterfaces.Add(NewWindow);
		return NewWindow;
	}
#endif
	return NULL;
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:47,代码来源:WebBrowserSingleton.cpp

示例4: initBrowser

void BrowserClient::initBrowser(const std::string& url)
{
    //Setup our main view that will show the cef ui
    setupMainView( _width, _height );
    _viewer->addView( _mainView );

    //Setup RTT camera for screen capture
    setupRTTCamera();

    {
        CefWindowInfo windowInfo;
        CefBrowserSettings browserSettings;

        //TODO: populate settings from CLA's

        //windowInfo.SetAsOffScreen(0L);
        //windowInfo.SetTransparentPainting(true);
        windowInfo.SetAsWindowless(0L, true);

        _browser = CefBrowserHost::CreateBrowserSync(windowInfo, this, url.c_str(), browserSettings, 0L);
        _browser->GetHost()->SendFocusEvent(true);
    }

#ifdef WIN32
    //Setup native event handling on Windows
    osgViewer::GraphicsHandleWin32* graphicsHandleWin32 = dynamic_cast<osgViewer::GraphicsHandleWin32*>(_mainView->getCamera()->getGraphicsContext());
    if (graphicsHandleWin32)
        _nativeEventHandler = new NativeEventHandlerWin(graphicsHandleWin32->getHWND(), this, _browser);

#endif

    addExecuteCallback(new MapExecuteCallback(this));   // handles map related calls
    addExecuteCallback(new FileExecuteCallback(this));  // handles file related calls

    _mainEventHandler = new BrowserEventHandler(_mainView.get(), this, _browser);
    _mainView->addEventHandler(_mainEventHandler);
}
开发者ID:pelicanmapping,项目名称:osgearth-cef,代码行数:37,代码来源:BrowserClient.cpp

示例5: CreateBrowser

    bool CreateBrowser(const String& initialURL, int width, int height)
    {
        if (browser_.get())
        {
            LOGERROR("WebClient::CreateBrowser - Browser already created");
            return false;
        }

        if (webClient_->renderHandler_.Null())
        {
            LOGERROR("WebClient::CreateBrowser - No render handler specified");
            return false;
        }

        CefWindowInfo windowInfo;
        CefBrowserSettings browserSettings;

        browserSettings.webgl = STATE_ENABLED;
        browserSettings.file_access_from_file_urls = STATE_ENABLED;
        browserSettings.universal_access_from_file_urls = STATE_ENABLED;

        windowInfo.width = width;
        windowInfo.height = height;        
        windowInfo.transparent_painting_enabled = 1;

        Graphics* graphics = webClient_->GetSubsystem<Graphics>();

        if (graphics)
        {
            SDL_Window* sdlWindow = static_cast<SDL_Window*>(graphics->GetSDLWindow());
            SDL_SysWMinfo info;
            SDL_VERSION(&info.version);

            if(SDL_GetWindowWMInfo(sdlWindow, &info))
            {
#ifdef ATOMIC_PLATFORM_OSX
                NSView* view = (NSView*) GetNSWindowContentView(info.info.cocoa.window);
                windowInfo.SetAsWindowless(view, false);
#endif

#ifdef ATOMIC_PLATFORM_WINDOWS
                windowInfo.SetAsWindowless(info.info.win.window, /*transparent*/ true);
#endif
            }

        }
        else
        {
#ifndef ATOMIC_PLATFORM_LINUX
            // headless
            windowInfo.SetAsWindowless(nullptr, true);
#endif
        }

        // TODO: There seems to be a CEF bug when loading a string into a browser
        // which was created with an empty URL, this workaround gets things going
        // NOTE: I also tried loading the string, delaying 5 seconds and still won't
        // load a string until a URL has been passed into the view
        String _initialURL = initialLoadString_.Length() ? "x" : initialURL;

        webClient_->renderHandler_->SetSize(width, height);
        CefRefPtr<CefBrowser> browser = CefBrowserHost::CreateBrowserSync(windowInfo, this,
                                                                          _initialURL.CString(), browserSettings, nullptr);

        if (!browser.get())
            return false;

        browser_ = browser;

        if (initialLoadString_.Length())
        {
            webClient_->LoadString(initialLoadString_, initialLoadStringURL_);
        }

        return true;


    }
开发者ID:Aliandrana,项目名称:AtomicGameEngine,代码行数:78,代码来源:WebClient.cpp

示例6: GetWebView

HWND WebViewFactory::GetWebView(const HWND& hSameProcessWnd, const HINSTANCE& hInstance, const int& x, const int& y, const int& width,
	const int& height, const CefString& url, const int& alpha, const bool& taskbar, const bool& trans, const int& winCombination)
{
	//std::unique_lock<std::mutex> lock(factoryMutex_);
#ifdef _DEBUG
	char szTmp[8192] = { 0 };
	sprintf_s(szTmp, "------GetWebView   %s", url.ToString().c_str() );
	OutputDebugStringA(szTmp);
#endif
	CefRefPtr<CefBrowser> browser;
	{
		if (hSameProcessWnd && IsWindow(hSameProcessWnd))
		{
			CefRefPtr<WebItem> item = FindItem(hSameProcessWnd);
			if ( item.get() )
			{
				browser = item->getBrowserByHwnd(hSameProcessWnd);
			}
		}
	}

	CefRefPtr<WebItem> item = new  WebItem;
	item->m_handle = new ClientHandler();
	item->m_handle->SetMainWindowHandle(NULL);
	CefRefPtr<BrowserProvider> provider = new BrowserProvider(item->m_handle);
	
	CefBrowserSettings browser_settings;
	const bool transparent = trans;
	//cmd_line->HasSwitch(cefclient::kTransparentPaintingEnabled);
	const bool show_update_rect = false;
	RECT rect;

	CefRefPtr<OSRWindow> window =
		OSRWindow::Create(provider, transparent,
		show_update_rect);
	WCHAR szOSRWindowClass[] = L"WebViewWindowClass";
	rect.left = x;
	rect.top = y;
	rect.right = x + width;
	rect.bottom = y + height;
	window->CreateWidget(NULL, rect, hInstance, szOSRWindowClass, trans, winCombination);
	assert(IsWindow(window->hwnd()));
	bool bTest = item->m_window_map.insert(std::make_pair(window->hwnd(), window)).second;
	assert(bTest == true);

	CefWindowInfo info;
	info.SetAsWindowless(window->hwnd(), transparent);
	info.transparent_painting_enabled = trans; //是否需要?
	info.windowless_rendering_enabled = true;
	//item->m_handle->SetOSRHandler(window.get());
	if ( !taskbar )
	{
		DWORD exStyle = GetWindowLong(window->hwnd(), GWL_EXSTYLE);
		exStyle &= ~WS_EX_APPWINDOW;
		exStyle |= WS_EX_TOOLWINDOW;
		SetWindowLong(window->hwnd(), GWL_EXSTYLE, exStyle);
		SetWindowPos(window->hwnd(), NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
	}
	window->SetAlpha(alpha);
	//ShowWindow(window->hwnd(), SW_SHOW);

	//browser_settings.file_access_from_file_urls = STATE_ENABLED;
	browser_settings.universal_access_from_file_urls = STATE_ENABLED; //让xpack访问本地文件
	//browser_settings.web_security = STATE_DISABLED; //网页安全
	//browser_settings.webgl = STATE_DISABLED;
	//browser_settings.plugins = STATE_DISABLED;
	//browser_settings.java = STATE_DISABLED;
	//browser_settings.application_cache = STATE_DISABLED; //不用缓存
	// Creat the new child browser window

	//CefRequestContextSettings settings;
	//CefString(&settings.cache_path) = CefString(g_strGlobalCachePath.c_str());
	/*if (!shared_request_context_.get()) {
		shared_request_context_ =
			CefRequestContext::CreateContext(CefRequestContext::GetGlobalContext(),
			new ClientRequestContextHandler);
	}*/

	/*if ( m_requestContextHandler.get() == NULL )
	{
		m_requestContextHandler = new RequestContextHandlerPath(g_strGlobalCachePath.c_str());
	}
	CefRefPtr<CefRequestContext> request_context = CefRequestContext::CreateContext(settings, m_requestContextHandler);*/


	m_viewList.push_back(item);
	if ( browser.get() )
	{
		CefBrowserHost::CreateInheritBrowser(browser, info, item->m_handle,
			url, browser_settings, CookiesManage::getInst().getShareRequest() );
	}
	else{
		CefBrowserHost::CreateBrowser(info, item->m_handle,
			url, browser_settings, CookiesManage::getInst().getShareRequest());
	}
	//WCHAR szBuf[] = { L"D:\\work\\WebUIDemo\\bin\\Release\\uiframe\\PepperFlash1\\pepflashplayer.dll;application/x-shockwave-flash" };
	//item->m_provider->GetBrowser()->RegPlugin(szBuf, true);
	return window->hwnd();
}
开发者ID:lincolnfz,项目名称:cefui,代码行数:99,代码来源:WebViewFactory.cpp


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