From 8305070df928b1b7e89f80a5f876dce5aa539be3 Mon Sep 17 00:00:00 2001 From: "jungmin76.park" Date: Wed, 26 Dec 2012 20:33:35 +0900 Subject: [PATCH] apply ACR result Change-Id: I99d22c4a3a5b7b9bcef34e039505b9865ab39ca4 Signed-off-by: jungmin76.park --- inc/FShellIILiveboxAddRequestListener.h | 68 +++ inc/FShellILiveboxPopupProviderFactory.h | 3 +- inc/FShellILiveboxProviderFactory.h | 7 +- inc/FShellLivebox.h | 42 -- inc/FShellLiveboxFrame.h | 2 +- inc/FShellLiveboxManager.h | 199 ++------- inc/FShellLiveboxPopupProvider.h | 73 ++-- inc/FShellLiveboxProvider.h | 98 ++--- inc/FShellLiveboxProviderInfo.h | 72 ++-- inc/FShellLiveboxProviderManager.h | 187 ++++++++ inc/FShellLiveboxSizeInfo.h | 49 +-- packaging/osp-shell.spec | 2 +- src/CMakeLists.txt | 2 + src/FShellLiveboxManager.cpp | 145 +------ src/FShellLiveboxPopupProvider.cpp | 8 +- src/FShellLiveboxProvider.cpp | 8 +- src/FShellLiveboxProviderInfo.cpp | 4 +- src/FShellLiveboxProviderManager.cpp | 120 ++++++ src/FShell_LiveboxLayer.cpp | 10 +- src/FShell_LiveboxManagerImpl.cpp | 507 ++-------------------- src/FShell_LiveboxManagerProxy.cpp | 6 +- src/FShell_LiveboxPopup.cpp | 10 +- src/FShell_LiveboxProviderImpl.cpp | 3 +- src/FShell_LiveboxProviderInfoImpl.cpp | 7 +- src/FShell_LiveboxProviderManagerImpl.cpp | 648 ++++++++++++++++++++++++++++ src/inc/FShell_LiveboxManagerImpl.h | 73 +--- src/inc/FShell_LiveboxProviderInfoImpl.h | 6 +- src/inc/FShell_LiveboxProviderManagerImpl.h | 118 +++++ 28 files changed, 1422 insertions(+), 1055 deletions(-) create mode 100644 inc/FShellIILiveboxAddRequestListener.h delete mode 100644 inc/FShellLivebox.h mode change 100644 => 100755 inc/FShellLiveboxPopupProvider.h mode change 100644 => 100755 inc/FShellLiveboxProviderInfo.h create mode 100755 inc/FShellLiveboxProviderManager.h mode change 100644 => 100755 inc/FShellLiveboxSizeInfo.h create mode 100644 src/FShellLiveboxProviderManager.cpp create mode 100644 src/FShell_LiveboxProviderManagerImpl.cpp create mode 100644 src/inc/FShell_LiveboxProviderManagerImpl.h diff --git a/inc/FShellIILiveboxAddRequestListener.h b/inc/FShellIILiveboxAddRequestListener.h new file mode 100644 index 0000000..2036408 --- /dev/null +++ b/inc/FShellIILiveboxAddRequestListener.h @@ -0,0 +1,68 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (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 +// +// 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. +// + +/** + * @file FShellIILiveboxAddRequestListener.h + * @brief This is the header file for the %ILiveboxAddRequestListener interface. + * + * This header file contains the declarations of the %ILiveboxAddRequestListener interface. + */ + +#ifndef _FSHELL_ILIVEBOX_ADD_REQUEST_LISTENER_H_ +#define _FSHELL_ILIVEBOX_ADD_REQUEST_LISTENER_H_ + +#include +#include + +namespace Tizen { namespace Shell +{ + +/** + * @interface ILiveboxAddRequestListener + * @brief This interface defines a listener for a Livebox viewer(eg, Home screen, Lock screen) that receives request to add Livebox + * + * @since 2.1 + * + * The %ILiveboxAddRequestListener interface defines a listener for a Livebox viewer(eg, Home screen, Lock screen) that receives request to add Livebox + */ +class _OSP_EXPORT_ ILiveboxAddRequestListener +{ +public: + /** + * This polymorphic destructor should be overridden if required. + * This way, the destructors of the derived classes are called when the destructor of this interface is called. + * + * @since 2.1 + */ + virtual ~ILiveboxAddRequestListener() {} + + /** + * Called when requested to add a Livebox @n + * The Livebox viewer application such as the Home screen can get callback request to add a Livebox by implementing this listener. @n + * + * @param[in] appId The application ID of the application providing Livebox + * @param[in] providerName The name of Livebox provider to be added + * @param[in] text Alternative text for the Livebox + * @param[in] userInfo User information for the Livebox provider + * @see LiveboxManager::AddLivebox() + */ + virtual void OnLiveboxAddRequested(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) = 0; +}; + +}} // Tizen::Shell + +#endif /* _FSHELL_ILIVEBOX_ADD_REQUEST_LISTENER_H_ */ diff --git a/inc/FShellILiveboxPopupProviderFactory.h b/inc/FShellILiveboxPopupProviderFactory.h index f15a727..127bc2e 100644 --- a/inc/FShellILiveboxPopupProviderFactory.h +++ b/inc/FShellILiveboxPopupProviderFactory.h @@ -25,12 +25,13 @@ #define _FSHELL_ILIVEBOX_POPUP_PROVIDER_FACTORY_H_ #include -#include #include namespace Tizen { namespace Shell { +class LiveboxPopupProvider; + /** * @interface ILiveboxPopupProviderFactory * @brief This interface defines the factory for the %LiveboxPopupProvider creation diff --git a/inc/FShellILiveboxProviderFactory.h b/inc/FShellILiveboxProviderFactory.h index a21f6df..ad87c16 100644 --- a/inc/FShellILiveboxProviderFactory.h +++ b/inc/FShellILiveboxProviderFactory.h @@ -26,11 +26,12 @@ #define _FSHELL_ILIVEBOX_PROVIDER_FACTORY_H_ #include -#include namespace Tizen { namespace Shell { +class LiveboxProvider; + /** * @interface ILiveboxProviderFactory * @brief This interface defines the factory for the %LiveboxProvider creation @@ -60,12 +61,12 @@ public: * * @since 2.1 * - * @param[in] name The Livebox provider name + * @param[in] providerName The Livebox provider name * @param[in] width The width of the Livebox * @param[in] height The height of the Livebox * @param[in] userInfo User information that specifed when the Livebox is added */ - virtual LiveboxProvider* CreateInstance(const Tizen::Base::String& name, int width, int height, const Tizen::Base::String& userInfo) = 0; + virtual LiveboxProvider* CreateInstance(const Tizen::Base::String& providerName, int width, int height, const Tizen::Base::String& userInfo) = 0; protected: // diff --git a/inc/FShellLivebox.h b/inc/FShellLivebox.h deleted file mode 100644 index 0270faf..0000000 --- a/inc/FShellLivebox.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// Open Service Platform -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// Licensed under the Apache License, Version 2.0 (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 -// -// 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. -// - -/** - * @file FShell.h - * @brief This is the header file for the %Shell namespace. - * - * This header file contains the declarations of the %Shell namespace. - */ - -#ifndef _FSHELL_LIVEBOX_H_ -#define _FSHELL_LIVEBOX_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Tizen { namespace Shell -{ - -} } // Tizen::Shell - -#endif // _FSHELL_LIVEBOX_H_ diff --git a/inc/FShellLiveboxFrame.h b/inc/FShellLiveboxFrame.h index 5402ce0..9ed0c59 100644 --- a/inc/FShellLiveboxFrame.h +++ b/inc/FShellLiveboxFrame.h @@ -73,7 +73,7 @@ public: * * @since 2.1 * @return An error code - * @param[in] layout The layout for both the portrait and landscape mode + * @param[in] layout The layout for both the portrait and landscape mode * @param[in] size The new width and height * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. diff --git a/inc/FShellLiveboxManager.h b/inc/FShellLiveboxManager.h index 32e65f7..25036f4 100755 --- a/inc/FShellLiveboxManager.h +++ b/inc/FShellLiveboxManager.h @@ -25,60 +25,26 @@ #ifndef _FSHELL_LIVEBOX_MANAGER_H_ #define _FSHELL_LIVEBOX_MANAGER_H_ +#include #include #include -#include -#include -#include -#include +#include namespace Tizen { namespace Base { namespace Collection { class IList; } } } namespace Tizen { namespace Shell { -/** - * @interface ILiveboxRequestEventListener - * @brief This interface defines a listener for a Livebox viewer(eg, Home screen, Lock screen) that receives request to add Livebox - * - * @since 2.1 - * - * The %ILiveboxRequestEventListener interface defines a listener for a Livebox viewer(eg, Home screen, Lock screen) that receives request to add Livebox - */ -class _OSP_EXPORT_ ILiveboxRequestEventListener -{ -public: - /** - * This polymorphic destructor should be overridden if required. - * This way, the destructors of the derived classes are called when the destructor of this interface is called. - * - * @since 2.1 - */ - virtual ~ILiveboxRequestEventListener() {} - - /** - * Called when requested to add a Livebox @n - * The client can get callback request to add a Livebox by implementing this listener. @n - * - * @param[in] appId The application ID of the application providing Livebox - * @param[in] providerName The name of Livebox provider to be added - * @param[in] userInfo User information for the Livebox provider - * @param[in] text Alternative text for the Livebox - * @see LiveboxManager::AddLivebox() - */ - virtual void OnLiveboxAddRequested(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo, const Tizen::Base::String& text) = 0; -}; - +class LiveboxProviderInfo; /** * @class LiveboxManager - * @brief Manages all the Livebox providers. + * @brief Manages static information of all the Liveboxes and provides APIs for Livebox viewer(Such as the Home screen). * * @since 2.1 * * @final This class is not intended for extension. * - * The %LiveboxManager class manages all the Livebox providers. - * The livebox manager manages static and run time Livebox information. + * The %LiveboxManager class manages static information of all the Liveboxes and deliveries request to add Livebox. */ class _OSP_EXPORT_ LiveboxManager : public Tizen::Base::Object @@ -104,10 +70,10 @@ public: * else @c null if an error occurs * * @exception E_SUCCESS The method is successful. - * @exception E_SYSTEM A system error has occurred. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. * @remarks The specific error code can be accessed using the GetLastResult() method. */ - Tizen::Base::Collection::IList* GetLiveboxProviderInfosN(); + Tizen::Base::Collection::IList* GetLiveboxProviderInfoListN(); /** * Gets a list of installed LiveboxProviderInfo @@ -122,145 +88,64 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_APP_NOT_INSTALLED The application is not installed. * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found. - * @exception E_SYSTEM A system error has occurred. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. * @remarks The specific error code can be accessed using the GetLastResult() method. */ LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); /** - * Request Livebox service to trigger specified Livebox update - * - * @since 2.1 - * - * @param[in] appId The appId that provides Livebox - * @param[in] providerName The name of the Livebox provider - * - * @exception E_SUCCESS The method is successful. - * @exception E_APP_NOT_INSTALLED The application is not installed. - * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found. - * @exception E_INVALID_OPERATION The application isn't permitted to request to update Livebox of other application package.@n - * To get permission, current application package should have same signature with the other. - * @exception E_SYSTEM A system error has occurred. - */ - result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument = L""); - - - /** - * Request add Livebox to a Livebox viewer(eg, Home screen, Lock screen) - * - * @since 2.1 - * @privlevel user - * @privilege http://tizen.org/privilege/liveboxmanager.install - * - * @param[in] targetAppId The ID of the application that the specified Livebox will be added to - * @param[in] providerAppId The ID of the application providing Livebox - * @param[in] providerName The name of Livebox provider to be added - * @param[in] text Text to represent the Livebox - * @param[in] userInfo User information for the Livebox provider - * - * @exception E_SUCCESS The method is successful. - * @exception E_APP_NOT_INSTALLED The application is not installed. - * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @exception E_INVALID_OPERATION The application isn't permitted to request add Livebox of other application package. - * @exception E_UNSUPPORTED_OPERATION The specifed Livebox provider doesn't support this operation. - * @exception E_SYSTEM A system error has occurred. - * - * @remark Only Livebox provider that is packaged with the caller application can be added by this API. - * @see SetLiveboxRequestEventHandler - */ - result AddLivebox(const Tizen::App::AppId& targetAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo); - - /** - * Sets a Livebox request event listener. @n - * The listener gets notified when requested to add Livebox + * Sets a Livebox request listener. @n + * The listener gets notified when the request is recieved. @n + * To unset the listener, pass a @c null value to the pListener parameter. * * @since 2.1 * * @return An error code - * @param[in] listener The listener to receive the Livebox request event - * @exception E_SUCCESS The method is successful. - * @exception E_OBJ_ALREADY_EXIST The listener is already set. - * @exception E_SYSTEM A system error has occurred. - * - * @see ILiveboxRequestEventListener - * - */ - result SetLiveboxRequestEventHandler(ILiveboxRequestEventListener& listener); - - /** - * Sets a LiveboxProvider factory. @n - * The factory is called when LiveboxProvider is need to be created. - * This function should be called in App::OnAppInitializing(), to receive event correctly. - * Implementing LiveboxProviderFactory is mandatory to provide Livebox functionality. + * @param[in] pListener The pointer to the listener to receive request to add Livebox + * @exception E_SUCCESS The method is successful. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. * - * @since 2.1 - * - * @return An error code - * @param[in] factory The factory to create concrete LiveboxProvider - * @exception E_SUCCESS The method is successful. - * @exception E_OBJ_ALREADY_EXIST The listener is already set. - * @exception E_SYSTEM A system error has occurred. - * @see ILiveboxProviderFactory + * @see ILiveboxAddRequestListener + * @remark Platform does not have the ownership of this pointer, So caller should manage the listener object properly. */ - result SetLiveboxProviderFactory(ILiveboxProviderFactory& factory); - - /** - * Sets a LiveboxPopupProvider factory. @n - * The factory is called when LiveboxPopupProvider is need to be created. - * This function should be called in App::OnAppInitializing(), to receive event correctly. - * Implementing LiveboxPopupProviderFactory is mandatory to provide LiveboxPopup functionality. - * - * @since 2.1 - * - * @return An error code - * @param[in] factory The factory to create concrete LiveboxPopupProvider - * @exception E_SUCCESS The method is successful. - * @exception E_OBJ_ALREADY_EXIST The listener is already set. - * @exception E_SYSTEM A system error has occurred. - * @see ILiveboxPopupProviderFactory - */ - result SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory); - + result SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener); private: - /** - * This default constructor is intentionally declared as private to implement the %Singleton semantic. - * - * @since 2.1 - */ + // + // This default constructor is intentionally declared as private to implement the %Singleton semantic. + // + // @since 2.1 + // LiveboxManager(); - /** - * This destructor is intentionally declared as private to implement the %Singleton semantic. - * - * @since 2.1 - */ + // + // This destructor is intentionally declared as private to implement the %Singleton semantic. + // + // @since 2.1 + // virtual ~LiveboxManager(); - /** - * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. - * - * @since 2.1 - */ + // + // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. + // + // @since 2.1 + // LiveboxManager& operator =(const LiveboxManager& rhs); - /** - * Constructs the instance of this class. - * - * @since 2.1 - * - * @return An error code - * @exception E_SUCCESS The method is successful. - * @exception E_SYSTEM A system error has occurred. - */ + // + // Constructs the instance of this class. + // + // @since 2.1 + // + // @return An error code + // @exception E_SUCCESS The method is successful. + // @exception E_SYSTEM The method cannot proceed due to a severe system error. + // result Construct(); -public: - ILiveboxRequestEventListener* __pLiveboxRequestEventListener;//TODO: to impl - private: class _LiveboxManagerImpl* __pLiveboxManagerImpl; + friend struct std::default_delete< LiveboxManager >; }; }} // Tizen::Shell diff --git a/inc/FShellLiveboxPopupProvider.h b/inc/FShellLiveboxPopupProvider.h old mode 100644 new mode 100755 index d0353fc..c1ed258 --- a/inc/FShellLiveboxPopupProvider.h +++ b/inc/FShellLiveboxPopupProvider.h @@ -26,7 +26,6 @@ #define _FSHELL_LIVEBOX_POPUP_PROVIDER_H_ #include -#include namespace Tizen { namespace Shell { @@ -42,9 +41,9 @@ class LiveboxPopup; * The %LiveboxPopupProvider class is a base class which represents a Livebox popup provider */ class _OSP_EXPORT_ LiveboxPopupProvider -: public Tizen::Base::Object + : public Tizen::Base::Object { -public: +protected: /** * This is the default constructor for this class. * @@ -59,7 +58,6 @@ public: */ virtual ~LiveboxPopupProvider(); -protected: /** * Called when the Livebox popup provider is required to be created @n * @@ -77,7 +75,7 @@ protected: * * @since 2.1 */ - virtual void OnLiveboxPopupProviderTerminating() = 0; + virtual void OnLiveboxPopupProviderTerminating(void) = 0; /** * Sets the Livebox popup to the Livebox @@ -87,9 +85,11 @@ protected: * @return An error code * @param[in] pLiveboxPopup The pointer to LiveboxPopup instance to be set to the Livebox * @exception E_SUCCESS The method is successful. - * @exception E_INVALID_OPERATION The LiveboxFrame to be set is not constructed. - * @exception E_OBJ_ALREADY_EXIST The LiveboxFrame to be set is already registered with the LiveboxPopupProvider. - * @exception E_SYSTEM A system error has occurred. + * @exception E_INVALID_ARG The pointer to the LiveboxFrame is null, or not constructed yet. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * + * @remark This function should be called only in OnLiveboxPopupProviderInitializing. + * @remark LiveboxPopup instance ownership is transferred to platform. After LiveboxPopupProvider::OnLiveboxPopupProviderTerminating() is called, LiveboxPopup instance is removed automatically. LiveboxPopup instance reuse is not allowed. */ result SetLiveboxPopup(Tizen::Shell::LiveboxPopup* pLiveboxPopup); @@ -99,34 +99,17 @@ protected: * @since 2.1 * * @return The LiveboxPopup instnace, or null if any LiveboxPopup is set yet. - * @exception E_SUCCESS The method is successful. - * @exception E_INVALID_ARG The specified input parameter is invalid. - * @exception E_OBJ_ALREADY_EXIST The frame to be added is already registered with the UI application. - * @exception E_SYSTEM A system error has occurred. */ - Tizen::Shell::LiveboxPopup* GetLiveboxPopup() const; + Tizen::Shell::LiveboxPopup* GetLiveboxPopup(); -private: /** - * Initializes this instance of %LiveboxPopupProvider - * - * @since 2.1 - */ - result Construct(const Tizen::Base::String& instanceId); - - /* - * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. + * Get the Livebox popup from the Livebox * * @since 2.1 - */ - LiveboxPopupProvider(const LiveboxPopupProvider& rhs); - - /* - * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. * - * @since 2.1 + * @return The LiveboxPopup instnace, or null if any LiveboxPopup is set yet. */ - LiveboxPopupProvider& operator =(const LiveboxPopupProvider& rhs); + const Tizen::Shell::LiveboxPopup* GetLiveboxPopup() const; protected: // @@ -154,10 +137,34 @@ protected: virtual void LiveboxPopupProvider_Reserved3(void) {} private: + // + // Initializes this instance of %LiveboxPopupProvider + // + // @since 2.1 + // + result Construct(const Tizen::Base::String& instanceId); + + // + // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. + // + // @since 2.1 + // + LiveboxPopupProvider(const LiveboxPopupProvider& rhs); + + // + // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. + // + // @since 2.1 + // + LiveboxPopupProvider& operator =(const LiveboxPopupProvider& rhs); + +private: class _LiveboxPopupProviderImpl* __pLiveboxPopupProviderImpl; - friend class _LiveboxManagerImpl; -}; -} /* namespace Livebox */ -} /* namespace Samsung */ + friend class _LiveboxProviderManagerImpl; + +}; // LiveboxPopupProvider + +}} // Tizen::Shell + #endif /* _FSHELL_LIVEBOX_POPUP_PROVIDER_H_ */ diff --git a/inc/FShellLiveboxProvider.h b/inc/FShellLiveboxProvider.h index 98e236b..49a3b80 100755 --- a/inc/FShellLiveboxProvider.h +++ b/inc/FShellLiveboxProvider.h @@ -26,7 +26,6 @@ #define _FSHELL_LIVEBOX_PROVIDER_H_ #include -#include namespace Tizen { namespace Shell { @@ -97,26 +96,34 @@ protected: /** * Called when the Livebox provider is required to be destroyed @n - * The client can destroy it's own LiveboxProvider by implementing this pure virtual function * * @since 2.1 + */ + virtual void OnLiveboxProviderTerminating(void) = 0; + + /** + * Called when the correspondent Livebox is removed from Livebox viewer application. (Home or Lock screen, etc)@n + * If you stored Livebox provider state to persistent storage such as registry or DB, you can destroy by implementing this pure virtual function.@n + * * - * @param[in] isLiveboxRemoved If true, correspondent Livebox is removed from Livebox viewer application. (Home or Lock screen, etc) + * @since 2.1 + * + * @remark This function is called after OnLiveboxProviderTerminating called. */ - virtual void OnLiveboxProviderTerminating(bool isLiveboxRemoved) = 0; + virtual void OnLiveboxProviderRemoved(void) = 0; /** * Called when the Livebox is required to be updated @n - * The client can update it's own LiveboxProvider by implementing this pure virtual function + * Your Livebox provider can be updated by implementing this pure virtual function. * * @since 2.1 * - * @param[in] argument The argument for updating the Livebox. - * - * @Remark This function is called when UpdatePeriod timer is expired or LiveboxManager::RequestUpdate() is called.@n - * The argument is passsed by LiveboxManager::RequestUpdate() API. + * @param[in] userInfo User information to update the Livebox provider@n + * This parameter is delivered from LiveboxProvider::RequestUpdate() + * + * @Remark This function is called when UpdatePeriod timer is expired or LiveboxManager::RequestUpdate() is called.@n */ - virtual void OnLiveboxProviderUpdating(const Tizen::Base::String& argument) = 0; + virtual void OnLiveboxProviderUpdating(const Tizen::Base::String& userInfo) = 0; /** * Sets the LiveboxFrame to the LiveboxProvider @@ -126,11 +133,11 @@ protected: * @return An error code * @param[in] pLiveboxFrame The LiveboxFrame to be set to the LiveboxProvider * @exception E_SUCCESS The method is successful. - * @exception E_INVALID_OPERATION The LiveboxFrame to be set is not constructed. - * @exception E_OBJ_ALREADY_EXIST The LiveboxFrame to be set is already registered with the LiveboxProvider. - * @exception E_SYSTEM A system error has occurred. + * @exception E_INVALID_ARG The pointer to the LiveboxFrame is null, or not constructed yet. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. * - * @remark This function should be called only in OnLiveboxProviderInitializing + * @remark This function should be called only in OnLiveboxProviderInitializing. + * @remark LiveboxFrame instance ownership is transferred to platform. After LiveboxProvider::OnLiveboxProviderTerminating() is called, LiveboxPopup instance is removed automatically. LiveboxFrame instance reuse is not allowed. */ result SetLiveboxFrame(LiveboxFrame* pLiveboxFrame); @@ -140,47 +147,17 @@ protected: * @since 2.1 * * @return the LiveboxFrame instnace, or null if any LiveboxFrame isn't set yet. - * @exception E_SUCCESS The method is successful. - * @exception E_INVALID_ARG The specified input parameter is invalid. - * @exception E_OBJ_ALREADY_EXIST The LiveboxFrame to be added is already registered with the UI application. - * @exception E_SYSTEM A system error has occurred. */ - LiveboxFrame* GetLiveboxFrame() const; - + LiveboxFrame* GetLiveboxFrame(); /** - * Gets the correspondent LiveboxProvider instance for the current LiveboxPopupProvider - * - * @since 2.1 - * - * @return the LiveboxProvider instnace, or null if any exception occured. - * @exception E_SUCCESS The method is successful. - * @exception E_SYSTEM A system error has occurred. - */ - LiveboxProvider* GetLiveboxProviderInstance(); - -private: - - /** - * Initializes this instance of %LiveboxProvider - * - * @since 2.1 - */ - result Construct(const Tizen::Base::String& instanceId); - - /* - * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. + * Get the LiveboxFrame from the LiveboxProvider * * @since 2.1 - */ - LiveboxProvider(const LiveboxProvider& rhs); - - /* - * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. * - * @since 2.1 + * @return the LiveboxFrame instnace, or null if any LiveboxFrame isn't set yet. */ - LiveboxProvider& operator =(const LiveboxProvider& rhs); + const LiveboxFrame* GetLiveboxFrame() const; protected: // @@ -223,11 +200,34 @@ protected: // virtual void LiveboxProvider_Reserved5(void) {} +private: + + // + // Initializes this instance of %LiveboxProvider + // + // @since 2.1 + // + result Construct(const Tizen::Base::String& instanceId); + + // + // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. + // + // @since 2.1 + // + LiveboxProvider(const LiveboxProvider& rhs); + + // + // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. + // + // @since 2.1 + // + LiveboxProvider& operator =(const LiveboxProvider& rhs); + private: class _LiveboxProviderImpl* __pLiveboxProviderImpl; - friend class _LiveboxManagerImpl; + friend class _LiveboxProviderManagerImpl; }; }} // Tizen::Shell diff --git a/inc/FShellLiveboxProviderInfo.h b/inc/FShellLiveboxProviderInfo.h old mode 100644 new mode 100755 index 3afa110..cef781b --- a/inc/FShellLiveboxProviderInfo.h +++ b/inc/FShellLiveboxProviderInfo.h @@ -26,10 +26,10 @@ #define _FSHELL_LIVEBOX_PROVIDER_INFO_H_ #include -#include -#include #include +namespace Tizen { namespace Base { namespace Collection { class IList; } } } + namespace Tizen { namespace Shell { @@ -45,26 +45,8 @@ class _OSP_EXPORT_ LiveboxProviderInfo : public Tizen::Base::Object { public: - - /** - * This is the constructor that initializes an instance of %LiveboxProviderInfo with the specified values. - * - * @since 2.1 - * - * @param[in] appId The Id of the application that provides Livebox - * @param[in] providerName The name of the Livebox provider - */ - LiveboxProviderInfo(const Tizen::App::AppId& appId, const Tizen::Base::String& name); - - /** - * This is the constructor that initializes an instance of %LiveboxProviderInfo with the specified values. - * - * @since 2.1 - */ - LiveboxProviderInfo(const Tizen::Base::String& providerId); - /** - * This is the copy constructor for the %LiveboxProviderInfo class. + * Copying of objects using this copy constructor is allowed. * * @since 2.1 * @@ -138,9 +120,11 @@ public: * { * AppControl* pAc = AppManager::FindAppControl(pProviderInfo->GetConfigurationAppControlAppId(), L"http://tizen.org/appcontrol/operation/livebox/configuration"); - * HashMap map(SingleObjectDeleter); - * map.Constrcuct(); - * map.Add(L"ProviderName", pProviderInfo->GetProviderName()); + * HashMap map(SingleObjectDeletor); + * map.Construct(); + * String key = L"ProviderName"; + * String value = pProviderInfo->GetName(); + * map.Add(&key, &value ); * pAc.Start(null, null, &map, null); * } @@ -170,33 +154,43 @@ public: * @return A pointer to the array list that contains all LiveboxSizeInfo of the LiveboxProvider@n * else @c null if an error occurs * @exception E_SUCCESS The method is successful. - * @exception E_SYSTEM A system error has occurred. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. * @remarks The specific error code can be accessed using the GetLastResult() method. */ - Tizen::Base::Collection::IList* GetSizeInfosN() const; + Tizen::Base::Collection::IList* GetSizeInfoListN() const; private: - /** - * This is the default constructor for this class. - * - * @since 2.1 - */ + + // + // This is the constructor that initializes an instance of %LiveboxProviderInfo with the specified values. + // This constructor is intentionally declared as private so that only the platform can create an instance. + // + // @since 2.1 + // + // @param[in] appId The Id of the application that provides Livebox + // @param[in] name The name of the Livebox provider + // + LiveboxProviderInfo(const Tizen::App::AppId& appId, const Tizen::Base::String& name); + + // + // This default constructor is intentionally declared as private so that only the platform can create an instance. + // + // @since 2.1 + // LiveboxProviderInfo(); - /** - * Assigns the value of the specified instance of %LiveboxProviderInfo to the current instance of %LiveboxProviderInfo. - * - * @since 2.1 - * - * @param[in] rhs An instance of %LiveboxProviderInfo - */ + // + // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. + // + // @since 2.1 + // + // LiveboxProviderInfo& operator =(const LiveboxProviderInfo& rhs); private: class _LiveboxProviderInfoImpl* __pLiveboxProviderInfoImpl; friend class _LiveboxProviderInfoImpl; - }; }} // Tizen::Shell diff --git a/inc/FShellLiveboxProviderManager.h b/inc/FShellLiveboxProviderManager.h new file mode 100755 index 0000000..6a4c9db --- /dev/null +++ b/inc/FShellLiveboxProviderManager.h @@ -0,0 +1,187 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (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 +// +// 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. +// + +/** + * @file FShellLiveboxProviderManager.h + * @brief This is the header file for the %LiveboxManager class. + * + * This header file contains the declarations of the %LiveboxProviderManager class. + */ + +#ifndef _FSHELL_LIVEBOX_PROVIDER_MANAGER_H_ +#define _FSHELL_LIVEBOX_PROVIDER_MANAGER_H_ + +#include +#include +#include +#include +#include + +namespace Tizen { namespace Base { namespace Collection { class IList; } } } +namespace Tizen { namespace Shell +{ + +/** + * @class LiveboxProviderManager + * @brief Manages all the Livebox providers. + * + * @since 2.1 + * + * @final This class is not intended for extension. + * + * The %LiveboxManager class manages all the Livebox providers. + * The livebox manager manages static and run time Livebox information. + */ +class _OSP_EXPORT_ LiveboxProviderManager + : public Tizen::Base::Object +{ +public: + + /** + * Gets the Livebox manager instance. + * + * @since 2.1 + * + * @return A pointer to the %LiveboxManager instance, @n + * else @c null if it fails + */ + static LiveboxProviderManager* GetInstance(); + + /** + * Request Livebox service to trigger specified Livebox update + * + * @since 2.1 + * + * @param[in] appId The appId that provides Livebox + * @param[in] providerName The name of the Livebox provider + * @param[in] userInfo User information for the Livebox provider@n + * This parameter will be delivered as parameter of LiveboxProvider::OnLiveboxProviderUpdating() + * + * @exception E_SUCCESS The method is successful. + * @exception E_APP_NOT_INSTALLED The application is not installed. + * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found. + * @exception E_CERTIFICATE_VERIFICATION_FAILED The application isn't permitted to request to update Livebox of other application package.@n + * To get permission, the target application is signed with the same certificate. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * + * @see LiveboxProvider::OnLiveboxProviderUpdating() + */ + result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo = L""); + + /** + * Request a Livebox viewer(eg, Home screen, Lock screen) to add the specified Livebox. + * + * @since 2.1 + * @privlevel user + * @privilege http://tizen.org/privilege/liveboxmanager + * + * @param[in] viewerAppId The ID of the viewer application that the specified Livebox will be added to + * @param[in] providerAppId The ID of the application providing Livebox + * @param[in] providerName The name of Livebox provider to be added + * @param[in] text Text to represent the Livebox + * @param[in] userInfo User information for the Livebox provider + * + * @exception E_SUCCESS The method is successful. + * @exception E_APP_NOT_INSTALLED The application is not installed. + * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_CERTIFICATE_VERIFICATION_FAILED The application isn't permitted to request add Livebox of other application package. + * To get permission, the target application is signed with the same certificate. + * @exception E_UNSUPPORTED_OPERATION The specifed Livebox provider doesn't support this operation.@ + * To request a Livebox viewer to add a Livebox, Livebox provider should support 1x1 size Livebox, but the specified Livebox provider doesn't support 1x1 size. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * + * @remark Only Livebox provider that is packaged with the caller application can be added by this API. + * @see SetLiveboxAddRequestListener + */ + result AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo); + + /** + * Sets a LiveboxProvider factory. @n + * The factory is called when LiveboxProvider is need to be created. + * This function should be called in App::OnAppInitializing(), to receive event correctly. + * Implementing LiveboxProviderFactory is mandatory to provide Livebox functionality. + * + * @since 2.1 + * + * @return An error code + * @param[in] factory The factory to create concrete LiveboxProvider + * @exception E_SUCCESS The method is successful. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * @see ILiveboxProviderFactory + */ + result SetLiveboxProviderFactory(ILiveboxProviderFactory& factory); + + /** + * Sets a LiveboxPopupProvider factory. @n + * The factory is called when LiveboxPopupProvider is need to be created. + * This function should be called in App::OnAppInitializing(), to receive event correctly. + * Implementing LiveboxPopupProviderFactory is mandatory to provide LiveboxPopup functionality. + * + * @since 2.1 + * + * @return An error code + * @param[in] factory The factory to create concrete LiveboxPopupProvider + * @exception E_SUCCESS The method is successful. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * @see ILiveboxPopupProviderFactory + */ + result SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory); + + +private: + // + // This default constructor is intentionally declared as private to implement the %Singleton semantic. + // + // @since 2.1 + // + LiveboxProviderManager(); + + // + // This destructor is intentionally declared as private to implement the %Singleton semantic. + // + // @since 2.1 + // + virtual ~LiveboxProviderManager(); + + /** + * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. + * + * @since 2.1 + */ + LiveboxProviderManager& operator =(const LiveboxProviderManager& rhs); + + // + // Constructs the instance of this class. + // + // @since 2.1 + // + // @return An error code + // @exception E_SUCCESS The method is successful. + // @exception E_SYSTEM A system error has occurred. + // + result Construct(); + +private: + class _LiveboxProviderManagerImpl* __pLiveboxProviderManagerImpl; + friend struct std::default_delete< LiveboxProviderManager >; + +}; // LiveboxProviderManager + +}} // Tizen::Shell + +#endif /* _FSHELL_LIVEBOX_PROVIDER_MANAGER_H_ */ diff --git a/inc/FShellLiveboxSizeInfo.h b/inc/FShellLiveboxSizeInfo.h old mode 100644 new mode 100755 index 0ffb9c6..4ba2237 --- a/inc/FShellLiveboxSizeInfo.h +++ b/inc/FShellLiveboxSizeInfo.h @@ -26,9 +26,8 @@ #define _FSHELL_LIVEBOX_SIZE_INFO_H_ #include -#include -#include #include +#include namespace Tizen { namespace Shell { @@ -53,7 +52,7 @@ public: virtual ~LiveboxSizeInfo(); /** - * This is the copy constructor for the %LiveboxSizeInfo class. + * Copying of objects using this copy constructor is allowed. * * @since 2.1 * @@ -62,15 +61,6 @@ public: LiveboxSizeInfo(const LiveboxSizeInfo& rhs); /** - * Assigns the value of the specified instance of %LiveboxSizeInfo to the current instance of %LiveboxSizeInfo. - * - * @since 2.1 - * - * @param[in] rhs An instance of %LiveboxSizeInfo - */ - LiveboxSizeInfo& operator =(const LiveboxSizeInfo& rhs); - - /** * Gets the size * * @since 2.1 @@ -89,20 +79,31 @@ public: Tizen::Base::String GetPreviewImagePath() const; private: - /** - * This is the default constructor for this class. - * - * @since 2.1 - */ - LiveboxSizeInfo(); - - /** - * This is the constructor that initializes an instance of %LiveboxSizeInfo with the specified values. - * - * @since 2.1 - */ + // + // This is the constructor that initializes an instance of %LiveboxSizeInfo with the specified values. + // This constructor is intentionally declared as private so that only the platform can create an instance. + // + // @since 2.1 + // + // @param[in] size One of the size that the Livebox provider supports. + // @param[in] previewImagePath The preview image path for the size. + // LiveboxSizeInfo(Tizen::Graphics::Dimension size, const Tizen::Base::String& previewImagePath); + // + // This default constructor is intentionally declared as private so that only the platform can create an instance. + // + // @since 2.1 + // + LiveboxSizeInfo(); + + // + // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. + // + // @since 2.1 + // + LiveboxSizeInfo& operator =(const LiveboxSizeInfo& rhs); + private: _LiveboxSizeInfoImpl* __pLiveboxSizeInfoImpl; diff --git a/packaging/osp-shell.spec b/packaging/osp-shell.spec index ce4c07c..56217e8 100644 --- a/packaging/osp-shell.spec +++ b/packaging/osp-shell.spec @@ -6,7 +6,7 @@ Summary: The Shell library of OSP Version: 1.2.1.0 Release: 1 Group: TO_BE/FILLED_IN -License: TO BE FILLED IN +License: Apache License, Version 2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: pkgconfig(capi-appfw-application) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d143a42..a4e86b3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,12 +63,14 @@ SET (${this_target}_SOURCE_FILES FShell_LiveboxProviderInfoImpl.cpp FShell_LiveboxSizeInfoImpl.cpp FShell_LiveboxManagerImpl.cpp + FShell_LiveboxProviderManagerImpl.cpp FShell_LiveboxManagerProxy.cpp FShellLiveboxProvider.cpp FShellLiveboxPopupProvider.cpp FShellLiveboxProviderInfo.cpp FShellLiveboxSizeInfo.cpp FShellLiveboxManager.cpp + FShellLiveboxProviderManager.cpp FShell_LiveboxManagerIpcMessage.cpp FShell_LiveboxFrame.cpp FShell_LiveboxFrameImpl.cpp diff --git a/src/FShellLiveboxManager.cpp b/src/FShellLiveboxManager.cpp index 88312e4..30ad182 100644 --- a/src/FShellLiveboxManager.cpp +++ b/src/FShellLiveboxManager.cpp @@ -32,8 +32,7 @@ #include #include #include -#include -#include + #include #include @@ -92,155 +91,23 @@ LiveboxManager::Construct() return E_SUCCESS; } -result -LiveboxManager::SetLiveboxProviderFactory(ILiveboxProviderFactory& factory) -{ - return __pLiveboxManagerImpl->SetLiveboxProviderFactory(factory); -} - -result -LiveboxManager::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory) -{ - return __pLiveboxManagerImpl->SetLiveboxPopupProviderFactory(factory); -} - -//result -//LiveboxManager::HandleRequest(const Tizen::Base::String& operationId, Tizen::Base::String* pCategory, Tizen::Base::Collection::IList* pArgs) -//{ -// return __pLiveboxManagerImpl->HandleRequest(operationId, pCategory, pArgs); -//} - Tizen::Base::Collection::IList* -LiveboxManager::GetLiveboxProviderInfosN() +LiveboxManager::GetLiveboxProviderInfoListN() { - return __pLiveboxManagerImpl->GetLiveboxProviderInfosN(); + return __pLiveboxManagerImpl->GetLiveboxProviderInfoListN(); } LiveboxProviderInfo* LiveboxManager::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) { // TODO : set configurationAppcontrolAppId - return new LiveboxProviderInfo(appId, providerName); + return __pLiveboxManagerImpl->GetLiveboxProviderInfoN(appId, providerName); } - -/* result -LiveboxManager::RequestUpdate() +LiveboxManager::SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener) { - Tizen::App::AppId appId(Tizen::App::_AppInfo::GetAppId()); - - std::unique_ptr pPackageId(_StringConverter::CopyToCharArrayN(appId)); - int ret = livebox_service_trigger_update(pPackageId.get(), "user,created", "default"); - SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "[E_SYSTEM] Failed to invoke livebox_service_trigger_update, ret (%d)", ret); - - return E_SUCCESS; -} -*/ - -result -LiveboxManager::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) -{ - __pLiveboxManagerImpl->RequestUpdate(appId, providerName); - - return E_SUCCESS; -} - -//void -//LiveboxManager::TerminateAppIfInvalidState() -//{ -// __pLiveboxManagerImpl->TerminateAppIfInvalidState(); -//} - - -namespace -{ -int AddLiveboxCallback(int ret, int pid, void *data) -{ - if( ret != 0) - { - SysLog(NID_APP, "Error.(%d)", ret); - } - - return 0; -} -} - - -result -LiveboxManager::AddLivebox(const Tizen::App::AppId& targetAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) -{ - SysTryReturnResult(NID_APP, providerAppId.IsEmpty()==false, E_INVALID_ARG, "The providerAppId is empty."); - SysTryReturnResult(NID_APP, providerAppId.GetLength() < NATIVE_APP_MAX_APPID_LENGTH, E_INVALID_ARG, "The providerAppId is too long (Maximum %d bytes).", NATIVE_APP_MAX_APPID_LENGTH); - SysTryReturnResult(NID_APP, _PackageManagerImpl::IsAppInstalled(providerAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", providerAppId.GetPointer()); - - //TODO :: check privilege - String providerId; - if( providerAppId.StartsWith(L"com.samsung", 0) == true ) - { - SysLog(NID_APP, "[E_INVALID_OPERATION] but allowed to test"); - //TODO:return E_INVALID_OPERATION - providerId = providerAppId; - } - else - { - String localPackageId = _PackageManagerImpl::GetPackageIdByAppId(Tizen::App::App::GetInstance()->GetAppId()); - String liveboxProviderPackageId = _PackageManagerImpl::GetPackageIdByAppId(providerAppId); - if( localPackageId != liveboxProviderPackageId) - { - SysLog(NID_APP, "[E_INVALID_OPERATION] but allowed to test"); - //TODO:return E_INVALID_OPERATION - } - providerId = providerAppId + "." + providerName; - } - - PackageInfo* pPackageInfo = null; - result r = E_SUCCESS; - - pPackageInfo = _PackageManagerImpl::GetInstance()->GetPackageInfoN(providerAppId); - SysTryReturn(NID_APP, pPackageInfo != null, r, r, "[%s] Propagating.", GetErrorMessage(r)); - - String iconPath; //= packageInfo.GetAppIconPath(); - - delete pPackageInfo; - - std::unique_ptr pProviderId(_StringConverter::CopyToCharArrayN(providerId)); - std::unique_ptr pName(_StringConverter::CopyToCharArrayN(text)); - std::unique_ptr pContent(_StringConverter::CopyToCharArrayN(userInfo)); - std::unique_ptr pIcon(_StringConverter::CopyToCharArrayN(iconPath)); - - int ret = add_to_home_livebox(pProviderId.get(), pName.get(), LAUNCH_BY_PACKAGE, pContent.get(), pIcon.get(), -1.0l, AddLiveboxCallback, this); - SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "[E_SYSTEM] failed to add_to_home_livebox (%d)", ret); - - return E_SUCCESS; -} - -// c style callback for shortcut_set_request_cb -int LiveboxRequestEventHandler(const char* providerId, const char* text, int type, const char* content_info, const char* icon, int pid, double period, void *data) -{ - SysTryReturn(NID_APP, providerId, 0, E_SYSTEM, "[E_SYSTEM] providerId is null!"); - - LiveboxManager* pLiveboxManager = static_cast(data); - SysTryReturn(NID_APP, pLiveboxManager, 0, E_SYSTEM, "[E_SYSTEM] pLiveboxManager is null!"); - - String appId; - String providerName; - _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, appId, providerName); - - //OnLiveboxAddRequested(const Tizen::Base::AppId& appId, const const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo, const const Tizen::Base::String& text, const Tizen::Base::String& iconPath) - pLiveboxManager->__pLiveboxRequestEventListener->OnLiveboxAddRequested(appId, providerName, content_info, text ); - - return 0; -} - -result -LiveboxManager::SetLiveboxRequestEventHandler(ILiveboxRequestEventListener& listener) -{ - int ret = shortcut_set_request_cb(LiveboxRequestEventHandler, this ); - SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "failed to shortcut_set_request_cb (%d)", ret); - - __pLiveboxRequestEventListener = &listener; - return E_SUCCESS; + return __pLiveboxManagerImpl->SetLiveboxAddRequestListener(pListener); } diff --git a/src/FShellLiveboxPopupProvider.cpp b/src/FShellLiveboxPopupProvider.cpp index bb16464..ded060e 100644 --- a/src/FShellLiveboxPopupProvider.cpp +++ b/src/FShellLiveboxPopupProvider.cpp @@ -68,9 +68,15 @@ LiveboxPopupProvider::SetLiveboxPopup(LiveboxPopup* pLiveboxPopup) } LiveboxPopup* -LiveboxPopupProvider::GetLiveboxPopup() const +LiveboxPopupProvider::GetLiveboxPopup() { return __pLiveboxPopupProviderImpl->GetLiveboxPopup(); } +const LiveboxPopup* +LiveboxPopupProvider::GetLiveboxPopup() const +{ + return const_cast(__pLiveboxPopupProviderImpl->GetLiveboxPopup()); +} + }} // Tizen::Shell diff --git a/src/FShellLiveboxProvider.cpp b/src/FShellLiveboxProvider.cpp index 91af943..5cf0940 100644 --- a/src/FShellLiveboxProvider.cpp +++ b/src/FShellLiveboxProvider.cpp @@ -65,9 +65,15 @@ LiveboxProvider::SetLiveboxFrame(LiveboxFrame* pLiveboxFrame) } LiveboxFrame* -LiveboxProvider::GetLiveboxFrame() const +LiveboxProvider::GetLiveboxFrame() { return __pLiveboxProviderImpl->GetLiveboxFrame(); } +const LiveboxFrame* +LiveboxProvider::GetLiveboxFrame() const +{ + return const_cast(__pLiveboxProviderImpl->GetLiveboxFrame()); +} + }} // Tizen::Shell diff --git a/src/FShellLiveboxProviderInfo.cpp b/src/FShellLiveboxProviderInfo.cpp index 375c4c1..e738d31 100644 --- a/src/FShellLiveboxProviderInfo.cpp +++ b/src/FShellLiveboxProviderInfo.cpp @@ -111,10 +111,10 @@ LiveboxProviderInfo::GetCongiturationAppControlAppId() const } Tizen::Base::Collection::IList* -LiveboxProviderInfo::GetSizeInfosN() const +LiveboxProviderInfo::GetSizeInfoListN() const { SysAssert(__pLiveboxProviderInfoImpl); - return __pLiveboxProviderInfoImpl->GetSizeInfosN(); + return __pLiveboxProviderInfoImpl->GetSizeInfoListN(); } }} // Tizen::Shell diff --git a/src/FShellLiveboxProviderManager.cpp b/src/FShellLiveboxProviderManager.cpp new file mode 100644 index 0000000..5455fd8 --- /dev/null +++ b/src/FShellLiveboxProviderManager.cpp @@ -0,0 +1,120 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (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 +// +// 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. +// + +/** + * @file FShellLiveboxProviderManager.cpp + * @brief This is the implementation for the LiveboxProviderManager class. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "FShell_LiveboxProviderManagerImpl.h" + +using namespace std; +using namespace Tizen::App; +using namespace Tizen::App::Package; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; + + +namespace Tizen { namespace Shell +{ + +LiveboxProviderManager::LiveboxProviderManager() + :__pLiveboxProviderManagerImpl(null) +{ + +} + +LiveboxProviderManager::~LiveboxProviderManager() +{ +} + +LiveboxProviderManager* +LiveboxProviderManager::GetInstance() +{ + static LiveboxProviderManager* pLiveboxManager = null; + if( pLiveboxManager == null) + { + pLiveboxManager = new LiveboxProviderManager; + SysTryReturn(NID_APP, pLiveboxManager, null, E_OUT_OF_MEMORY, "E_OUT_OF_MEMORY" ); + + result r = pLiveboxManager->Construct(); +// SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r)); + SysAssertf(!IsFailed(r), "Failed to construct LiveboxProviderManager!!"); + SysLog(NID_APP, "LiveboxProviderManager instance is created."); + } + + return pLiveboxManager; +} + +result +LiveboxProviderManager::Construct() +{ + SysAssert(__pLiveboxProviderManagerImpl == null); + + SysLog(NID_APP, "Enter."); + __pLiveboxProviderManagerImpl = _LiveboxProviderManagerImpl::GetInstance(); + SysAssertf(__pLiveboxProviderManagerImpl, "Failed to construct _LiveboxProviderManagerImpl!!"); + + SysLog(NID_APP, "Exit."); + + return E_SUCCESS; +} + +result +LiveboxProviderManager::SetLiveboxProviderFactory(ILiveboxProviderFactory& factory) +{ + return __pLiveboxProviderManagerImpl->SetLiveboxProviderFactory(factory); +} + +result +LiveboxProviderManager::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory) +{ + return __pLiveboxProviderManagerImpl->SetLiveboxPopupProviderFactory(factory); +} + +result +LiveboxProviderManager::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) +{ + __pLiveboxProviderManagerImpl->RequestUpdate(appId, providerName); + return E_SUCCESS; +} + +result +LiveboxProviderManager::AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) +{ + return __pLiveboxProviderManagerImpl->AddLivebox(viewerAppId, providerAppId, providerName, text, userInfo); +} + +}} // Tizen::Shell diff --git a/src/FShell_LiveboxLayer.cpp b/src/FShell_LiveboxLayer.cpp index 320bb9b..f2003c1 100644 --- a/src/FShell_LiveboxLayer.cpp +++ b/src/FShell_LiveboxLayer.cpp @@ -33,7 +33,7 @@ #include #include "FUi_Window.h" #include "FShell_LiveboxLayer.h" -#include "FShell_LiveboxManagerImpl.h" +#include "FShell_LiveboxProviderManagerImpl.h" using namespace std; using namespace Tizen::Base; @@ -323,7 +323,7 @@ _LiveboxLayer::OnRendered(void) result _LiveboxLayer::RegisterTouchEventListener(void) { - result r = _LiveboxManagerImpl::GetInstance()->SetLiveboxTouchEventListener(__providerId, *this); + result r = _LiveboxProviderManagerImpl::GetInstance()->SetLiveboxTouchEventListener(__providerId, *this); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return r; @@ -341,7 +341,7 @@ _LiveboxLayer::AcquirePixmap(void) Rectangle bounds = pWindow->GetBounds(); - result r = _LiveboxManagerImpl::GetInstance()->RequestSharedMemoryId(__providerId, bounds.width, bounds.height, pixmapId); + result r = _LiveboxProviderManagerImpl::GetInstance()->RequestSharedMemoryId(__providerId, bounds.width, bounds.height, pixmapId); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r)); SysLog(NID_UI_CTRL, "pixmapId(%d) bounds(%d %d %d %d)", pixmapId, bounds.x, bounds.y, bounds.width, bounds.height); @@ -354,7 +354,7 @@ _LiveboxLayer::Sync(const Tizen::Graphics::Rectangle& bounds) { SysTryReturn(NID_UI_CTRL, !__providerId.IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid."); - result r = _LiveboxManagerImpl::GetInstance()->RequestSyncSharedMemory(__providerId, bounds.width, bounds.height); + result r = _LiveboxProviderManagerImpl::GetInstance()->RequestSyncSharedMemory(__providerId, bounds.width, bounds.height); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return r; @@ -365,7 +365,7 @@ _LiveboxLayer::ReleasePixmap(void) { SysTryReturnVoidResult(NID_UI_CTRL, !__providerId.IsEmpty(), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid."); - _LiveboxManagerImpl::GetInstance()->RequestReleaseSharedMemory(__providerId); + _LiveboxProviderManagerImpl::GetInstance()->RequestReleaseSharedMemory(__providerId); } int diff --git a/src/FShell_LiveboxManagerImpl.cpp b/src/FShell_LiveboxManagerImpl.cpp index c6e8ce1..346cc32 100644 --- a/src/FShell_LiveboxManagerImpl.cpp +++ b/src/FShell_LiveboxManagerImpl.cpp @@ -56,25 +56,8 @@ using namespace Tizen::Base::Collection; using namespace Tizen::App; using namespace Tizen::Graphics; - -namespace -{ -const char LIVEBOX_ON_ADD[] = "Livebox='event=add'"; -const char LIVEBOX_ON_REMOVE[] = "Livebox='event=remove'"; -const char LIVEBOX_ON_UPDATE[] = "Livebox='event=update'"; -const char LIVEBOX_ON_RESIZE[] = "Livebox='event=resize'"; -const char LIVEBOX_ON_TOUCH[] = "Livebox='event=touch'"; -const char LIVEBOX_TRAY_ON_CREATE[] = "LiveboxTray='event=create'"; -const char LIVEBOX_TRAY_ON_DESTROY[] = "LiveboxTray='event=destroy'"; -const char LIVEBOX_TRAY_ON_TOUCH[] = "LiveboxTray='event=touch'"; -} - _LiveboxManagerImpl::_LiveboxManagerImpl() - :__pLiveboxFactory(null) - ,__pLiveboxPopupProviderFactory(null) - ,__pLiveboxPopupProvider(null) - ,__LiveboxPopupTouchEventListener(null) - ,__messageReceived(false) + :__pLiveboxRequestEventListener(null) { SysLog(NID_APP, ""); } @@ -106,46 +89,13 @@ _LiveboxManagerImpl::Construct() { SysLog(NID_APP, "Enter."); - __liveBoxes.Construct(); - __touchEventListeners.Construct(); - int ret = livebox_service_init(); SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "[E_SYSTEM] Failed to invoke livebox_service_init, ret (%d)", ret); - Tizen::App::_AppImpl::GetInstance()->SetAppControlProviderInternalEventListener(this); - SysLog(NID_APP, "Exit."); return E_SUCCESS; } -result -_LiveboxManagerImpl::SetLiveboxProviderFactory(ILiveboxProviderFactory& factory) -{ - __pLiveboxFactory = &factory; - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory) -{ - __pLiveboxPopupProviderFactory = &factory; - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::SetLiveboxTouchEventListener(const String& instanceId, _ILiveboxTouchEventListener& listener) -{ - return __touchEventListeners.Add(instanceId, &listener); -} - -result -_LiveboxManagerImpl::SetLiveboxPopupEventListener(_ILiveboxTouchEventListener& listener) -{ - __LiveboxPopupTouchEventListener = &listener; - - return E_SUCCESS; -} - // c style callback for livebox_service_get_pkglist int GetLiveboxProviderInfoCallback(const char *packageId, const char *pProviderId, int is_prime, void *data) { @@ -166,20 +116,18 @@ int GetLiveboxProviderInfoCallback(const char *packageId, const char *pProviderI } else { - /*int index = 0; - providerId.IndexOf(".", 11, index); - providerId.SubString(0, index, appId); - providerId.SubString(index+1, name);*/ _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, appId, name); } - LiveboxProviderInfo* pInfo = new LiveboxProviderInfo(appId, name); + LiveboxProviderInfo* pInfo = _LiveboxManagerImpl::GetInstance()->GetLiveboxProviderInfoN(appId, name); + pLiveboxProviderInfos->Add(*pInfo); _LiveboxProviderInfoImpl::GetImpl(*pInfo)->__isDefault = is_prime; return 0; } +// c - style callback for shortcut_get_list int GetConfigurableLiveboxInfosCallback(const char* pConfigurationAppControlAppId, const char* pIcon, const char* pDisplayName, const char* pExtraKey, const char* pExtraData, void* data) { // SysLog(NID_APP, "pConfigurationAppControlAppId(%s), pDisplayName(%s)", pConfigurationAppControlAppId, pDisplayName); @@ -212,7 +160,7 @@ int GetConfigurableLiveboxInfosCallback(const char* pConfigurationAppControlAppI } Tizen::Base::Collection::IList* -_LiveboxManagerImpl::GetLiveboxProviderInfosN() +_LiveboxManagerImpl::GetLiveboxProviderInfoListN() { std::unique_ptr pLiveboxProviders(new ArrayList()); SysTryReturn(NID_APP, pLiveboxProviders.get(), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory"); @@ -230,451 +178,46 @@ _LiveboxManagerImpl::GetLiveboxProviderInfosN() LiveboxProviderInfo* _LiveboxManagerImpl::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) { - return new LiveboxProviderInfo(appId, providerName); + return _LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(appId, providerName); } -result -_LiveboxManagerImpl::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) +// c - style callback for shortcut_set_request_cb +int LiveboxRequestEventHandler(const char* providerId, const char* text, int type, const char* content_info, const char* icon, int pid, double period, void *data) { + SysTryReturn(NID_APP, providerId, 0, E_SYSTEM, "[E_SYSTEM] providerId is null!"); - /*if( appId == App::App::GetInstance()->GetAppId()) //TODO: optimazing - { - - } - else*/ - { - _LiveboxManagerProxy::GetInstance()->RequestUpdate(appId, providerName); - } - return E_SUCCESS; -} - -bool -_LiveboxManagerImpl::ContainsLivebox(const String& instanceId) const -{ - bool isCreated = false; - __liveBoxes.ContainsKey(instanceId, isCreated); - - return isCreated; -} - -void -_LiveboxManagerImpl::TerminateAppIfInvalidState() -{ - if( __messageReceived == false ) - { - Tizen::App::App::GetInstance()->Terminate(); - } -} - -void -_LiveboxManagerImpl::OnAppControlRequestReceivedN(RequestId reqId, const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::String& category, const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriScheme, Tizen::Base::Collection::IList* pArgs) -{ - if( pArgs == null && pArgs->GetCount() == 0) - { - SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null."); - return; - } - __messageReceived = true; - - SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount()); - - String *pInstanceId = dynamic_cast(pArgs->GetAt(0)); - SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null."); - - String *pName = dynamic_cast(pArgs->GetAt(1)); - SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null"); - - String *pParam = dynamic_cast(pArgs->GetAt(2)); - SysTryReturnVoidResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pParam is null"); - - SysLog(NID_APP, "id(%ls), name(%ls), param(%ls)", pInstanceId->GetPointer(), pName->GetPointer(), pParam->GetPointer()); - - if(this->ContainsLivebox(*pInstanceId) == false) - { - SysLog(NID_APP, "no livebox instance, creating.."); - - int width = 0; - int height = 0; - String* pValue = dynamic_cast(pArgs->GetAt(3)); - SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, width); - - pValue = dynamic_cast(pArgs->GetAt(4)); - SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, height); - - this->CreateLivebox( *pName, *pInstanceId, width, height, null); - - if( operationId == LIVEBOX_ON_RESIZE) - { - SysLog(NID_APP, "operation is resize, but livebox is already recreated with new size, so OnSize won't be called."); - return; - } - } - - if( operationId.StartsWith(L"LiveboxTray", 0) == true) - { - SysTryReturnVoidResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_FAILURE] __pLiveboxPopupProviderFactory is null"); - HandleLiveboxPopupRequest(operationId, pArgs); - } - else - { - SysTryReturnVoidResult(NID_APP, __pLiveboxFactory, E_FAILURE, "[E_FAILURE] __pLiveboxFactory is null"); - HandleLiveboxRequest(operationId, pArgs); - } - SysLog(NID_APP, "Exit"); -} - -result -_LiveboxManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs) -{ - if( pArgs == null && pArgs->GetCount() < 3) - { - SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null."); - return E_SYSTEM; - } - - SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount()); - - String *pInstanceId = dynamic_cast(pArgs->GetAt(0)); - SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null."); - - /*String *pName = dynamic_cast(pArgs->GetAt(1)); - SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null"); - - String *pParam = dynamic_cast(pArgs->GetAt(2)); - SysTryReturnResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pName is null"); - - SysLog(NID_APP, "id(%ls), name(%d)", pInstanceId->GetPointer(), pName->GetPointer());*/ - - /*if( operationId == LIVEBOX_ON_ADD ) - { - int w = 0; - int h = 0; - String* pValue = dynamic_cast(pArgs->GetAt(2)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, w); - - pValue = dynamic_cast(pArgs->GetAt(3)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, h); - - this->__pLiveboxEventListener->OnLiveboxAdded(*pId, width, height, pArgs); - }*/ - - if (operationId == LIVEBOX_ON_RESIZE) - { - int width = 0; - int height = 0; - String* pValue = dynamic_cast(pArgs->GetAt(3)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, width); - - pValue = dynamic_cast(pArgs->GetAt(4)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, height); - - this->ResizeLivebox(*pInstanceId, width, height); - } - else if (operationId == LIVEBOX_ON_UPDATE) - { - int width = 0; - int height = 0; - String* pValue = dynamic_cast(pArgs->GetAt(3)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE], "); - Integer::Parse(*pValue, width); - - pValue = dynamic_cast(pArgs->GetAt(4)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, height); - - this->UpdateLivebox(*pInstanceId, width, height); - } - else if (operationId == LIVEBOX_ON_REMOVE) - { - this->RemoveLivebox(*pInstanceId); - } - else if (operationId == LIVEBOX_ON_TOUCH) - { - SysAssertf(pArgs->GetCount() == 7, "invalid argc(%d)", pArgs->GetCount() ); - - int eventType = 0; - double timeStamp = 0.0f; - double x = 0.0f; - double y = 0.0f; - - String* pValue = dynamic_cast(pArgs->GetAt(3)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, eventType); - - pValue = dynamic_cast(pArgs->GetAt(4)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Double::Parse(*pValue, timeStamp); - - pValue = dynamic_cast(pArgs->GetAt(5)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Double::Parse(*pValue, x); - - pValue = dynamic_cast(pArgs->GetAt(6)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Double::Parse(*pValue, y); - - this->ForwardTouchEvent(*pInstanceId, eventType, timeStamp, x, y); - } - SysLog(NID_APP, "Exit"); - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs) -{ - SysTryReturnResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_FAILURE] __pLiveboxPopupProviderFactory is null"); - if( pArgs == null && pArgs->GetCount() < 3) - { - SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null."); - return E_SYSTEM; - } - - String *pInstanceId = dynamic_cast(pArgs->GetAt(0)); - SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null."); - - /*String *pName = dynamic_cast(pArgs->GetAt(1)); - SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null"); + _LiveboxManagerImpl* pLiveboxManager = static_cast<_LiveboxManagerImpl*>(data); + SysTryReturn(NID_APP, pLiveboxManager, 0, E_SYSTEM, "[E_SYSTEM] pLiveboxManager is null!"); - String *pParam = dynamic_cast(pArgs->GetAt(2)); - SysTryReturnResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pName is null"); - - SysLog(NID_APP, "id(%ls), name(%d)", pInstanceId->GetPointer(), pName->GetPointer());*/ - - if (operationId == LIVEBOX_TRAY_ON_CREATE) - { - int width = 0; - int height = 0; - - String* pValue = dynamic_cast(pArgs->GetAt(3)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, width); - - pValue = dynamic_cast(pArgs->GetAt(4)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, height); - - this->CreateLiveboxPopupProvider(*pInstanceId); - return E_SUCCESS; - } - else if (operationId == LIVEBOX_TRAY_ON_DESTROY) - { - this->DestroyLiveboxPopupProvider(*pInstanceId); - return E_SUCCESS; - } - else if (operationId == LIVEBOX_TRAY_ON_TOUCH) - { - SysAssertf(pArgs->GetCount() == 6, "invalid argc(%d)", pArgs->GetCount() ); - - int eventType = 0; - double timeStamp = 0.0f; - double x = 0.0f; - double y = 0.0f; - - String* pValue = dynamic_cast(pArgs->GetAt(2)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Integer::Parse(*pValue, eventType); - - pValue = dynamic_cast(pArgs->GetAt(3)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Double::Parse(*pValue, timeStamp); - - pValue = dynamic_cast(pArgs->GetAt(4)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Double::Parse(*pValue, x); - - pValue = dynamic_cast(pArgs->GetAt(5)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); - Double::Parse(*pValue, y); - - ForwardTouchEventForPD(*pInstanceId, eventType, timeStamp, x, y); - } - else - { - SysLog(NID_APP, "unexpected case(%ls)", operationId.GetPointer() ); - } - - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::CreateLivebox(const String& name, const String& instanceId, int width, int height, const String& userInfo) -{ - SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height); - SysTryReturnResult(NID_APP, __pLiveboxFactory, E_FAILURE, "[E_INVALID_OPERATION] __pLiveboxFactory should not be null"); - - LiveboxProvider* pLivebox = __pLiveboxFactory->CreateInstance(name, width, height, userInfo); - SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); - - pLivebox->Construct(instanceId); - __liveBoxes.Add(instanceId, pLivebox); - - pLivebox->OnLiveboxProviderInitializing(width, height, userInfo); - - SysTryReturnResult(NID_APP, pLivebox->GetLiveboxFrame(), E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); - - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::UpdateLivebox(const String& instanceId, int width, int height) -{ - SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height); - - LiveboxProvider* pLivebox = null; - __liveBoxes.GetValue(instanceId, pLivebox); - SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); - - pLivebox->OnLiveboxProviderUpdating(L""); - - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::ResizeLivebox(const String& instanceId, int width, int height) -{ - SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height); - - LiveboxProvider* pLivebox = null; - __liveBoxes.GetValue(instanceId, pLivebox); - SysTryReturnResult(NID_APP, pLivebox, E_SYSTEM, "[E_SYSTEM]"); - - LiveboxFrame* pLiveBoxFrame = pLivebox->GetLiveboxFrame(); - SysTryReturnResult(NID_APP, pLiveBoxFrame, E_INVALID_STATE, "[E_INVALID_STATE]"); - - return pLiveBoxFrame->SetSize(Dimension(width, height)); -} - -result -_LiveboxManagerImpl::RemoveLivebox(const String& instanceId) -{ - SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer() ); -// __pLiveboxEventListener->OnLiveboxRemoved(instanceId); - - LiveboxProvider* pLivebox = null; - __liveBoxes.GetValue(instanceId, pLivebox); - __liveBoxes.Remove(instanceId); - if( pLivebox != null) - { - delete pLivebox; - } - -// this->__pLiveboxEventListener->OnLiveboxRemoved(instanceId); - if( this->__liveBoxes.GetCount() == 0) - { - Tizen::App::App::GetInstance()->Terminate(); - } - - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::CreateLiveboxPopupProvider(const String& instanceId) -{ - SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer()); - SysTryReturnResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_INVALID_OPERATION] __pLiveboxPopupProviderFactory should not be null"); - - LiveboxProvider* pLivebox = null; - __liveBoxes.GetValue(instanceId, pLivebox); - SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); - - LiveboxPopupProvider* pPd = __pLiveboxPopupProviderFactory->CreateInstance(L"test", L""); - __pLiveboxPopupProvider = pPd; - - __pLiveboxPopupProvider->Construct(instanceId); - __pLiveboxPopupProvider->OnLiveboxPopupProviderInitializing(L""); - - LiveboxPopup* pLiveBoxFrame = pPd->GetLiveboxPopup(); - SysTryReturnResult(NID_APP, pLiveBoxFrame, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); - - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::DestroyLiveboxPopupProvider(const String& instanceId) -{ - SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer()); - - if( __pLiveboxPopupProvider != null) - { - __pLiveboxPopupProvider->OnLiveboxPopupProviderTerminating(); - delete __pLiveboxPopupProvider; - __pLiveboxPopupProvider = null; - } - - return E_SUCCESS; -} - -result -_LiveboxManagerImpl::ForwardTouchEvent(const String& instanceId, int eventType, double timeStamp, double x, double y) -{ - SysLog(NID_APP, "instanceId(%ls), eventType(%d), timeStamp(%f), x(%f), y(%f)", instanceId.GetPointer(), eventType, timeStamp, x, y); - - _ILiveboxTouchEventListener* pTouchEventListener = null; - __touchEventListeners.GetValue(instanceId, pTouchEventListener); - SysTryReturnResult(NID_APP, pTouchEventListener, E_INVALID_STATE, "[E_INVALID_STATE]"); + String appId; + String providerName; + _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, appId, providerName); - pTouchEventListener->OnTouchEventRecevied(eventType, timeStamp, x, y); + ILiveboxAddRequestListener* pListener = pLiveboxManager->GetAddRequestListener(); + SysTryReturn(NID_APP, pLiveboxManager, 0, E_SYSTEM, "[E_SYSTEM] pListener is null!"); + pListener->OnLiveboxAddRequested(appId, providerName, text, content_info); - return E_SUCCESS; + return 0; } result -_LiveboxManagerImpl::ForwardTouchEventForPD(const String& instanceId, int eventType, double timeStamp, double x, double y) +_LiveboxManagerImpl::SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener) { - SysTryReturnResult(NID_APP, __LiveboxPopupTouchEventListener, E_INVALID_STATE, "[E_INVALID_STATE]"); - __LiveboxPopupTouchEventListener->OnTouchEventRecevied(eventType, timeStamp, x, y); + int ret = shortcut_set_request_cb(LiveboxRequestEventHandler, this ); + SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "failed to shortcut_set_request_cb (%d)", ret); + __pLiveboxRequestEventListener = pListener; return E_SUCCESS; } -////////////////////////////////////////////////////////////////////////// -// buffer APIs -////////////////////////////////////////////////////////////////////////// - -result -_LiveboxManagerImpl::RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId) -{ - return _LiveboxManagerProxy::GetInstance()->RequestSharedMemoryId(instanceId, width, height, shmId); -} -result -_LiveboxManagerImpl::RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int& shmId) -{ - return _LiveboxManagerProxy::GetInstance()->RequestSharedMemoryIdForPD(instanceId, width, height, shmId); -} - -result -_LiveboxManagerImpl::RequestReleaseSharedMemory(const Tizen::Base::String& instanceId) +ILiveboxAddRequestListener* +_LiveboxManagerImpl::GetAddRequestListener() { - return _LiveboxManagerProxy::GetInstance()->RequestReleaseSharedMemory(instanceId); -} - -result -_LiveboxManagerImpl::RequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId) -{ - return _LiveboxManagerProxy::GetInstance()->RequestReleaseSharedMemoryForPD(instanceId); -} - -result -_LiveboxManagerImpl::RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height) -{ - return _LiveboxManagerProxy::GetInstance()->RequestSyncSharedMemory(instanceId, width, height); -} - -result -_LiveboxManagerImpl::RequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId) -{ - return _LiveboxManagerProxy::GetInstance()->RequestSyncSharedMemoryForPD(instanceId); + return __pLiveboxRequestEventListener; } // helper - result _LiveboxManagerImpl::ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName) { diff --git a/src/FShell_LiveboxManagerProxy.cpp b/src/FShell_LiveboxManagerProxy.cpp index bd1b677..1355120 100644 --- a/src/FShell_LiveboxManagerProxy.cpp +++ b/src/FShell_LiveboxManagerProxy.cpp @@ -22,7 +22,7 @@ #include #include -#include "FShell_LiveboxManagerImpl.h" +#include "FShell_LiveboxProviderManagerImpl.h" #include "FShell_LiveboxManagerProxy.h" namespace Tizen { namespace Shell { @@ -185,13 +185,13 @@ _LiveboxManagerProxy::RequestReleaseSharedMemoryForPD(const Tizen::Base::String& result _LiveboxManagerProxy::OnTouchEventReceived(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y ) { - return _LiveboxManagerImpl::GetInstance()->ForwardTouchEvent(instanceId, eventType, timeStamp, x, y); + return _LiveboxProviderManagerImpl::GetInstance()->ForwardTouchEvent(instanceId, eventType, timeStamp, x, y); } result _LiveboxManagerProxy::OnTouchEventReceivedForPD(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y ) { - return _LiveboxManagerImpl::GetInstance()->ForwardTouchEventForPD(instanceId, eventType, timeStamp, x, y); + return _LiveboxProviderManagerImpl::GetInstance()->ForwardTouchEventForPD(instanceId, eventType, timeStamp, x, y); } void diff --git a/src/FShell_LiveboxPopup.cpp b/src/FShell_LiveboxPopup.cpp index bcd95d0..bbb88b9 100644 --- a/src/FShell_LiveboxPopup.cpp +++ b/src/FShell_LiveboxPopup.cpp @@ -35,7 +35,7 @@ #include "FShell_LiveboxLayer.h" #include "FShell_LiveboxPopup.h" #include "FShell_LiveboxPopupPresenter.h" -#include "FShell_LiveboxManagerImpl.h" +#include "FShell_LiveboxProviderManagerImpl.h" using namespace std; using namespace Tizen::Base; @@ -82,7 +82,7 @@ _LiveboxPopupLayer::~_LiveboxPopupLayer(void) result _LiveboxPopupLayer::RegisterTouchEventListener(void) { - result r = _LiveboxManagerImpl::GetInstance()->SetLiveboxPopupEventListener(*this); + result r = _LiveboxProviderManagerImpl::GetInstance()->SetLiveboxPopupEventListener(*this); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return r; @@ -102,7 +102,7 @@ _LiveboxPopupLayer::AcquirePixmap(void) Rectangle bounds = pWindow->GetBounds(); - result r = _LiveboxManagerImpl::GetInstance()->RequestSharedMemoryIdForPD(GetProviderId(), bounds.width, bounds.height, pixmapId); + result r = _LiveboxProviderManagerImpl::GetInstance()->RequestSharedMemoryIdForPD(GetProviderId(), bounds.width, bounds.height, pixmapId); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r)); SystemTime::GetTicks(ticks); @@ -116,7 +116,7 @@ _LiveboxPopupLayer::AcquirePixmap(void) result _LiveboxPopupLayer::Sync(const Tizen::Graphics::Rectangle& bounds) { - result r = _LiveboxManagerImpl::GetInstance()->RequestSyncSharedMemoryForPD(GetProviderId()); + result r = _LiveboxProviderManagerImpl::GetInstance()->RequestSyncSharedMemoryForPD(GetProviderId()); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return r; @@ -125,7 +125,7 @@ _LiveboxPopupLayer::Sync(const Tizen::Graphics::Rectangle& bounds) void _LiveboxPopupLayer::ReleasePixmap(void) { - _LiveboxManagerImpl::GetInstance()->RequestReleaseSharedMemoryForPD(GetProviderId()); + _LiveboxProviderManagerImpl::GetInstance()->RequestReleaseSharedMemoryForPD(GetProviderId()); } _LiveboxPopup::_LiveboxPopup(void) diff --git a/src/FShell_LiveboxProviderImpl.cpp b/src/FShell_LiveboxProviderImpl.cpp index c8ae734..6a3d228 100644 --- a/src/FShell_LiveboxProviderImpl.cpp +++ b/src/FShell_LiveboxProviderImpl.cpp @@ -68,7 +68,8 @@ _LiveboxProviderImpl::SetLiveboxFrame(LiveboxFrame* pLiveboxFrame) // SysAssertf(pLiveboxFrameImpl != null, "Not-yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_APP, pLiveboxFrameImpl, E_INVALID_OPERATION, "Not-yet constructed! LiveboxFrame::Construct() should be called before use."); - pLiveboxFrameImpl->SetProviderId(GetInstanceId()); + result r = pLiveboxFrameImpl->SetProviderId(GetInstanceId()); + SysTryReturnResult(NID_APP, !IsFailed(r), E_SYSTEM, "Failed to invoke _LiveboxFrameImpl::SetProviderId."); return E_SUCCESS; } diff --git a/src/FShell_LiveboxProviderInfoImpl.cpp b/src/FShell_LiveboxProviderInfoImpl.cpp index e56b909..66c7d51 100644 --- a/src/FShell_LiveboxProviderInfoImpl.cpp +++ b/src/FShell_LiveboxProviderInfoImpl.cpp @@ -104,7 +104,7 @@ _LiveboxProviderInfoImpl::GetCongiturationAppControlAppId() const } Tizen::Base::Collection::IList* -_LiveboxProviderInfoImpl::GetSizeInfosN() const +_LiveboxProviderInfoImpl::GetSizeInfoListN() const { const int SUPPORTED_SIZE_TYPE_MAX = 6; @@ -131,6 +131,11 @@ _LiveboxProviderInfoImpl::GetSizeInfosN() const return pSizes; } +LiveboxProviderInfo* +_LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) +{ + return new LiveboxProviderInfo(appId, providerName); +} _LiveboxProviderInfoImpl* _LiveboxProviderInfoImpl::GetImpl(const LiveboxProviderInfo& liveboxProviderInfo) diff --git a/src/FShell_LiveboxProviderManagerImpl.cpp b/src/FShell_LiveboxProviderManagerImpl.cpp new file mode 100644 index 0000000..c3695b9 --- /dev/null +++ b/src/FShell_LiveboxProviderManagerImpl.cpp @@ -0,0 +1,648 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (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 +// +// 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. +// + +/** + * @file FShell_LiveboxManagerImpl.cpp + * @brief This is the implementation for the _LiveboxManagerImpl class. + */ + +#include + +#include +//#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "FShell_LiveboxManagerProxy.h" +#include "FShell_LiveboxProviderManagerImpl.h" + +#include "FShell_LiveboxProviderInfoImpl.h" + +namespace Tizen { namespace Shell +{ + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::App; +using namespace Tizen::App::Package; +using namespace Tizen::Graphics; + + +namespace +{ +const char LIVEBOX_ON_ADD[] = "Livebox='event=add'"; +const char LIVEBOX_ON_REMOVE[] = "Livebox='event=remove'"; +const char LIVEBOX_ON_UPDATE[] = "Livebox='event=update'"; +const char LIVEBOX_ON_RESIZE[] = "Livebox='event=resize'"; +const char LIVEBOX_ON_TOUCH[] = "Livebox='event=touch'"; +const char LIVEBOX_TRAY_ON_CREATE[] = "LiveboxTray='event=create'"; +const char LIVEBOX_TRAY_ON_DESTROY[] = "LiveboxTray='event=destroy'"; +const char LIVEBOX_TRAY_ON_TOUCH[] = "LiveboxTray='event=touch'"; +} + +_LiveboxProviderManagerImpl::_LiveboxProviderManagerImpl() + :__pLiveboxFactory(null) + ,__pLiveboxPopupProviderFactory(null) + ,__pLiveboxPopupProvider(null) + ,__LiveboxPopupTouchEventListener(null) + ,__messageReceived(false) +{ + SysLog(NID_APP, ""); +} + +_LiveboxProviderManagerImpl::~_LiveboxProviderManagerImpl() +{ + SysLog(NID_APP, ""); +} + + +_LiveboxProviderManagerImpl* +_LiveboxProviderManagerImpl::GetInstance() +{ + static _LiveboxProviderManagerImpl* __pLiveboxManagerImpl = null; + if( __pLiveboxManagerImpl == null) + { + __pLiveboxManagerImpl = new (std::nothrow)_LiveboxProviderManagerImpl; + SysTryReturn(NID_APP, __pLiveboxManagerImpl, null, E_OUT_OF_MEMORY, "Allocating new _LiveboxManagerProxy failed."); + + result r = __pLiveboxManagerImpl->Construct(); + SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r)); + } + return __pLiveboxManagerImpl; +} + +result +_LiveboxProviderManagerImpl::Construct() +{ + SysLog(NID_APP, "Enter."); + + __liveBoxes.Construct(); + __touchEventListeners.Construct(); + + Tizen::App::_AppImpl::GetInstance()->SetAppControlProviderInternalEventListener(this); + + SysLog(NID_APP, "Exit."); + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::SetLiveboxProviderFactory(ILiveboxProviderFactory& factory) +{ + __pLiveboxFactory = &factory; + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory) +{ + __pLiveboxPopupProviderFactory = &factory; + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::SetLiveboxTouchEventListener(const String& instanceId, _ILiveboxTouchEventListener& listener) +{ + return __touchEventListeners.Add(instanceId, &listener); +} + +result +_LiveboxProviderManagerImpl::SetLiveboxPopupEventListener(_ILiveboxTouchEventListener& listener) +{ + __LiveboxPopupTouchEventListener = &listener; + + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) +{ + + /*if( appId == App::App::GetInstance()->GetAppId()) //TODO: optimazing + { + + } + else*/ + { + _LiveboxManagerProxy::GetInstance()->RequestUpdate(appId, providerName); + } + return E_SUCCESS; +} + +namespace +{ +int AddLiveboxCallback(int ret, int pid, void *data) +{ + if( ret != 0) + { + SysLog(NID_APP, "Error.(%d)", ret); + } + + return 0; +} +} + +result +_LiveboxProviderManagerImpl::AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) +{ + SysTryReturnResult(NID_APP, providerAppId.IsEmpty()==false, E_INVALID_ARG, "The providerAppId is empty."); + SysTryReturnResult(NID_APP, providerAppId.GetLength() < NATIVE_APP_MAX_APPID_LENGTH, E_INVALID_ARG, "The providerAppId is too long (Maximum %d bytes).", NATIVE_APP_MAX_APPID_LENGTH); +// SysTryReturnResult(NID_APP, _PackageManagerImpl::IsAppInstalled(providerAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", providerAppId.GetPointer()); + + //TODO :: check privilege + String providerId; + if( providerAppId.StartsWith(L"com.samsung", 0) == true ) + { + SysLog(NID_APP, "[E_INVALID_OPERATION] but allowed to test"); + //TODO:return E_INVALID_OPERATION + providerId = providerAppId; + } + else + { + String localPackageId = _PackageManagerImpl::GetPackageIdByAppId(Tizen::App::App::GetInstance()->GetAppId()); + String liveboxProviderPackageId = _PackageManagerImpl::GetPackageIdByAppId(providerAppId); + if( localPackageId != liveboxProviderPackageId) + { + SysLog(NID_APP, "[E_INVALID_OPERATION] but allowed to test"); + //TODO:return E_INVALID_OPERATION + } + providerId = providerAppId + "." + providerName; + } + + PackageInfo* pPackageInfo = null; + result r = E_SUCCESS; + + pPackageInfo = _PackageManagerImpl::GetInstance()->GetPackageInfoN(providerAppId); + SysTryReturn(NID_APP, pPackageInfo != null, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + String iconPath; //= packageInfo.GetAppIconPath(); + + delete pPackageInfo; + + std::unique_ptr pProviderId(_StringConverter::CopyToCharArrayN(providerId)); + std::unique_ptr pName(_StringConverter::CopyToCharArrayN(text)); + std::unique_ptr pContent(_StringConverter::CopyToCharArrayN(userInfo)); + std::unique_ptr pIcon(_StringConverter::CopyToCharArrayN(iconPath)); + + int ret = add_to_home_livebox(pProviderId.get(), pName.get(), LAUNCH_BY_PACKAGE, pContent.get(), pIcon.get(), -1.0l, AddLiveboxCallback, this); + SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "[E_SYSTEM] failed to add_to_home_livebox (%d)", ret); + + return E_SUCCESS; +} + +bool +_LiveboxProviderManagerImpl::ContainsLivebox(const String& instanceId) const +{ + bool isCreated = false; + __liveBoxes.ContainsKey(instanceId, isCreated); + + return isCreated; +} + +void +_LiveboxProviderManagerImpl::TerminateAppIfInvalidState() +{ + if( __messageReceived == false ) + { + Tizen::App::App::GetInstance()->Terminate(); + } +} + +void +_LiveboxProviderManagerImpl::OnAppControlRequestReceivedN(RequestId reqId, const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::String& category, const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriScheme, Tizen::Base::Collection::IList* pArgs) +{ + if( pArgs == null && pArgs->GetCount() == 0) + { + SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null."); + return; + } + __messageReceived = true; + + SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount()); + + String *pInstanceId = dynamic_cast(pArgs->GetAt(0)); + SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null."); + + String *pName = dynamic_cast(pArgs->GetAt(1)); + SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null"); + + String *pParam = dynamic_cast(pArgs->GetAt(2)); + SysTryReturnVoidResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pParam is null"); + + SysLog(NID_APP, "id(%ls), name(%ls), param(%ls)", pInstanceId->GetPointer(), pName->GetPointer(), pParam->GetPointer()); + + if(this->ContainsLivebox(*pInstanceId) == false) + { + SysLog(NID_APP, "no livebox instance, creating.."); + + int width = 0; + int height = 0; + String* pValue = dynamic_cast(pArgs->GetAt(3)); + SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, width); + + pValue = dynamic_cast(pArgs->GetAt(4)); + SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, height); + + this->CreateLivebox( *pName, *pInstanceId, width, height, null); + + if( operationId == LIVEBOX_ON_RESIZE) + { + SysLog(NID_APP, "operation is resize, but livebox is already recreated with new size, so OnSize won't be called."); + return; + } + } + + if( operationId.StartsWith(L"LiveboxTray", 0) == true) + { + SysTryReturnVoidResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_FAILURE] __pLiveboxPopupProviderFactory is null"); + HandleLiveboxPopupRequest(operationId, pArgs); + } + else + { + SysTryReturnVoidResult(NID_APP, __pLiveboxFactory, E_FAILURE, "[E_FAILURE] __pLiveboxFactory is null"); + HandleLiveboxRequest(operationId, pArgs); + } + SysLog(NID_APP, "Exit"); +} + +result +_LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs) +{ + if( pArgs == null && pArgs->GetCount() < 3) + { + SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null."); + return E_SYSTEM; + } + + SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount()); + + String *pInstanceId = dynamic_cast(pArgs->GetAt(0)); + SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null."); + + /*String *pName = dynamic_cast(pArgs->GetAt(1)); + SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null"); + + String *pParam = dynamic_cast(pArgs->GetAt(2)); + SysTryReturnResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pName is null"); + + SysLog(NID_APP, "id(%ls), name(%d)", pInstanceId->GetPointer(), pName->GetPointer());*/ + + /*if( operationId == LIVEBOX_ON_ADD ) + { + int w = 0; + int h = 0; + String* pValue = dynamic_cast(pArgs->GetAt(2)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, w); + + pValue = dynamic_cast(pArgs->GetAt(3)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, h); + + this->__pLiveboxEventListener->OnLiveboxAdded(*pId, width, height, pArgs); + }*/ + + if (operationId == LIVEBOX_ON_RESIZE) + { + int width = 0; + int height = 0; + String* pValue = dynamic_cast(pArgs->GetAt(3)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, width); + + pValue = dynamic_cast(pArgs->GetAt(4)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, height); + + this->ResizeLivebox(*pInstanceId, width, height); + } + else if (operationId == LIVEBOX_ON_UPDATE) + { + int width = 0; + int height = 0; + String* pValue = dynamic_cast(pArgs->GetAt(3)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE], "); + Integer::Parse(*pValue, width); + + pValue = dynamic_cast(pArgs->GetAt(4)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, height); + + this->UpdateLivebox(*pInstanceId, width, height); + } + else if (operationId == LIVEBOX_ON_REMOVE) + { + this->RemoveLivebox(*pInstanceId); + } + else if (operationId == LIVEBOX_ON_TOUCH) + { + SysAssertf(pArgs->GetCount() == 7, "invalid argc(%d)", pArgs->GetCount() ); + + int eventType = 0; + double timeStamp = 0.0f; + double x = 0.0f; + double y = 0.0f; + + String* pValue = dynamic_cast(pArgs->GetAt(3)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, eventType); + + pValue = dynamic_cast(pArgs->GetAt(4)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Double::Parse(*pValue, timeStamp); + + pValue = dynamic_cast(pArgs->GetAt(5)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Double::Parse(*pValue, x); + + pValue = dynamic_cast(pArgs->GetAt(6)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Double::Parse(*pValue, y); + + this->ForwardTouchEvent(*pInstanceId, eventType, timeStamp, x, y); + } + SysLog(NID_APP, "Exit"); + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs) +{ + SysTryReturnResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_FAILURE] __pLiveboxPopupProviderFactory is null"); + if( pArgs == null && pArgs->GetCount() < 3) + { + SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null."); + return E_SYSTEM; + } + + String *pInstanceId = dynamic_cast(pArgs->GetAt(0)); + SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null."); + + /*String *pName = dynamic_cast(pArgs->GetAt(1)); + SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null"); + + String *pParam = dynamic_cast(pArgs->GetAt(2)); + SysTryReturnResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pName is null"); + + SysLog(NID_APP, "id(%ls), name(%d)", pInstanceId->GetPointer(), pName->GetPointer());*/ + + if (operationId == LIVEBOX_TRAY_ON_CREATE) + { + int width = 0; + int height = 0; + + String* pValue = dynamic_cast(pArgs->GetAt(3)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, width); + + pValue = dynamic_cast(pArgs->GetAt(4)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, height); + + this->CreateLiveboxPopupProvider(*pInstanceId); + return E_SUCCESS; + } + else if (operationId == LIVEBOX_TRAY_ON_DESTROY) + { + this->DestroyLiveboxPopupProvider(*pInstanceId); + return E_SUCCESS; + } + else if (operationId == LIVEBOX_TRAY_ON_TOUCH) + { + SysAssertf(pArgs->GetCount() == 6, "invalid argc(%d)", pArgs->GetCount() ); + + int eventType = 0; + double timeStamp = 0.0f; + double x = 0.0f; + double y = 0.0f; + + String* pValue = dynamic_cast(pArgs->GetAt(2)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Integer::Parse(*pValue, eventType); + + pValue = dynamic_cast(pArgs->GetAt(3)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Double::Parse(*pValue, timeStamp); + + pValue = dynamic_cast(pArgs->GetAt(4)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Double::Parse(*pValue, x); + + pValue = dynamic_cast(pArgs->GetAt(5)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + Double::Parse(*pValue, y); + + ForwardTouchEventForPD(*pInstanceId, eventType, timeStamp, x, y); + } + else + { + SysLog(NID_APP, "unexpected case(%ls)", operationId.GetPointer() ); + } + + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::CreateLivebox(const String& name, const String& instanceId, int width, int height, const String& userInfo) +{ + SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height); + SysTryReturnResult(NID_APP, __pLiveboxFactory, E_FAILURE, "[E_INVALID_OPERATION] __pLiveboxFactory should not be null"); + + LiveboxProvider* pLivebox = __pLiveboxFactory->CreateInstance(name, width, height, userInfo); + SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); + + pLivebox->Construct(instanceId); + __liveBoxes.Add(instanceId, pLivebox); + + pLivebox->OnLiveboxProviderInitializing(width, height, userInfo); + + SysTryReturnResult(NID_APP, pLivebox->GetLiveboxFrame(), E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); + + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::UpdateLivebox(const String& instanceId, int width, int height) +{ + SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height); + + LiveboxProvider* pLivebox = null; + __liveBoxes.GetValue(instanceId, pLivebox); + SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); + + pLivebox->OnLiveboxProviderUpdating(L""); + + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::ResizeLivebox(const String& instanceId, int width, int height) +{ + SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height); + + LiveboxProvider* pLivebox = null; + __liveBoxes.GetValue(instanceId, pLivebox); + SysTryReturnResult(NID_APP, pLivebox, E_SYSTEM, "[E_SYSTEM]"); + + LiveboxFrame* pLiveBoxFrame = pLivebox->GetLiveboxFrame(); + SysTryReturnResult(NID_APP, pLiveBoxFrame, E_INVALID_STATE, "[E_INVALID_STATE]"); + + return pLiveBoxFrame->SetSize(Dimension(width, height)); +} + +result +_LiveboxProviderManagerImpl::RemoveLivebox(const String& instanceId) +{ + SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer() ); +// __pLiveboxEventListener->OnLiveboxRemoved(instanceId); + + LiveboxProvider* pLivebox = null; + __liveBoxes.GetValue(instanceId, pLivebox); + __liveBoxes.Remove(instanceId); + if( pLivebox != null) + { + delete pLivebox; + } + +// this->__pLiveboxEventListener->OnLiveboxRemoved(instanceId); + if( this->__liveBoxes.GetCount() == 0) + { + Tizen::App::App::GetInstance()->Terminate(); + } + + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::CreateLiveboxPopupProvider(const String& instanceId) +{ + SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer()); + SysTryReturnResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_INVALID_OPERATION] __pLiveboxPopupProviderFactory should not be null"); + + LiveboxProvider* pLivebox = null; + __liveBoxes.GetValue(instanceId, pLivebox); + SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); + + LiveboxPopupProvider* pPd = __pLiveboxPopupProviderFactory->CreateInstance(L"test", L""); + __pLiveboxPopupProvider = pPd; + + __pLiveboxPopupProvider->Construct(instanceId); + __pLiveboxPopupProvider->OnLiveboxPopupProviderInitializing(L""); + + LiveboxPopup* pLiveBoxFrame = pPd->GetLiveboxPopup(); + SysTryReturnResult(NID_APP, pLiveBoxFrame, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); + + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::DestroyLiveboxPopupProvider(const String& instanceId) +{ + SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer()); + + if( __pLiveboxPopupProvider != null) + { + __pLiveboxPopupProvider->OnLiveboxPopupProviderTerminating(); + delete __pLiveboxPopupProvider; + __pLiveboxPopupProvider = null; + } + + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::ForwardTouchEvent(const String& instanceId, int eventType, double timeStamp, double x, double y) +{ + SysLog(NID_APP, "instanceId(%ls), eventType(%d), timeStamp(%f), x(%f), y(%f)", instanceId.GetPointer(), eventType, timeStamp, x, y); + + _ILiveboxTouchEventListener* pTouchEventListener = null; + __touchEventListeners.GetValue(instanceId, pTouchEventListener); + SysTryReturnResult(NID_APP, pTouchEventListener, E_INVALID_STATE, "[E_INVALID_STATE]"); + + pTouchEventListener->OnTouchEventRecevied(eventType, timeStamp, x, y); + + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::ForwardTouchEventForPD(const String& instanceId, int eventType, double timeStamp, double x, double y) +{ + SysTryReturnResult(NID_APP, __LiveboxPopupTouchEventListener, E_INVALID_STATE, "[E_INVALID_STATE]"); + __LiveboxPopupTouchEventListener->OnTouchEventRecevied(eventType, timeStamp, x, y); + + return E_SUCCESS; +} +////////////////////////////////////////////////////////////////////////// +// buffer APIs +////////////////////////////////////////////////////////////////////////// + +result +_LiveboxProviderManagerImpl::RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId) +{ + return _LiveboxManagerProxy::GetInstance()->RequestSharedMemoryId(instanceId, width, height, shmId); +} + +result +_LiveboxProviderManagerImpl::RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int& shmId) +{ + return _LiveboxManagerProxy::GetInstance()->RequestSharedMemoryIdForPD(instanceId, width, height, shmId); +} + +result +_LiveboxProviderManagerImpl::RequestReleaseSharedMemory(const Tizen::Base::String& instanceId) +{ + return _LiveboxManagerProxy::GetInstance()->RequestReleaseSharedMemory(instanceId); +} + +result +_LiveboxProviderManagerImpl::RequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId) +{ + return _LiveboxManagerProxy::GetInstance()->RequestReleaseSharedMemoryForPD(instanceId); +} + +result +_LiveboxProviderManagerImpl::RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height) +{ + return _LiveboxManagerProxy::GetInstance()->RequestSyncSharedMemory(instanceId, width, height); +} + +result +_LiveboxProviderManagerImpl::RequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId) +{ + return _LiveboxManagerProxy::GetInstance()->RequestSyncSharedMemoryForPD(instanceId); +} + +}} // Tizen::Shell diff --git a/src/inc/FShell_LiveboxManagerImpl.h b/src/inc/FShell_LiveboxManagerImpl.h index c8f4383..a1796e8 100644 --- a/src/inc/FShell_LiveboxManagerImpl.h +++ b/src/inc/FShell_LiveboxManagerImpl.h @@ -22,8 +22,8 @@ * This header file contains the declarations of the _LiveboxManagerImpl class. */ -#ifndef FShell_LiveboxMANAGERIMPL_H_ -#define FShell_LiveboxMANAGERIMPL_H_ +#ifndef _FSHELL_INTERNAL_LIVEBOX_MANAGERIMPL_H_ +#define _FSHELL_INTERNAL_LIVEBOX_MANAGERIMPL_H_ #include #include @@ -31,94 +31,39 @@ #include #include #include -//#include +#include namespace Tizen { namespace Shell { -class LiveboxFrame; -class LiveboxPopup; - class LiveboxProviderInfo; -class ILiveboxProviderFactory; -class ILiveboxPopupProviderFactory; -class LiveboxProvider; -class LiveboxPopupProvider; -class _ILiveboxTouchEventListener; -class _LiveboxManagerProxy; - - class _OSP_EXPORT_ _LiveboxManagerImpl - : public Tizen::App::IAppControlProviderEventListener - , public Tizen::Base::Object + : public Tizen::Base::Object { public: static _LiveboxManagerImpl* GetInstance(); // API impl - result SetLiveboxProviderFactory(ILiveboxProviderFactory& factory); - result SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory); - - Tizen::Base::Collection::IList* GetLiveboxProviderInfosN(); + Tizen::Base::Collection::IList* GetLiveboxProviderInfoListN(); LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); - - result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); - - // internal API - result RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId); - result RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int& shmId); - result RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height); - result RequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId); - result RequestReleaseSharedMemory(const Tizen::Base::String& instanceId); - result RequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId); + result SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener); // internal - result SetLiveboxTouchEventListener(const Tizen::Base::String& instanceId, _ILiveboxTouchEventListener& listener); - result SetLiveboxPopupEventListener(_ILiveboxTouchEventListener& listener); - - result ForwardTouchEvent(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y); - result ForwardTouchEventForPD(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y); + ILiveboxAddRequestListener* GetAddRequestListener(); // helper static result ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName); - void TerminateAppIfInvalidState(); - private: _LiveboxManagerImpl(); virtual ~_LiveboxManagerImpl(); result Construct(); - result CreateLivebox(const Tizen::Base::String& name, const Tizen::Base::String& instanceId, int width, int height, const Tizen::Base::String& userInfo); - result UpdateLivebox(const Tizen::Base::String& instanceId, int width, int height); - result ResizeLivebox(const Tizen::Base::String& instanceId, int width, int height); - result RemoveLivebox(const Tizen::Base::String& instanceId); - result CreateLiveboxPopupProvider(const Tizen::Base::String& instanceId); - result DestroyLiveboxPopupProvider(const Tizen::Base::String& instanceId); - - bool ContainsLivebox(const Tizen::Base::String& instanceId) const; - - virtual void OnAppControlRequestReceivedN(RequestId reqId, const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::String& category, const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriScheme, Tizen::Base::Collection::IList* pArgs); - // [Temp] abc break - virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData) {} - - result HandleLiveboxRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs); - result HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs); - private: - // for livebox - ILiveboxProviderFactory* __pLiveboxFactory; - Tizen::Base::Collection::HashMapT __liveBoxes; - Tizen::Base::Collection::HashMapT __touchEventListeners; - - // for PD - ILiveboxPopupProviderFactory* __pLiveboxPopupProviderFactory; - LiveboxPopupProvider* __pLiveboxPopupProvider; - _ILiveboxTouchEventListener* __LiveboxPopupTouchEventListener; + ILiveboxAddRequestListener* __pLiveboxRequestEventListener; - bool __messageReceived; }; }} // Tizen::Shell -#endif /* FShell_LiveboxMANAGERIMPL_H_ */ +#endif /* _FSHELL_INTERNAL_LIVEBOX_MANAGERIMPL_H_ */ diff --git a/src/inc/FShell_LiveboxProviderInfoImpl.h b/src/inc/FShell_LiveboxProviderInfoImpl.h index 80e5e17..595d504 100644 --- a/src/inc/FShell_LiveboxProviderInfoImpl.h +++ b/src/inc/FShell_LiveboxProviderInfoImpl.h @@ -103,7 +103,11 @@ public: * @exception E_SYSTEM A system error has occurred. * @remarks The specific error code can be accessed using the GetLastResult() method. */ - Tizen::Base::Collection::IList* GetSizeInfosN() const; + Tizen::Base::Collection::IList* GetSizeInfoListN() const; + + + // internal + static LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); static _LiveboxProviderInfoImpl* GetImpl(const LiveboxProviderInfo& liveboxProviderInfo); diff --git a/src/inc/FShell_LiveboxProviderManagerImpl.h b/src/inc/FShell_LiveboxProviderManagerImpl.h new file mode 100644 index 0000000..7f6a780 --- /dev/null +++ b/src/inc/FShell_LiveboxProviderManagerImpl.h @@ -0,0 +1,118 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (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 +// +// 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. +// + +/** + * @file FShell_LiveboxManagerImpl.h + * @brief This is the header file for the _LiveboxProviderManagerImpl class. + * + * This header file contains the declarations of the _LiveboxProviderManagerImpl class. + */ + +#ifndef FShell_LIVEBOX_PROVIDER_MANAGERIMPL_H_ +#define FShell_LIVEBOX_PROVIDER_MANAGERIMPL_H_ + +#include +#include +#include +#include +#include +#include + + +namespace Tizen { namespace Shell { + +class LiveboxFrame; +class LiveboxPopup; + +class ILiveboxProviderFactory; +class ILiveboxPopupProviderFactory; +class LiveboxProvider; +class LiveboxPopupProvider; +class _ILiveboxTouchEventListener; +class _LiveboxManagerProxy; + + +class _OSP_EXPORT_ _LiveboxProviderManagerImpl + : public Tizen::App::IAppControlProviderEventListener + , public Tizen::Base::Object +{ +public: + static _LiveboxProviderManagerImpl* GetInstance(); + + // public APIs + result SetLiveboxProviderFactory(ILiveboxProviderFactory& factory); + result SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory); + result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); + result AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo); + + // internal APIs + result RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId); + result RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int& shmId); + result RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height); + result RequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId); + result RequestReleaseSharedMemory(const Tizen::Base::String& instanceId); + result RequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId); + + // internal + result SetLiveboxTouchEventListener(const Tizen::Base::String& instanceId, _ILiveboxTouchEventListener& listener); + result SetLiveboxPopupEventListener(_ILiveboxTouchEventListener& listener); + + result ForwardTouchEvent(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y); + result ForwardTouchEventForPD(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y); + + // helper +// static result ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName); + + void TerminateAppIfInvalidState(); + +private: + _LiveboxProviderManagerImpl(); + virtual ~_LiveboxProviderManagerImpl(); + result Construct(); + + result CreateLivebox(const Tizen::Base::String& name, const Tizen::Base::String& instanceId, int width, int height, const Tizen::Base::String& userInfo); + result UpdateLivebox(const Tizen::Base::String& instanceId, int width, int height); + result ResizeLivebox(const Tizen::Base::String& instanceId, int width, int height); + result RemoveLivebox(const Tizen::Base::String& instanceId); + result CreateLiveboxPopupProvider(const Tizen::Base::String& instanceId); + result DestroyLiveboxPopupProvider(const Tizen::Base::String& instanceId); + + bool ContainsLivebox(const Tizen::Base::String& instanceId) const; + + virtual void OnAppControlRequestReceivedN(RequestId reqId, const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::String& category, const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriScheme, Tizen::Base::Collection::IList* pArgs); + // [Temp] abc break + virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData) {} + + result HandleLiveboxRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs); + result HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs); + +private: + // for livebox + ILiveboxProviderFactory* __pLiveboxFactory; + Tizen::Base::Collection::HashMapT __liveBoxes; + Tizen::Base::Collection::HashMapT __touchEventListeners; + + // for PD + ILiveboxPopupProviderFactory* __pLiveboxPopupProviderFactory; + LiveboxPopupProvider* __pLiveboxPopupProvider; + _ILiveboxTouchEventListener* __LiveboxPopupTouchEventListener; + + bool __messageReceived; +}; + +}} // Tizen::Shell +#endif /* FShell_LIVEBOX_PROVIDER_MANAGERIMPL_H_ */ -- 2.7.4