+MainForm::OnWebWindowCloseRequested(Tizen::Web::Controls::Web& source)
+{
+ AppLog("OnWebWindowCloseRequested");
+ ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ WindowInfo* pWindowInfo = null;
+ WindowInfo* pNewWindowInfo = null;
+ int totalCount = 0;
+ UiApp* pApp = null;
+ result r = E_FAILURE;
+
+ if (pAllWindowList != null)
+ {
+ totalCount = pAllWindowList->GetCount();
+ }
+
+ for (int count = 0; count < totalCount; count++)
+ {
+ pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
+
+ if (__pWindowInfo != null && pWindowInfo != null && __pWindowInfo->sceneID == pWindowInfo->sceneID)
+ {
+ r = SceneRegister::DestroyAndUnRegisterScene(__pWindowInfo->sceneID);
+ r = pAllWindowList->RemoveAt(count, true);
+
+ Form* pCurrentForm = null;
+ if(SceneManager::GetInstance()->GetCurrentScene() != null)
+ pCurrentForm = (SceneManager::GetInstance()->GetCurrentScene()->GetForm());
+ if (pCurrentForm)
+ {
+ pCurrentForm->SendUserEvent(UPDATE_MAINFORM_FOOTER_ON_WINDOWCLOSED, null);
+ }
+
+ if (pAllWindowList->GetCount() > 0)
+ {
+ pNewWindowInfo = null;
+ pNewWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
+ }
+ else
+ {
+ WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
+
+ if (pNewWindowInfo == null)
+ {
+ return;
+ }
+ result r = E_SUCCESS;
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ if (pSceneManager == NULL)
+ {
+ return;
+ }
+ ArrayList* pArgList = new(std::nothrow) ArrayList();
+ if (pArgList == NULL)
+ {
+ return;
+ }
+ r = pArgList->Construct();
+ if (r == E_SUCCESS)
+ {
+ pArgList->Add(*pNewWindowInfo);
+ result r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
+ if (pArgList != null)
+ {
+ delete pArgList;
+ pArgList = null;
+ }
+ if(IsFailed(r))
+ {
+ AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r));
+ return;
+ }
+ }
+
+ pApp = UiApp::GetInstance();
+ if (pApp != null)
+ {
+ r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+ return;
+ }
+ }
+ if(pNewWindowInfo)
+ r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
+
+ break;
+ }
+
+ }
+
+
+}
+
+void