Beispiel #1
0
void CefFacade::LoadUrl( const char* url_/*=NULL */ )
{
	if(strlen(url_)==0)	
		return;
	m_StartupURL = string_To_UTF8(url_);	

	m_clientHandler->GetBrowser()->GetMainFrame()->LoadURL(m_StartupURL);
}
Beispiel #2
0
	void __stdcall LoadUrl( const char* url_/*=NULL */ )
	{
		if(strlen(url_)==0)	
			return;
		std::string m_StartupURL;
		m_StartupURL = string_To_UTF8(url_);	

		s_clientHandler->GetBrowser()->GetMainFrame()->LoadURL(m_StartupURL);
	}
Beispiel #3
0
void CefFacade::CreateBrowser(HWND Parent_,const char* startUrl_,pFun pFn_)
{	
	m_clientHandler = new ClientHandler(pFn_); 

	CefWindowInfo info;  
	CefBrowserSettings b_settings;  

	RECT rect;
	GetClientRect(Parent_,&rect);
	info.SetAsChild(Parent_, rect);  

	if(strlen(startUrl_)==0)
		m_StartupURL="about://blank";
	else
		m_StartupURL = string_To_UTF8(startUrl_);
	CefBrowserHost::CreateBrowser(info, m_clientHandler.get(), m_StartupURL, b_settings, NULL);
}
Beispiel #4
0
	void __stdcall CreateBrowser(HWND Parent_,const char* startUrl_=NULL)
	{
		s_clientHandler = new ClientHandler(NULL); 

		CefWindowInfo info;  
		CefBrowserSettings b_settings;  

		RECT rect;
		GetClientRect(Parent_,&rect);
		info.SetAsChild(Parent_, rect);  
		
		std::string m_StartupURL;
		if(strlen(startUrl_)==0)
			m_StartupURL="about://blank";
		else
			m_StartupURL = string_To_UTF8(startUrl_);
		CefBrowserHost::CreateBrowser(info, s_clientHandler.get(), m_StartupURL, b_settings, NULL);
	}
Beispiel #5
0
Result AppList::recvFromServer(Json::Value jsonObj)
{
    if (jsonObj.isMember("method")) {
        std::string str_method = jsonObj["method"].asString();

        if (str_method == "BasicCommunication.OnAppRegistered") {
            newAppRegistered(jsonObj);
            m_pUIManager->onAppShow(ID_APPLINK);
        }else if (str_method == "BasicCommunication.OnAppUnregistered") {
            int appID = jsonObj["params"]["appID"].asInt();
            m_pUIManager->onAppUnregister(appID);
        }else if (str_method == "VR.VRExitApp") {
            m_pUIManager->tsSpeak(ID_EXIT, "退出"+ m_pCurApp->m_szAppName);
            m_pUIManager->onAppShow(ID_APPLINK);
        }else if (str_method == "Navigation.StopStream") {            
            m_pUIManager->onVideoStreamStop();
            ShowPreviousUI();
        }else if (str_method == "VR.VRSwitchApp") {
//            {
//               "jsonrpc" : "2.0",
//               "method" : "VR.VRSwitchApp",
//               "params" : {
//                  "appID" : 18467,
//                  "appVRName" : "百度 "
//               }
//            }
            std::string strAppVRName = jsonObj["params"]["appVRName"].asString();
            if (!IsTextUTF8((char *)strAppVRName.data(),strAppVRName.size()))
                strAppVRName = string_To_UTF8(strAppVRName);

            m_pUIManager->tsSpeak(ID_SWITCHAPP, strAppVRName);

            int iNewID = jsonObj["params"]["appID"].asInt();
            if (m_pCurApp->m_iAppID != iNewID) {
                std::vector <AppData *>::iterator i;
                for (i = m_AppDatas.begin(); i != m_AppDatas.end(); ++i) {
                    if (iNewID == (*i)->m_iAppID) {
                        m_pCurApp = *i;
                        m_pUIManager->onAppShow(m_pCurApp->getCurUI());
                        break;
                    }
                }
            }
        }else if (str_method == "UI.SetAppIcon") {
            int iAppId = jsonObj["params"]["appID"].asInt();
            std::vector <AppData *>::iterator Iter = m_AppDatas.begin();
            while (Iter != m_AppDatas.end()) {
                if (iAppId == (*Iter)->m_iAppID) {
                    QUrl iconPathUrl(jsonObj["params"]["syncFileName"]["value"].asString().c_str());
#if defined(WINCE)
                    (*Iter)->m_strAppIconFilePath = ChangeSlash(iconPathUrl.path().toLocal8Bit().data());
#else
                    (*Iter)->m_strAppIconFilePath = ChangeSlash(iconPathUrl.path().toStdString());
#endif
                    if (m_pCurApp == NULL) {
                        m_pUIManager->onAppShow(ID_APPLINK);
                    }
                    //m_pUIManager->onAppShow(m_pCurApp->getCurUI());
                    break;
                }
                ++Iter;
            }
        }else if (str_method == "UI.EndAudioPassThru") {
            ToSDL->OnVRCancelRecord();
            m_pUIManager->OnEndAudioPassThru();
            return RESULT_SUCCESS;
        }else if (str_method == "BasicCommunication.UpdateDeviceList") {
            // add by fanqiang
            updateDeiveList(jsonObj);
            m_pUIManager->ShowDeviceList();
        }
        else {
            if (m_pCurApp)
                return m_pCurApp->recvFromServer(jsonObj);
            else
                return RESULT_APPLICATION_NOT_REGISTERED;
        }
        return  RESULT_SUCCESS;
    }
    return  RESULT_SUCCESS;
}