Fixed Nabi Issues
[apps/osp/Internet.git] / src / IntInternetApp.cpp
index 5a5efd8..be34a5b 100644 (file)
-//\r
-\r
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Flora License, Version 1.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//     http://www.tizenopensource.org/license\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an AS IS BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-\r
-//!Internet\r
-/*@file:       Internet.cpp\r
- *@brief:      provides basic features necessary to define an UiApp.\r
- */\r
-\r
-#include "IntBookmarkData.h"\r
-#include "IntBookmarkPresentationModel.h"\r
-#include "IntCommonLib.h"\r
-#include "IntFaviconManager.h"\r
-#include "IntHistoryPresentationModel.h"\r
-#include "IntInternetApp.h"\r
-#include "IntMainFrame.h"\r
-#include "IntMainForm.h"\r
-#include "IntMultipleWindowPresentationModel.h"\r
-#include "IntSceneRegister.h"\r
-#include "IntSettingPresentationModel.h"\r
-\r
-using namespace Tizen::App;\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Base::Collection;\r
-using namespace Tizen::System;\r
-using namespace Tizen::Ui;\r
-using namespace Tizen::Ui::Controls;\r
-using namespace Tizen::Ui::Scenes;\r
-\r
-InternetApp::InternetApp(void)\r
-: __pMultiWindowManager(NULL),__pNewWindowInfo(null)\r
-{\r
-\r
-}\r
-\r
-InternetApp::~InternetApp(void)\r
-{\r
-       if (__pNewWindowInfo != NULL)\r
-       {\r
-               delete __pNewWindowInfo;\r
-               __pNewWindowInfo = NULL;\r
-       }\r
-}\r
-\r
-UiApp*\r
-InternetApp::CreateInstance(void)\r
-{\r
-       // Create the instance through the constructor.\r
-       return new(std::nothrow) InternetApp();\r
-}\r
-\r
-void\r
-InternetApp::ShowPopup(String& pTitle, String& pText)\r
-{\r
-       MessageBox messageBox;\r
-       messageBox.Construct(pTitle, pText,MSGBOX_STYLE_OK,3000);\r
-       int modalResult = 0;\r
-\r
-       messageBox.ShowAndWait(modalResult);\r
-       switch (modalResult)\r
-       {\r
-       case MSGBOX_RESULT_OK:\r
-       {\r
-\r
-       }\r
-       break;\r
-       default:\r
-               break;\r
-       }\r
-}\r
-\r
-bool\r
-InternetApp::OnAppInitializing(AppRegistry& appRegistry)\r
-{\r
-       AppLog("ABC::Internet::OnAppInitializing entered");\r
-       AppControlProviderManager* pAppMgr = AppControlProviderManager::GetInstance();\r
-       if (pAppMgr != null)\r
-       {\r
-               result r = pAppMgr->SetAppControlProviderEventListener(this);\r
-               AppLogDebug("SetAppControlProviderEventListener result %s",GetErrorMessage(r));\r
-       }\r
-       return true;\r
-}\r
-\r
-bool\r
-InternetApp::OnAppInitialized(void)\r
-{\r
-       result r = E_SUCCESS;\r
-\r
-       String title1 = L"URL1";\r
-       String title2 = L"URL2";\r
-       String folder1 = L"Folder 1";\r
-       String strSite1 = "Site 1";\r
-\r
-       BookmarkPresentationModel::GetInstance();\r
-       HistoryPresentationModel::GetInstance();\r
-       FaviconManager::GetInstance();\r
-       SettingPresentationModel::GetInstance();\r
-\r
-//     MultipleWindowPresentationModel::GetInstance();\r
-\r
-       __pMultiWindowManager = MultipleWindowPresentationModel::GetInstance();\r
-       AppLogDebug("window count %d",__pMultiWindowManager->GetAllWindowArrayList()->GetCount());\r
-\r
-       // Goto the first scene.\r
-       SceneManager* pSceneManager = SceneManager::GetInstance();\r
-       if (pSceneManager == null)\r
-       {\r
-               AppLogDebug("pSceneManager is null returning");\r
-               return false;\r
-       }\r
-       // Create a Frame\r
-       MainFrame* pSceneManagementFrame = new(std::nothrow) MainFrame();\r
-       pSceneManagementFrame->Construct();\r
-       pSceneManagementFrame->SetName(L"SceneManagement");\r
-       AddFrame(*pSceneManagementFrame);\r
-\r
-       String homePage = SettingPresentationModel::GetInstance()->GetHomepage();\r
-       if (homePage == (L"IDS_BR_BODY_MOST_VISITED_SITES") || homePage == (L"IDS_BR_BODY_BLANK_PAGE"))\r
-       {\r
-               homePage = L"";\r
-       }\r
-       else if (homePage == CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"))\r
-       {\r
-               AppLog("InternetApp::OnAppInitialized homaepage = userhomepage");\r
-               homePage = SettingPresentationModel::GetInstance()->GetFavoriteUrl();\r
-               AppLog("InternetApp::OnAppInitialized fav URL = %ls ",homePage.GetPointer());\r
-       }\r
-\r
-       if (__pNewWindowInfo == null)//if the application is launched normally\r
-       {\r
-               __pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewScene(homePage);\r
-       }\r
-\r
-       if (__pNewWindowInfo == null)\r
-       {\r
-               return false;\r
-       }\r
-\r
-       ArrayList* pArgList = new(std::nothrow) ArrayList();\r
-       pArgList->Construct();\r
-       pArgList->Add(*__pNewWindowInfo);\r
-       /*\r
-        * The GoForward call cannot be moved into the MainFrame::OnInitializing\r
-        * because when the application is launched from the appcontol, the data(URL)\r
-        * is not available for Mainframe, and we cannot pass the url information to\r
-        * the Mainframe because logically MainFrame should not know the URL information.\r
-        */\r
-       if (E_SUCCESS != pSceneManager->GoForward(ForwardSceneTransition(__pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList))\r
-       {\r
-               AppLogDebug("CustomAppControl::OnAppInitializing Result = %s", GetLastResult());\r
-               delete pArgList;\r
-               __pNewWindowInfo = null;\r
-               return false;\r
-       }\r
-\r
-       delete pArgList;\r
-       pArgList = null;\r
-       __pNewWindowInfo = null;\r
-\r
-       return true;\r
-}\r
-\r
-bool\r
-InternetApp::OnAppWillTerminate(void)\r
-{\r
-       return true;\r
-}\r
-\r
-\r
-bool\r
-InternetApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)\r
-{\r
-       AppLogDebug("Internet::OnAppTerminating");\r
-\r
-       return true;\r
-}\r
-\r
-void\r
-InternetApp::OnForeground(void)\r
-{\r
-\r
-}\r
-\r
-void\r
-InternetApp::OnBackground(void)\r
-{\r
-\r
-}\r
-\r
-void\r
-InternetApp::OnLowMemory(void)\r
-{\r
-\r
-}\r
-\r
-void\r
-InternetApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)\r
-{\r
-\r
-}\r
-\r
-void\r
-InternetApp::OnScreenOn(void)\r
-{\r
-\r
-}\r
-\r
-void\r
-InternetApp::OnScreenOff(void)\r
-{\r
-       // TODO:\r
-       // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device\r
-       // to enter the sleep mode to save the battery.\r
-       // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a\r
-       // callback before the device enters the sleep mode.\r
-       // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one.\r
-}\r
-void\r
-InternetApp::OnAppControlRequestReceived(RequestId reqId, const String &operationId, const String* pUriScheme, const String *pDataType, const IMap *pArgs)\r
-{\r
-       AppLogDebug("ABC::Internet::OnAppControlRequestReceivedN entered %ls",operationId.GetPointer());\r
-\r
-       if (operationId.CompareTo(L"http://tizen.org/appcontrol/operation/view") == 0)\r
-       {\r
-               String urlData;\r
-               if (pUriScheme)\r
-               {\r
-                       urlData = *pUriScheme;\r
-               }\r
-               else\r
-               {\r
-                       int argCount = pArgs->GetCount();\r
-                       AppLog("argCount == %d", argCount);\r
-\r
-                       IList *pValues = pArgs->GetValuesN();\r
-                       if(pValues == null)\r
-                       {\r
-                               AppLog("pValues == null");\r
-                               return;\r
-                       }\r
-\r
-                       String url = L"url";\r
-                       String* pUrl = dynamic_cast<String*>(const_cast<Object*>(pArgs->GetValue(url)));\r
-                       if(pUrl == null)\r
-                       {\r
-                               delete pValues;\r
-                               AppLog("pUrl == null");\r
-                               return;\r
-                       }\r
-                       urlData = *pUrl;\r
-               }\r
-               AppLog("URL received %ls", urlData.GetPointer());\r
-\r
-               if (__pNewWindowInfo == null)\r
-               {\r
-                       __pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewScene(urlData, true);\r
-               }\r
-               if (__pNewWindowInfo == null)\r
-               {\r
-                       if (MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9)\r
-                       {\r
-                               String strTitle = L"Maximum Limit Reached";\r
-                               String strText = L"cannot open more than 9 windows";\r
-                               ShowPopup(strTitle, strText);\r
-                       }\r
-                       return;\r
-               }\r
-               if (__pMultiWindowManager != null && __pMultiWindowManager->GetAllWindowArrayList()->GetCount() != 0)\r
-               {\r
-                       //if the application is running in background and it receives an appcontrol request it will launch a new(std::nothrow) window here,\r
-                       //otherwise appcontrol request will be handled by OnAppInitialized method\r
-                       SceneManager* pSceneManager = SceneManager::GetInstance();\r
-                       if (pSceneManager == null)\r
-                       {\r
-                               return;\r
-                       }\r
-\r
-                       ArrayList* pArgList = new(std::nothrow) ArrayList();\r
-                       pArgList->Construct();\r
-                       pArgList->Add(*__pNewWindowInfo);\r
-\r
-                       if (E_SUCCESS != pSceneManager->GoForward(ForwardSceneTransition(__pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList))\r
-                       {\r
-                               AppLogDebug("CustomAppControl::OnAppInitializing Result = %s", GetLastResult());\r
-                                               delete pArgList;\r
-                               __pNewWindowInfo = null;\r
-                               return;\r
-                       }\r
-\r
-                       delete pArgList;\r
-\r
-                       __pNewWindowInfo = null;\r
-               }\r
-       }\r
-       AppLogDebug("ABC::Internet::OnAppControlRequestReceivedN Exit");\r
-       return;\r
-}\r
-\r
+//
+
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.1 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+//!Internet
+/*@file:       Internet.cpp
+ *@brief:      provides basic features necessary to define an UiApp.
+ */
+
+#include "IntBookmarkData.h"
+#include "IntBookmarkPresentationModel.h"
+#include "IntCommonLib.h"
+#include "IntFaviconManager.h"
+#include "IntHistoryPresentationModel.h"
+#include "IntInternetApp.h"
+#include "IntMainFrame.h"
+#include "IntMainForm.h"
+#include "IntMultipleWindowPresentationModel.h"
+#include "IntSceneRegister.h"
+#include "IntSettingPresentationModel.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+static const wchar_t* APPCONTROL_SELECT_KEY_IMAGE = L"http://tizen.org/appcontrol/data/image/crop_mode";
+static const wchar_t* APPCONTROL_SELECT_VALUE_IMAGE = L"fit_to_screen";
+static const wchar_t* APPCONTROL_PROVIDER_ID_IMAGE_VIEWER = L"tizen.imageviewer";
+static const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_VIEWER = L"http://tizen.org/appcontrol/operation/view";
+const int MIN_MEMORY_NEEDED = 1048576;
+
+InternetApp::InternetApp(void)
+: __pMultiWindowManager(NULL),__pNewWindowInfo(null),pSceneManagementFrame(null)
+{
+}
+
+InternetApp::~InternetApp(void)
+{
+       if (__pNewWindowInfo != NULL)
+       {
+               delete __pNewWindowInfo;
+               __pNewWindowInfo = NULL;
+       }
+}
+
+UiApp*
+InternetApp::CreateInstance(void)
+{
+       // Create the instance through the constructor.
+       return new(std::nothrow) InternetApp();
+}
+
+void
+InternetApp::ShowPopup(String& pTitle, String& pText)
+{
+       MessageBox messageBox;
+       messageBox.Construct(pTitle, pText,MSGBOX_STYLE_OK,3000);
+       int modalResult = 0;
+
+       messageBox.ShowAndWait(modalResult);
+       switch (modalResult)
+       {
+       case MSGBOX_RESULT_OK:
+       {
+
+       }
+       break;
+       default:
+               break;
+       }
+}
+
+bool
+InternetApp::OnAppInitializing(AppRegistry& appRegistry)
+{
+       AppLog("ABC::Internet::OnAppInitializing entered");
+       AppControlProviderManager* pAppMgr = AppControlProviderManager::GetInstance();
+       if (pAppMgr != null)
+       {
+               result r = pAppMgr->SetAppControlProviderEventListener(this);
+               AppLogDebug("SetAppControlProviderEventListener result %s",GetErrorMessage(r));
+       }
+       return true;
+}
+
+bool
+InternetApp::OnAppInitialized(void)
+{
+       result r = E_SUCCESS;
+
+       long long mem = GetAvailableMemory();
+       AppLogDebug("%lld",mem);
+       if(mem < MIN_MEMORY_NEEDED)
+       {
+               MessageBox LowMemory;
+               String msg = L"";
+               LowMemory.Construct(CommonUtil::GetString(L"IDS_LOW_MEMORY_MSG_TITLE"), CommonUtil::GetString(L"IDS_LOW_MEMORY_MSG"), MSGBOX_STYLE_NONE,1000);
+               int modalResult = 0;
+               // Calls ShowAndWait() : Draws and Shows itself and processes events
+               LowMemory.ShowAndWait(modalResult);
+
+               return false;
+
+       }
+       String title1 = L"URL1";
+       String title2 = L"URL2";
+       String folder1 = L"Folder 1";
+       String strSite1 = "Site 1";
+
+       BookmarkPresentationModel::GetInstance();
+       HistoryPresentationModel::GetInstance();
+       FaviconManager::GetInstance();
+       SettingPresentationModel::GetInstance();
+
+//     MultipleWindowPresentationModel::GetInstance();
+
+       SettingInfo::AddSettingEventListener(*this);
+       __pMultiWindowManager = MultipleWindowPresentationModel::GetInstance();
+       AppLogDebug("window count %d",__pMultiWindowManager->GetAllWindowArrayList()->GetCount());
+
+
+
+       // Create a Frame
+       pSceneManagementFrame = new(std::nothrow) MainFrame();
+       pSceneManagementFrame->Construct();
+       pSceneManagementFrame->SetName(L"SceneManagement");
+       AddFrame(*pSceneManagementFrame);
+       pSceneManagementFrame->Show();
+       // Goto the first scene.
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       if (pSceneManager == null)
+       {
+               AppLogDebug("pSceneManager is null returning");
+               return false;
+       }
+
+       String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
+       if (homePage == (L"IDS_BR_BODY_MOST_VISITED_SITES") || homePage == (L"IDS_BR_BODY_BLANK_PAGE"))
+       {
+               homePage = L"";
+       }
+       else if (homePage == CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"))
+       {
+               AppLog("InternetApp::OnAppInitialized homaepage = userhomepage");
+               homePage = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
+               AppLog("InternetApp::OnAppInitialized fav URL = %ls ",homePage.GetPointer());
+       }
+
+       if (__pNewWindowInfo == null)//if the application is launched normally
+       {
+               __pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN(homePage);
+       }
+
+       if (__pNewWindowInfo == null)
+       {
+               return false;
+       }
+
+       ArrayList* pArgList = new(std::nothrow) ArrayList();
+       pArgList->Construct();
+       pArgList->Add(*__pNewWindowInfo);
+       /*
+        * The GoForward call cannot be moved into the MainFrame::OnInitializing
+        * because when the application is launched from the appcontol, the data(URL)
+        * is not available for Mainframe, and we cannot pass the url information to
+        * the Mainframe because logically MainFrame should not know the URL information.
+        */
+       if (E_SUCCESS != pSceneManager->GoForward(ForwardSceneTransition(__pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList))
+       {
+               AppLogDebug("CustomAppControl::OnAppInitializing Result = %s", GetLastResult());
+               delete pArgList;
+               __pNewWindowInfo = null;
+               return false;
+       }
+
+       delete pArgList;
+       pArgList = null;
+       __pNewWindowInfo = null;
+
+       return true;
+}
+
+bool
+InternetApp::OnAppWillTerminate(void)
+{
+       return true;
+}
+
+
+bool
+InternetApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+{
+       AppLogDebug("Internet::OnAppTerminating");
+
+       SettingInfo::RemoveSettingEventListener(*this);
+
+       return true;
+}
+
+void
+InternetApp::OnForeground(void)
+{
+       AppLog("InternetApp::OnForeground");
+
+       AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry();
+       String sliderKey("SliderValue");
+
+       int sliderValue = 0;
+
+
+       result r = pAppRegistry->Get(sliderKey, sliderValue);
+       r = PowerManager::SetScreenBrightness(sliderValue);
+//     r = PowerManager::RestoreScreenBrightness();
+
+       AppLog("Settingscreenbrightness to %d result %s",sliderValue , GetErrorMessage(r));
+
+
+       Form* pCurrentForm = (SceneManager::GetInstance()->GetCurrentScene()->GetForm());
+       if (pCurrentForm)
+       {
+               pCurrentForm->SendUserEvent(FORE_GROUND_APP_EVENT, NULL);
+       }
+}
+
+void
+InternetApp::OnBackground(void)
+{
+       Form* pCurrentForm = (SceneManager::GetInstance()->GetCurrentScene()->GetForm());
+       if(pCurrentForm)
+       {
+               pCurrentForm->SendUserEvent(BACK_GROUND_APP_EVENT, NULL);
+       }
+}
+
+void
+InternetApp::OnLowMemory(void)
+{
+
+}
+
+void
+InternetApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)
+{
+
+}
+
+void
+InternetApp::OnScreenOn(void)
+{
+
+}
+
+void
+InternetApp::OnScreenOff(void)
+{
+       // TODO:
+       // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device
+       // to enter the sleep mode to save the battery.
+       // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a
+       // callback before the device enters the sleep mode.
+       // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one.
+}
+
+void
+InternetApp::OnSettingChanged(Tizen::Base::String& key)
+{
+       AppLog("InternetApp::OnSettingChanged: %ls", key.GetPointer());
+       if (key == L"http://tizen.org/setting/locale.language" || key == L"http://tizen.org/setting/font.size")
+       {
+               Terminate();
+       }
+}
+
+void
+InternetApp::OnAppControlRequestReceived(RequestId reqId, const String &operationId, const String* pUriScheme, const String *pDataType, const IMap *pArgs)
+{
+       AppLogDebug("ABC::Internet::OnAppControlRequestReceivedN entered %ls",operationId.GetPointer());
+
+       if (operationId.CompareTo(L"http://tizen.org/appcontrol/operation/view") == 0)
+       {
+               String urlData;
+               if (pUriScheme)
+               {
+                       urlData = *pUriScheme;
+               }
+               else
+               {
+                       int argCount = pArgs->GetCount();
+                       AppLog("argCount == %d", argCount);
+
+                       IList *pValues = pArgs->GetValuesN();
+                       if(pValues == null)
+                       {
+                               AppLog("pValues == null");
+                               return;
+                       }
+
+                       String url = L"url";
+                       String* pUrl = dynamic_cast<String*>(const_cast<Object*>(pArgs->GetValue(url)));
+                       if(pUrl == null)
+                       {
+                               delete pValues;
+                               AppLog("pUrl == null");
+                               return;
+                       }
+                       urlData = *pUrl;
+               }
+               AppLog("URL received %ls", urlData.GetPointer());
+               if(pSceneManagementFrame)
+                       pSceneManagementFrame->Show();
+
+               if (__pNewWindowInfo == null)
+               {
+                       __pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN(urlData, true);
+               }
+               if (__pNewWindowInfo == null)
+               {
+                       if (MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9)
+                       {
+                               String strTitle = L"";//CommonUtil::GetString(L"IDS_COM_SK_MAX_LIMIT_REACHED");
+                               String strText = CommonUtil::GetString(L"IDS_BR_BODY_COULD_NOT_OPEN_NEW_WINDOW_BECAUSE_YOU_HAVE_ALREADY_OPENED_MAXIMUM_NUMBER");
+                               ShowPopup(strTitle, strText);
+                       }
+                       return;
+               }
+               if (__pMultiWindowManager != null && __pMultiWindowManager->GetAllWindowArrayList()->GetCount() != 0)
+               {
+                       //if the application is running in background and it receives an appcontrol request it will launch a new(std::nothrow) window here,
+                       //otherwise appcontrol request will be handled by OnAppInitialized method
+                       SceneManager* pSceneManager = SceneManager::GetInstance();
+                       if (pSceneManager == null)
+                       {
+                               return;
+                       }
+
+                       ArrayList* pArgList = new(std::nothrow) ArrayList();
+                       pArgList->Construct();
+                       pArgList->Add(*__pNewWindowInfo);
+
+                       if (E_SUCCESS != pSceneManager->GoForward(ForwardSceneTransition(__pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList))
+                       {
+                               AppLogDebug("CustomAppControl::OnAppInitializing Result = %s", GetLastResult());
+                                               delete pArgList;
+                               __pNewWindowInfo = null;
+                               return;
+                       }
+
+                       delete pArgList;
+
+                       __pNewWindowInfo = null;
+               }
+       }
+       else if (operationId.CompareTo(L"http://tizen.org/appcontrol/operation/main") == 0)
+       {
+               if (pArgs)
+               {
+                       const String* pVal = (String *) pArgs->GetValue(String(L"http://tizen.org/appcontrol/data/notification"));
+                       if (pVal && pVal->GetLength() > 0)
+                       {
+                               HashMap extraData;
+                               extraData.Construct();
+                               String typeKey = APPCONTROL_SELECT_KEY_IMAGE;
+                               String typeVal = APPCONTROL_SELECT_VALUE_IMAGE;
+                               extraData.Add(&typeKey, &typeVal);
+
+                               AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_PROVIDER_ID_IMAGE_VIEWER,
+                                               APPCONTROL_OPERATION_ID_IMAGE_VIEWER);
+                               if (pAc)
+                               {
+                                       if (pAc->Start(pVal, null, null, null) == E_SUCCESS)
+                                       {
+                                               delete pAc;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       AppLogDebug("ABC::Internet::OnAppControlRequestReceivedN Exit");
+       return;
+}
+
+
+long long
+InternetApp::GetAvailableMemory(void)
+{
+    result r = E_SUCCESS;
+
+    String key(L"http://tizen.org/runtime/storage.available.internal");
+    long long allocatedMemory = 0;
+
+    r = RuntimeInfo::GetValue(key, allocatedMemory);
+    TryCatch(r == E_SUCCESS, , "MyRuntimeInfo: Failed to get value");
+
+    return allocatedMemory;
+
+   CATCH:
+    return 0;
+}
+