[appwidget-service] Remove Open Service Platform words
[platform/framework/native/appwidget-service.git] / src / FShell_AppWidgetPopupContext.cpp
index 064ef12..ab5f146 100644 (file)
@@ -1,12 +1,11 @@
 //
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Apache License, Version 2.0 (the License);
+// 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://www.apache.org/licenses/LICENSE-2.0
+//     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,
@@ -32,6 +31,7 @@
 #include <FApp_AppControlManager.h>
 
 #include "FShell_AppWidgetManagerService.h"
+#include "FShell_AppWidgetContext.h"
 #include "FShell_AppWidgetPopupContext.h"
 
 namespace Tizen { namespace Shell  { namespace App
@@ -45,36 +45,31 @@ const char APPWIDGET_POPUP_ON_CREATE[] = "http://tizen.org/appcontrol/appwidgetp
 const char APPWIDGET_POPUP_ON_DESTROY[] = "http://tizen.org/appcontrol/appwidgetpopup/destroy";
 const char APPWIDGET_POPUP_ON_TOUCH[] = "http://tizen.org/appcontrol/appwidgetpopup/touch";
 
-const String ARG_KEY_X = L"_X";
-const String ARG_KEY_Y = L"_Y";
-const String ARG_KEY_WIDTH = L"_Width";
-const String ARG_KEY_HEIGHT = L"_Height";
 
-
-_AppWidgetPopupContext::_AppWidgetPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority)
+_AppWidgetPopupContext::_AppWidgetPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority, _AppWidgetContext* pParent)
 :_AppWidgetContextBase(TYPE_PD, info, appId, instanceId, width, height, priority)
 {
-       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
+       __pParent = pParent;
+       SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
 }
 
 _AppWidgetPopupContext::~_AppWidgetPopupContext()
 {
-       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
-       ReleaseSharedMem();
+       SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
 }
 
 
 void
 _AppWidgetPopupContext::OnPopupCreated(double x, double y, int width, int height)
 {
-       SysLog(NID_APP, "width(%d), height(%d)", width, height);
+       SysLog(NID_SHELL, "width(%d), height(%d)", width, height);
        SendPopupCreateRequest(x, y, width, height);
 }
 
 void
 _AppWidgetPopupContext::OnPopupDestoyed()
 {
-       SysLog(NID_APP, "");
+       SysLog(NID_SHELL, "");
        SendPopupDestroyRequest();
 }
 
@@ -85,8 +80,8 @@ _AppWidgetPopupContext::SendPopupCreateRequest(double x, double y, int width, in
 
        pArgs->Add(new String(ARG_KEY_X), new String(Double::ToString(x)));
        pArgs->Add(new String(ARG_KEY_Y), new String(Double::ToString(y)));
-       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
-       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
+       pArgs->Add(new String(ARG_KEY_POPUP_WIDTH), new String(Integer::ToString(width)));
+       pArgs->Add(new String(ARG_KEY_POPUP_HEIGHT), new String(Integer::ToString(height)));
 
        return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_CREATE, pArgs.get());
 }
@@ -102,7 +97,7 @@ _AppWidgetPopupContext::SendPopupDestroyRequest()
 result
 _AppWidgetPopupContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
 {
-       SysLog(NID_APP, "");
+       SysLog(NID_SHELL, "");
        /*if( HasValidClientId() == false )
        {
                std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
@@ -131,11 +126,25 @@ _AppWidgetPopupContext::RequestUpdateRemote()
        std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
 
        int ret = provider_send_desc_updated(packageName.get(), id.get(), null);
-       SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
+       SysTryReturnResult(NID_SHELL, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
 
-       SysLog(NID_APP, "Done");
+       SysLog(NID_SHELL, "Done");
        return E_SUCCESS;
 }
 
+Tizen::Base::Collection::HashMap*
+_AppWidgetPopupContext::CreateRequestArgs(void)
+{
+       HashMap* pArgs = new (std::nothrow) HashMap(SingleObjectDeleter);
+       pArgs->Construct();
+       pArgs->Add(new String(ARG_KEY_INSTANCE_ID), new String(__instanceId));
+       pArgs->Add(new String(ARG_KEY_PROVIDER_NAME), new String(__providerName));
+       pArgs->Add(new String(ARG_KEY_USER_INFO), new String(__userInfo));
+       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(__pParent->__width)));
+       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(__pParent->__height)));
+
+       return pArgs;
+}
+
 } } } // Tizen::Shell::App {