|
|
@@ -393,6 +393,16 @@ namespace Chromium {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ void CModTools::StopSingleChromiumBrowserByName(std::string cefName)
|
|
|
+ {
|
|
|
+ CSimpleStringA strChromiumPath = GetCefHead(this->m_pEntity), strCmdLine = "";
|
|
|
+ strCmdLine.Append(strChromiumPath).Append(CEFCLIENT_NAME).Append(" --kill");
|
|
|
+ strCmdLine.Append(" --logextend=").Append(cefName.c_str());
|
|
|
+ DbgEx("StopChromiumBrowser cmdline:%s, current guardian main browser : %d", strCmdLine.GetData(), m_isGuardMainBrowser);
|
|
|
+
|
|
|
+ SYSTEM_ON(strCmdLine.GetData());
|
|
|
+ }
|
|
|
+
|
|
|
std::pair<bool, std::string> CModTools::getMainUrl()
|
|
|
{
|
|
|
CSimpleStringA strChromiumPath;
|
|
|
@@ -518,7 +528,7 @@ namespace Chromium {
|
|
|
strCmdLine.Append(strChromiumPath).Append(CEFCLIENT_NAME).Append(" --url=").Append(AdUrl.c_str());
|
|
|
CSimpleStringA cachePath;
|
|
|
this->m_pEntity->GetFunction()->GetPath("Temp", cachePath);
|
|
|
- cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append((+ERR_PAGE_REASON::Ad)._to_string());
|
|
|
+ cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(m_strCacheHead.length() > 0 ? m_strCacheHead.c_str() : "").Append((+ERR_PAGE_REASON::Ad)._to_string());
|
|
|
strCmdLine.Append(" --cache-path=").Append(cachePath);
|
|
|
if (g_useMagic)
|
|
|
strCmdLine.Append(" --magic-str=").Append(m_magicStr.c_str());
|
|
|
@@ -676,7 +686,8 @@ namespace Chromium {
|
|
|
}
|
|
|
CSimpleStringA cachePath;
|
|
|
this->m_pEntity->GetFunction()->GetPath("Temp", cachePath);
|
|
|
- cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(isExtend ? (+ERR_PAGE_REASON::extend)._to_string() : (+ERR_PAGE_REASON::main)._to_string());
|
|
|
+ cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(m_strCacheHead.length() > 0 ? m_strCacheHead.c_str() : "")
|
|
|
+ .Append(isExtend ? (+ERR_PAGE_REASON::extend)._to_string() : (+ERR_PAGE_REASON::main)._to_string());
|
|
|
//strCmdLine.Append(" --hide-controls=true")
|
|
|
strCmdLine.Append(" --cache-path=").Append(cachePath);
|
|
|
strCmdLine.Append(" --no-sandbox");
|
|
|
@@ -712,6 +723,46 @@ namespace Chromium {
|
|
|
return generateCefclientCmd(true, extendUrl);
|
|
|
}
|
|
|
|
|
|
+ std::string CModTools::generateSpecialPageFromOtherEntityCmd(std::string mainUrl)
|
|
|
+ {
|
|
|
+ CSimpleStringA cachePath;
|
|
|
+ CSimpleStringA strChromiumPath = GetCefHead(this->m_pEntity), strCmdLine = "";
|
|
|
+ strCmdLine.Append(strChromiumPath).Append(CEFCLIENT_NAME).Append(" --url=").Append(mainUrl.c_str());
|
|
|
+ this->m_pEntity->GetFunction()->GetPath("Temp", cachePath);
|
|
|
+ cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(m_strCacheHead.length() > 0 ? m_strCacheHead.c_str() : "").Append(m_specialPage_temp_name.c_str());
|
|
|
+ //strCmdLine.Append(" --hide-controls=true")
|
|
|
+ strCmdLine.Append(" --cache-path=").Append(cachePath);
|
|
|
+ strCmdLine.Append(" --no-sandbox");
|
|
|
+ strCmdLine.Append(" --hide-controls");
|
|
|
+ if (g_useMagic)
|
|
|
+ strCmdLine.Append(" --magic-str=").Append(m_magicStr.c_str());
|
|
|
+ strCmdLine.Append(" --hide-tabs");
|
|
|
+ strCmdLine.Append(" --logextend=").Append(m_specialPage_temp_name.c_str());
|
|
|
+ if(m_specialPage_temp_size.length() > 0)
|
|
|
+ strCmdLine.Append(" --center-size=").Append(m_specialPage_temp_size.c_str());
|
|
|
+ if (m_specialPage_temp_point.length() > 0)
|
|
|
+ strCmdLine.Append(" --src-pos=").Append(m_specialPage_temp_point.c_str());
|
|
|
+
|
|
|
+
|
|
|
+#if (defined _WIN32 || defined _WIN64)
|
|
|
+ strCmdLine.Append(" --top=").Append(std::to_string((_LONGLONG)m_specialPage_temp_top).c_str());
|
|
|
+#else
|
|
|
+ strCmdLine.Append(" --fullscreen=0");
|
|
|
+ if(m_specialPage_temp_top == -1)
|
|
|
+ strCmdLine.Append(" --always-on-top").Append(" --fullscreen=0");
|
|
|
+#endif
|
|
|
+
|
|
|
+#if (defined _WIN32 || defined _WIN64)
|
|
|
+ strCmdLine.Append(" --errurl=file:\/\/\/").Append(getErrUrl().second.c_str());
|
|
|
+#else
|
|
|
+ strCmdLine.Append(R"( --errurl=file:///)").Append(getErrUrl().second.c_str());
|
|
|
+#endif
|
|
|
+
|
|
|
+ DbgEx("cmdline : %s", strCmdLine.GetData());
|
|
|
+
|
|
|
+ return strCmdLine.GetData();
|
|
|
+ }
|
|
|
+
|
|
|
std::pair<bool, std::string> CModTools::openAdPage() {
|
|
|
if (m_isAdOpen)//only open ad in first time
|
|
|
return std::make_pair(false, "open AdPage failed! Already exist.");
|
|
|
@@ -785,8 +836,17 @@ namespace Chromium {
|
|
|
if (Error_Succeed == openCefRet.first)
|
|
|
return std::make_pair(Error_Succeed, openCefRet.second);
|
|
|
else
|
|
|
- Dbg("open cef for OutsideRequest failed: %d", openCefRet.first);
|
|
|
+ DbgEx("open cef for OutsideRequest failed: %d", openCefRet.first);
|
|
|
}
|
|
|
+ else if (reason._to_integral() == ERR_PAGE_REASON::SpecialPageFromOtherEntity)
|
|
|
+ {
|
|
|
+ auto strCmdLine = generateSpecialPageFromOtherEntityCmd(std::get<0>(normalParam));
|
|
|
+ auto openCefRet = openCef(strCmdLine, false);
|
|
|
+ if (Error_Succeed == openCefRet.first)
|
|
|
+ return std::make_pair(Error_Succeed, openCefRet.second);
|
|
|
+ else
|
|
|
+ Dbg("open cef for SpecialPageFromOtherEntity failed: %d", openCefRet.first);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
//open err page
|
|
|
@@ -1145,21 +1205,21 @@ namespace Chromium {
|
|
|
if (SP::Module::Util::ShellExecute(runStr, succStr, errStr)) {
|
|
|
if (succStr.empty()) {
|
|
|
if (ExistsFileA(execute_oldbrowser_path.c_str())) {
|
|
|
- Dbg("%s exists!", execute_oldbrowser_path.c_str());
|
|
|
+ DbgEx("%s exists!", execute_oldbrowser_path.c_str());
|
|
|
result = 1;
|
|
|
} else {
|
|
|
- Dbg("%s not exists!", execute_oldbrowser_path.c_str());
|
|
|
+ DbgEx("%s not exists!", execute_oldbrowser_path.c_str());
|
|
|
}
|
|
|
} else {
|
|
|
- Dbg("new browser version: %s", succStr.c_str());
|
|
|
+ DbgEx("new browser version: %s", succStr.c_str());
|
|
|
additional = succStr;
|
|
|
if (!ExistsFileA(execute_newbrowser_path.c_str())) {
|
|
|
- Dbg("%s not exists!", execute_newbrowser_path.c_str());
|
|
|
+ DbgEx("%s not exists!", execute_newbrowser_path.c_str());
|
|
|
}
|
|
|
result = 2;
|
|
|
}
|
|
|
} else {
|
|
|
- Dbg("execute '%s' failed!", runStr.c_str());
|
|
|
+ DbgEx("execute '%s' failed!", runStr.c_str());
|
|
|
}
|
|
|
|
|
|
UploadBrowserInfo(result, additional.c_str());
|
|
|
@@ -1233,7 +1293,8 @@ namespace Chromium {
|
|
|
}
|
|
|
|
|
|
std::tuple<CSimpleStringA, CSimpleStringA, CSimpleStringA, CSimpleStringA, CSimpleStringA> CModTools::ReadCenterConfigStr(CSimpleStringA entityName) {
|
|
|
- CSimpleStringA str = "", strNew = "", strEx = "", strFulture = "", strAd = "";
|
|
|
+ CSimpleStringA str = "", strNew = "", strEx = "", strFulture = "", strAd = "", strCacheHead;
|
|
|
+ bool forceCleanCache = false;
|
|
|
CSmartPointer<IConfigInfo> spCerConfig;
|
|
|
ErrorCodeEnum err = this->m_pEntity->GetFunction()->OpenConfig(Config_CenterSetting, spCerConfig);
|
|
|
if (entityName == "")
|
|
|
@@ -1246,8 +1307,9 @@ namespace Chromium {
|
|
|
table.AddEntryString(entityName, "UserMgrUrlNoSidebarMuti", strEx, "");
|
|
|
table.AddEntryString(entityName, "UserMgrUrlFulture", strFulture, "");
|
|
|
table.AddEntryString(entityName, "UserMgrAd", strAd, "");
|
|
|
+ table.AddEntryString(entityName, "CacheHead", strCacheHead, "");
|
|
|
if (Error_Succeed == table.Load(spCerConfig))
|
|
|
- Dbg(CSimpleString::Format("read centersetting config : UserMgrUrl-%s, UserMgrUrlNoSidebar-%s, UserMgrUrlNoSidebarMuti-%s, UserMgrUrlFulture-%s, UserMgrAd-%s",
|
|
|
+ DbgEx(CSimpleString::Format("read centersetting config : UserMgrUrl-%s, UserMgrUrlNoSidebar-%s, UserMgrUrlNoSidebarMuti-%s, UserMgrUrlFulture-%s, UserMgrAd-%s",
|
|
|
str.GetData(), strNew.GetData(), strEx.GetData(), strFulture.GetData(), strAd.GetData()));
|
|
|
|
|
|
CChromiumEntity* pChromiumEntity = reinterpret_cast<CChromiumEntity*>(m_pEntity);
|
|
|
@@ -1257,6 +1319,8 @@ namespace Chromium {
|
|
|
LogWarn(Severity_Low, Error_Debug, LOG_EVT_CHROMIUM_USE_CUSTOM_FULTURE_URL, strTmp);
|
|
|
}
|
|
|
|
|
|
+ m_strCacheHead = strCacheHead.GetData();
|
|
|
+
|
|
|
return std::make_tuple(str, strNew, strEx, strFulture, strAd);
|
|
|
}
|
|
|
|