Browse Source

Z991239-5462 #comment fea: add open common page and close common page functions

chenliangyu 1 year ago
parent
commit
84bec9f4b6

+ 38 - 0
Module/mod_chromium/CModTools.cpp

@@ -351,6 +351,18 @@ namespace Chromium {
 		}
 	}
 
+	void CModTools::stopCommonPage(std::string name)
+	{
+#if defined(_MSC_VER)
+		CSimpleStringA strChromiumPath = GetCefHead(this->m_pEntity), strCmdLine = "";
+		strCmdLine.Append(strChromiumPath).Append(" --kill");
+		strCmdLine.Append(" --logextend=").Append(name.c_str());
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("stopCommonPage cmdline:%s", strCmdLine.GetData());
+
+		SYSTEM_ON(strCmdLine.GetData());
+#endif //_MSC_VER
+	}
+
 	/** 这个接口将移除,信创不再使用CEFClient [Gifur@2023626]*/
 	void CModTools::StopChromiumBrowser(ERR_PAGE_REASON reason, bool stopAll)
 	{
@@ -899,6 +911,32 @@ namespace Chromium {
 		return std::make_pair(Error_Unexpect, 0);
 	}
 
+	std::pair<ErrorCodeEnum, int> CModTools::startCommonPage(std::string name, std::string url, std::string size, std::string point, std::string top)
+	{
+		CSimpleString topStr = top.c_str();
+		int top_param = (int)HWND_NOTOPMOST;
+		if (topStr.Compare("top", true) == 0)
+			top_param = (int)HWND_TOP;
+		else if (topStr.Compare("topmost", true) == 0)
+			top_param = (int)HWND_TOPMOST;
+		else if (topStr.Compare("notopmost", true) == 0)
+			top_param = (int)HWND_NOTOPMOST;
+		else if (topStr.Compare("bottom", true) == 0)
+			top_param = (int)HWND_BOTTOM;
+
+		auto strCmdline = generateCommonPage(url, name, size, point, top_param);
+		auto openCefRet = openCef(strCmdline, false);
+		if (Error_Succeed == openCefRet.first)
+			return std::make_pair(Error_Succeed, openCefRet.second);
+		else
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("open cef %s size:%s at %s in layer %s failed: %d"
+				, name.c_str(), size.c_str(), point.c_str(), top.c_str(), openCefRet.first);
+			return std::make_pair(openCefRet.first, openCefRet.first);
+		}
+
+	}
+
 	void CModTools::cefClientGuardian(std::string cmdline)
 	{
 		m_isGuardMainBrowser = true;

+ 2 - 0
Module/mod_chromium/CModTools.h

@@ -40,6 +40,8 @@ namespace Chromium {
 		std::pair<ErrorCodeEnum, int> StartChromiumBrowser(ERR_PAGE_REASON reason = ERR_PAGE_REASON::main,
 			std::tuple < std::string, std::string> normalParam = std::tuple <std::string, std::string>("", ""),
 			std::tuple<std::string, std::string, std::string, DWORD, DWORD> exParam = std::tuple<std::string, std::string, std::string, DWORD, DWORD>("", "", "", 0, 0));
+		std::pair<ErrorCodeEnum, int> startCommonPage(std::string name, std::string url, std::string size, std::string point, std::string top);
+		void stopCommonPage(std::string name);
 		void StopChromiumBrowser(ERR_PAGE_REASON reason, bool stopAll = false);
 		void StopSingleChromiumBrowserByName(std::string cefName);
 		bool killAllChromium();	//通过taskkill 关闭掉所有的cefclient

+ 2 - 1
Module/mod_chromium/Chromium.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="gb2312" ?>
 <entity name="Chromium">
+	<!-- chromium接口定义, D:\mayun\LR04.02_RVCTerminalPlus\Tool\spgen\bin\Debug\spgen.exe D:\mayun\LR04.02_RVCTerminalPlus\Module\mod_chromium\Chromium.xml  -->
 	<class name="ChromiumSrv" overlap="true" exclusive="false">
 		<twoway name="OpenBrowser" overlap="true">
 			<req>
@@ -55,7 +56,7 @@
 			</res>
 		</twoway>
 		<!-- 定义一个名为CloseCommonPage的双向通信,用于关闭一个页面  -->
-		<twoway name="OpenCommonPage" overlap="true" simpleret="true">
+		<twoway name="CloseCommonPage" overlap="true" simpleret="true">
 			<req>
 				<!-- 标题,页面的名称,类型为字符串 -->
 				<param name="title" type="string"/>

+ 8 - 8
Module/mod_chromium/Chromium_client_g.h

@@ -205,7 +205,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum OpenCommonPage(ChromiumSrv_OpenCommonPage_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum CloseCommonPage(ChromiumSrv_CloseCommonPage_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -215,14 +215,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(ChromiumSrv_Method_OpenCommonPage, ChromiumSrv_MethodSignature_OpenCommonPage, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(ChromiumSrv_Method_CloseCommonPage, ChromiumSrv_MethodSignature_CloseCommonPage, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum OpenCommonPage(ChromiumSrv_OpenCommonPage_Req &Req, ChromiumSrv_OpenCommonPage_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum CloseCommonPage(ChromiumSrv_CloseCommonPage_Req &Req, ChromiumSrv_CloseCommonPage_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = OpenCommonPage(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = CloseCommonPage(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -230,10 +230,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum OpenCommonPage(ChromiumSrv_OpenCommonPage_Req &Req, ChromiumSrv_OpenCommonPage_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum CloseCommonPage(ChromiumSrv_CloseCommonPage_Req &Req, ChromiumSrv_CloseCommonPage_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = OpenCommonPage(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = CloseCommonPage(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -241,10 +241,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum OpenCommonPage(ChromiumSrv_OpenCommonPage_Req &Req, ChromiumSrv_OpenCommonPage_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum CloseCommonPage(ChromiumSrv_CloseCommonPage_Req &Req, ChromiumSrv_CloseCommonPage_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = OpenCommonPage(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = CloseCommonPage(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;

+ 5 - 5
Module/mod_chromium/Chromium_def_g.h

@@ -15,17 +15,17 @@ namespace Chromium {
 #define ChromiumSrv_Method_OpenBrowser 0
 #define ChromiumSrv_Method_CloseBrowser 1
 #define ChromiumSrv_Method_OpenCommonPage 2
-#define ChromiumSrv_Method_OpenCommonPage 3
+#define ChromiumSrv_Method_CloseCommonPage 3
 
 #define ChromiumSrv_MethodSignature_OpenBrowser 1632538869
 #define ChromiumSrv_MethodSignature_CloseBrowser -1561571899
 #define ChromiumSrv_MethodSignature_OpenCommonPage 15213547
-#define ChromiumSrv_MethodSignature_OpenCommonPage 1932684502
+#define ChromiumSrv_MethodSignature_CloseCommonPage 1463237030
 
 #define ChromiumSrv_LogCode_OpenBrowser "QLR040240200"
 #define ChromiumSrv_LogCode_CloseBrowser "QLR040240201"
 #define ChromiumSrv_LogCode_OpenCommonPage "QLR040240202"
-#define ChromiumSrv_LogCode_OpenCommonPage "QLR040240203"
+#define ChromiumSrv_LogCode_CloseCommonPage "QLR040240203"
 
 struct ChromiumSrv_OpenBrowser_Req
 {
@@ -114,7 +114,7 @@ struct ChromiumSrv_OpenCommonPage_Ans
 
 };
 
-struct ChromiumSrv_OpenCommonPage_Req
+struct ChromiumSrv_CloseCommonPage_Req
 {
 	CSimpleStringA title;
 
@@ -125,7 +125,7 @@ struct ChromiumSrv_OpenCommonPage_Req
 
 };
 
-struct ChromiumSrv_OpenCommonPage_Ans
+struct ChromiumSrv_CloseCommonPage_Ans
 {
 	bool result;
 	CSimpleStringA additionalMsg;

+ 9 - 9
Module/mod_chromium/Chromium_server_g.h

@@ -51,8 +51,8 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case ChromiumSrv_Method_OpenCommonPage:
-			if (dwSignature == ChromiumSrv_MethodSignature_OpenCommonPage) {
+		case ChromiumSrv_Method_CloseCommonPage:
+			if (dwSignature == ChromiumSrv_MethodSignature_CloseCommonPage) {
 				bOverlap = true;
 			} else {
 				Error = Error_MethodSignatureFailed;
@@ -84,8 +84,8 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case ChromiumSrv_Method_OpenCommonPage:
-			if (dwSignature != ChromiumSrv_MethodSignature_OpenCommonPage) {
+		case ChromiumSrv_Method_CloseCommonPage:
+			if (dwSignature != ChromiumSrv_MethodSignature_CloseCommonPage) {
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
@@ -111,7 +111,7 @@ public:
 	/// override by user
 	}
 
-	virtual void Handle_OpenCommonPage(SpReqAnsContext<ChromiumSrv_OpenCommonPage_Req, ChromiumSrv_OpenCommonPage_Ans>::Pointer ctx)
+	virtual void Handle_CloseCommonPage(SpReqAnsContext<ChromiumSrv_CloseCommonPage_Req, ChromiumSrv_CloseCommonPage_Ans>::Pointer ctx)
 	{
 	/// override by user
 	}
@@ -162,14 +162,14 @@ public:
 						Handle_OpenCommonPage(ctx);
 					}
 					break;
-				case ChromiumSrv_Method_OpenCommonPage:
+				case ChromiumSrv_Method_CloseCommonPage:
 					{
-						SpReqAnsContext<ChromiumSrv_OpenCommonPage_Req,ChromiumSrv_OpenCommonPage_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<ChromiumSrv_OpenCommonPage_Req,ChromiumSrv_OpenCommonPage_Ans>(pTransactionContext));
+						SpReqAnsContext<ChromiumSrv_CloseCommonPage_Req,ChromiumSrv_CloseCommonPage_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<ChromiumSrv_CloseCommonPage_Req,ChromiumSrv_CloseCommonPage_Ans>(pTransactionContext));
 						SpBuffer2Object(Buf, ctx->Req);
 						pTransactionContext->GetLinkContext(ctx->link);
 						EntityResource::setLink(ctx->link);
-						Handle_OpenCommonPage(ctx);
+						Handle_CloseCommonPage(ctx);
 					}
 					break;
 				default:

+ 30 - 0
Module/mod_chromium/mod_chromium.cpp

@@ -62,6 +62,18 @@ namespace Chromium {
 		m_pEntity->CloseBrowser(ctx);
 	}
 
+	void ChromiumSession::Handle_OpenCommonPage(SpReqAnsContext<ChromiumSrv_OpenCommonPage_Req, ChromiumSrv_OpenCommonPage_Ans>::Pointer ctx)
+	{
+		DbgToBeidou(ctx->link, __FUNCTION__)();
+		m_pEntity->OpenCommonPage(ctx);
+	}
+
+	void ChromiumSession::Handle_CloseCommonPage(SpReqAnsContext<ChromiumSrv_CloseCommonPage_Req, ChromiumSrv_CloseCommonPage_Ans>::Pointer ctx)
+	{
+		DbgToBeidou(ctx->link, __FUNCTION__)();
+		m_pEntity->CloseCommonPage(ctx);
+	}
+
 
 	CChromiumEntity::CChromiumEntity() :m_pWsServer(NULL), m_iTcpBridgePort(4504), m_pTimerListener(NULL), m_strCustomMainUrl(true)
 		, m_runAd(false), m_runMain(false), m_runExtend(false), m_runLogin(false), m_withBrowser(false), m_withMin(false), m_withClose(false)
@@ -146,6 +158,24 @@ namespace Chromium {
 	}
 #endif
 
+	void CChromiumEntity::OpenCommonPage(SpReqAnsContext<ChromiumSrv_OpenCommonPage_Req, ChromiumSrv_OpenCommonPage_Ans>::Pointer ctx)
+	{
+		std::string strTitle = ctx->Req.title.GetData();
+		std::string strUrl = ctx->Req.url.GetData();
+		std::string strSize = ctx->Req.size.GetData();
+		std::string strPoint = ctx->Req.point.GetData();
+		std::string strTop = ctx->Req.top.GetData();
+		auto ret = CModTools::get_mutable_instance().startCommonPage(strTitle, strUrl, strSize, strPoint, strTop);
+		ctx->Answer(ret.first, ret.first);
+	
+	}
+	void CChromiumEntity::CloseCommonPage(SpReqAnsContext<ChromiumSrv_CloseCommonPage_Req, ChromiumSrv_CloseCommonPage_Ans>::Pointer ctx)
+	{
+		std::string strName = ctx->Req.title.GetData();
+		CModTools::get_mutable_instance().stopCommonPage(strName);
+		ctx->Answer(ErrorCodeEnum::Error_Succeed);
+	}
+
 	void CChromiumEntity::CloseBrowser(SpReqAnsContext<ChromiumSrv_CloseBrowser_Req, ChromiumSrv_CloseBrowser_Ans>::Pointer ctx)
 	{
 		CSimpleString strType = ctx->Req.type;

+ 4 - 0
Module/mod_chromium/mod_chromium.h

@@ -57,6 +57,8 @@ namespace Chromium {
 		virtual ~ChromiumSession() {}
 		virtual void Handle_OpenBrowser(SpReqAnsContext<ChromiumSrv_OpenBrowser_Req, ChromiumSrv_OpenBrowser_Ans>::Pointer ctx);
 		virtual void Handle_CloseBrowser(SpReqAnsContext<ChromiumSrv_CloseBrowser_Req, ChromiumSrv_CloseBrowser_Ans>::Pointer ctx);
+		virtual void Handle_OpenCommonPage(SpReqAnsContext<ChromiumSrv_OpenCommonPage_Req, ChromiumSrv_OpenCommonPage_Ans>::Pointer ctx);
+		virtual void Handle_CloseCommonPage(SpReqAnsContext<ChromiumSrv_CloseCommonPage_Req, ChromiumSrv_CloseCommonPage_Ans>::Pointer ctx);
 
 	private:
 		CChromiumEntity* m_pEntity;
@@ -81,6 +83,8 @@ namespace Chromium {
 
 		void OpenBrowser(SpReqAnsContext<ChromiumSrv_OpenBrowser_Req, ChromiumSrv_OpenBrowser_Ans>::Pointer ctx);
 		void CloseBrowser(SpReqAnsContext<ChromiumSrv_CloseBrowser_Req, ChromiumSrv_CloseBrowser_Ans>::Pointer ctx);
+		void OpenCommonPage(SpReqAnsContext<ChromiumSrv_OpenCommonPage_Req, ChromiumSrv_OpenCommonPage_Ans>::Pointer ctx);
+		void CloseCommonPage(SpReqAnsContext<ChromiumSrv_CloseCommonPage_Req, ChromiumSrv_CloseCommonPage_Ans>::Pointer ctx);
 
 
 		virtual void OnPaused();

+ 8 - 8
Module/mod_guiconsole/GUIConsole_client_g.h

@@ -695,7 +695,7 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum OpenCommonPage(GUIConsoleService_OpenCommonPage_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	ErrorCodeEnum CloseCommonPage(GUIConsoleService_CloseCommonPage_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
 		CAutoBuffer Buf = SpObject2Buffer(Req);
@@ -705,14 +705,14 @@ public:
 			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
 			m_context = m_context.upgradeLink();
 		}
-		auto ret = pFunc->AsyncRequest(GUIConsoleService_Method_OpenCommonPage, GUIConsoleService_MethodSignature_OpenCommonPage, Buf, spAsyncWait, m_context, dwTimeout);
+		auto ret = pFunc->AsyncRequest(GUIConsoleService_Method_CloseCommonPage, GUIConsoleService_MethodSignature_CloseCommonPage, Buf, spAsyncWait, m_context, dwTimeout);
 		m_context.clear();
 		return ret;
 	}
-	ErrorCodeEnum OpenCommonPage(GUIConsoleService_OpenCommonPage_Req &Req, GUIConsoleService_OpenCommonPage_Ans &Ans, DWORD dwTimeout)
+	ErrorCodeEnum CloseCommonPage(GUIConsoleService_CloseCommonPage_Req &Req, GUIConsoleService_CloseCommonPage_Ans &Ans, DWORD dwTimeout)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = OpenCommonPage(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = CloseCommonPage(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
@@ -720,10 +720,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum OpenCommonPage(GUIConsoleService_OpenCommonPage_Req &Req, GUIConsoleService_OpenCommonPage_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	ErrorCodeEnum CloseCommonPage(GUIConsoleService_CloseCommonPage_Req &Req, GUIConsoleService_CloseCommonPage_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = OpenCommonPage(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = CloseCommonPage(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
@@ -731,10 +731,10 @@ public:
 		}
 		return Error;
 	}
-	ErrorCodeEnum OpenCommonPage(GUIConsoleService_OpenCommonPage_Req &Req, GUIConsoleService_OpenCommonPage_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	ErrorCodeEnum CloseCommonPage(GUIConsoleService_CloseCommonPage_Req &Req, GUIConsoleService_CloseCommonPage_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
 	{
 		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = OpenCommonPage(Req, spAsyncWait, dwTimeout);
+		ErrorCodeEnum Error = CloseCommonPage(Req, spAsyncWait, dwTimeout);
 		if (Error == Error_Succeed) {
 			bool bEnd = false;
 			CSimpleString str;

+ 5 - 5
Module/mod_guiconsole/GUIConsole_def_g.h

@@ -25,7 +25,7 @@ namespace GUIConsole {
 #define GUIConsoleService_Method_GetHelpInformationArr 10
 #define GUIConsoleService_Method_GetHelpDetail 11
 #define GUIConsoleService_Method_OpenCommonPage 12
-#define GUIConsoleService_Method_OpenCommonPage 13
+#define GUIConsoleService_Method_CloseCommonPage 13
 
 #define GUIConsoleService_MethodSignature_OpenLogSender -744778557
 #define GUIConsoleService_MethodSignature_CloseLogSender -1838250527
@@ -40,7 +40,7 @@ namespace GUIConsole {
 #define GUIConsoleService_MethodSignature_GetHelpInformationArr 260508505
 #define GUIConsoleService_MethodSignature_GetHelpDetail -45426198
 #define GUIConsoleService_MethodSignature_OpenCommonPage 15213547
-#define GUIConsoleService_MethodSignature_OpenCommonPage 1932684502
+#define GUIConsoleService_MethodSignature_CloseCommonPage 1463237030
 
 #define GUIConsoleService_LogCode_OpenLogSender "QLR040250800"
 #define GUIConsoleService_LogCode_CloseLogSender "QLR040250801"
@@ -55,7 +55,7 @@ namespace GUIConsole {
 #define GUIConsoleService_LogCode_GetHelpInformationArr "QLR040250810"
 #define GUIConsoleService_LogCode_GetHelpDetail "QLR040250811"
 #define GUIConsoleService_LogCode_OpenCommonPage "QLR040250812"
-#define GUIConsoleService_LogCode_OpenCommonPage "QLR040250813"
+#define GUIConsoleService_LogCode_CloseCommonPage "QLR040250813"
 
 struct GUIConsoleService_OpenLogSender_Req
 {
@@ -401,7 +401,7 @@ struct GUIConsoleService_OpenCommonPage_Ans
 
 };
 
-struct GUIConsoleService_OpenCommonPage_Req
+struct GUIConsoleService_CloseCommonPage_Req
 {
 	CSimpleStringA title;
 
@@ -412,7 +412,7 @@ struct GUIConsoleService_OpenCommonPage_Req
 
 };
 
-struct GUIConsoleService_OpenCommonPage_Ans
+struct GUIConsoleService_CloseCommonPage_Ans
 {
 	bool result;
 	CSimpleStringA additionalMsg;

+ 9 - 9
Module/mod_guiconsole/GUIConsole_server_g.h

@@ -121,8 +121,8 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case GUIConsoleService_Method_OpenCommonPage:
-			if (dwSignature == GUIConsoleService_MethodSignature_OpenCommonPage) {
+		case GUIConsoleService_Method_CloseCommonPage:
+			if (dwSignature == GUIConsoleService_MethodSignature_CloseCommonPage) {
 				bOverlap = true;
 			} else {
 				Error = Error_MethodSignatureFailed;
@@ -204,8 +204,8 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case GUIConsoleService_Method_OpenCommonPage:
-			if (dwSignature != GUIConsoleService_MethodSignature_OpenCommonPage) {
+		case GUIConsoleService_Method_CloseCommonPage:
+			if (dwSignature != GUIConsoleService_MethodSignature_CloseCommonPage) {
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
@@ -281,7 +281,7 @@ public:
 	/// override by user
 	}
 
-	virtual void Handle_OpenCommonPage(SpReqAnsContext<GUIConsoleService_OpenCommonPage_Req, GUIConsoleService_OpenCommonPage_Ans>::Pointer ctx)
+	virtual void Handle_CloseCommonPage(SpReqAnsContext<GUIConsoleService_CloseCommonPage_Req, GUIConsoleService_CloseCommonPage_Ans>::Pointer ctx)
 	{
 	/// override by user
 	}
@@ -432,14 +432,14 @@ public:
 						Handle_OpenCommonPage(ctx);
 					}
 					break;
-				case GUIConsoleService_Method_OpenCommonPage:
+				case GUIConsoleService_Method_CloseCommonPage:
 					{
-						SpReqAnsContext<GUIConsoleService_OpenCommonPage_Req,GUIConsoleService_OpenCommonPage_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<GUIConsoleService_OpenCommonPage_Req,GUIConsoleService_OpenCommonPage_Ans>(pTransactionContext));
+						SpReqAnsContext<GUIConsoleService_CloseCommonPage_Req,GUIConsoleService_CloseCommonPage_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<GUIConsoleService_CloseCommonPage_Req,GUIConsoleService_CloseCommonPage_Ans>(pTransactionContext));
 						SpBuffer2Object(Buf, ctx->Req);
 						pTransactionContext->GetLinkContext(ctx->link);
 						EntityResource::setLink(ctx->link);
-						Handle_OpenCommonPage(ctx);
+						Handle_CloseCommonPage(ctx);
 					}
 					break;
 				default:

+ 2 - 2
Module/mod_guiconsole/GuiConsole.xml

@@ -253,7 +253,7 @@
 				<param name="size" type="string"/>
 				<!-- 页面的位置,如果不传的话则在中心,类型为字符串 -->
 				<param name="point" type="string"/>
-				<!-- 页面的层级,有效参数包含top,topmost, non_topmost, bottom,类型为字符串 -->
+				<!-- 页面的层级,有效参数包含top,topmost, notopmost, bottom,类型为字符串 -->
 				<param name="top" type="string"/>
 			</req>
 			<res>
@@ -264,7 +264,7 @@
 			</res>
 		</twoway>
 		<!-- 定义一个名为CloseCommonPage的双向通信,用于关闭一个页面  -->
-		<twoway name="OpenCommonPage" overlap="true" simpleret="true">
+		<twoway name="CloseCommonPage" overlap="true" simpleret="true">
 			<req>
 				<!-- 标题,页面的名称,类型为字符串 -->
 				<param name="title" type="string"/>

+ 4 - 0
Module/mod_guiconsole/mod_GuiConsole.h

@@ -41,6 +41,10 @@ public:
 	virtual void Handle_GetHelpInformationArr(SpReqAnsContext<GUIConsoleService_GetHelpInformationArr_Req, GUIConsoleService_GetHelpInformationArr_Ans>::Pointer ctx);
 
 	virtual void Handle_GetHelpDetail(SpReqAnsContext<GUIConsoleService_GetHelpDetail_Req, GUIConsoleService_GetHelpDetail_Ans>::Pointer ctx);
+
+	virtual void Handle_OpenCommonPage(SpReqAnsContext<GUIConsoleService_OpenCommonPage_Req, GUIConsoleService_OpenCommonPage_Ans>::Pointer ctx);
+
+	virtual void Handle_CloseCommonPage(SpReqAnsContext<GUIConsoleService_CloseCommonPage_Req, GUIConsoleService_CloseCommonPage_Ans>::Pointer ctx);
 private:
 	CGUIConsoleEntity* m_pEntity;
 };

+ 69 - 0
Module/mod_guiconsole/mod_guiconsole.cpp

@@ -3,6 +3,7 @@
 #include <EventCode.h>
 #include "GUIConsole_msg_g.h"
 #include <chrono>
+#include "..\mod_chromium\Chromium_client_g.h"
 
 bool isPad = false;
 
@@ -577,6 +578,74 @@ void CGUIConsoleSession::Handle_GetHelpDetail(SpReqAnsContext<GUIConsoleService_
 	ctx->Answer(ErrorCodeEnum::Error_Succeed);
 }
 
+void CGUIConsoleSession::Handle_OpenCommonPage(SpReqAnsContext<GUIConsoleService_OpenCommonPage_Req, GUIConsoleService_OpenCommonPage_Ans>::Pointer ctx)
+{
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	
+
+	Chromium::ChromiumSrv_ClientBase* chromiumClient = new Chromium::ChromiumSrv_ClientBase(m_pEntity);
+	ErrorCodeEnum error = chromiumClient->Connect();
+	if (error == Error_Succeed)
+	{
+
+		Chromium::ChromiumSrv_OpenCommonPage_Req req;
+		Chromium::ChromiumSrv_OpenCommonPage_Ans  ans;
+		req.title = ctx->Req.title;
+		req.url = ctx->Req.url;
+		req.size = ctx->Req.size;
+		req.point = ctx->Req.point;
+		req.top = ctx->Req.top;
+
+
+
+		error = (*chromiumClient)(EntityResource::getLink().upgradeLink())->OpenCommonPage(req, ans, 10000);
+		chromiumClient->GetFunction()->CloseSession();
+
+		if (error != Error_Succeed)
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Start common chromium page [%s] failed.", ctx->Req.url.GetData());
+			ctx->Answer(error, error);
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Start common chromium page [%s] success.", ctx->Req.url.GetData());
+			ctx->Answer(ErrorCodeEnum::Error_Succeed);
+		}
+	}
+	else
+		ctx->Answer(ErrorCodeEnum::Error_Unexpect);
+
+}
+
+void CGUIConsoleSession::Handle_CloseCommonPage(SpReqAnsContext<GUIConsoleService_CloseCommonPage_Req, GUIConsoleService_CloseCommonPage_Ans>::Pointer ctx)
+{
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	Chromium::ChromiumSrv_ClientBase* chromiumClient = new Chromium::ChromiumSrv_ClientBase(m_pEntity);
+	ErrorCodeEnum error = chromiumClient->Connect();
+	if (error == Error_Succeed)
+	{
+		Chromium::ChromiumSrv_CloseCommonPage_Req req;
+		Chromium::ChromiumSrv_CloseCommonPage_Ans ans;
+		req.title = ctx->Req.title;
+
+		error = (*chromiumClient)(EntityResource::getLink().upgradeLink())->CloseCommonPage(req, ans, 10000);
+		chromiumClient->GetFunction()->CloseSession();
+
+		if (error != Error_Succeed)
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("close common chromium page [%s] failed.", ctx->Req.title.GetData());
+			ctx->Answer(error, error);
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("close common chromium page [%s] success.", ctx->Req.title.GetData());
+			ctx->Answer(ErrorCodeEnum::Error_Succeed);
+		}
+	}
+	else
+		ctx->Answer(ErrorCodeEnum::Error_Unexpect);
+}
+
 CSimpleString CGUIConsoleEntity::getRunVersion()
 {
 	static CSimpleStringA activeVer;