Initialize Tizen 2.3
[apps/osp/Internet.git] / inc / IntMultipleWindowPresentationModel.h
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 //!Internet
19 /*@file:    IntMultipleWindowPresentationModel.h
20  *@brief:       MultipleWindowPresentationModel is used to maintain browser window information
21  *
22  */
23 #ifndef _INT_MULTIPLE_WINDOW_PRESENTATION_MODEL_H_
24 #define _INT_MULTIPLE_WINDOW_PRESENTATION_MODEL_H_
25
26 #include <FBase.h>
27 #include <FGraphics.h>
28 #include <FUi.h>
29 #include <FWeb.h>
30
31 #include "IntFaviconManager.h"
32 #include "IntFormFactory.h"
33 #include "IntSceneRegister.h"
34
35 enum Key
36 {
37         SELECTED_SCENE_ID
38 };
39 class MainForm;
40
41 class WindowInfo
42 : public Tizen::Base::Object
43   {
44   public:
45         /**
46          * WindowInfo default constructor
47          */
48         WindowInfo();
49
50         /**
51          * WindowInfo default destructor
52          */
53         ~WindowInfo();
54
55   public:
56         Tizen::Base::String faviconUrl;
57         Tizen::Base::String faviconFilePath;
58         Tizen::Base::String formID;
59         int ID;
60         bool isAppcontrolTriggered;
61         bool isJavascriptInitiated;
62         bool isFirstLaunch;
63         Tizen::Base::String pageTitle;
64         Tizen::Base::String pageUrl;
65         Tizen::Web::Controls::Web* pCurrentWeb;
66         Tizen::Graphics::Bitmap* pFavicon;
67         static Tizen::Graphics::Bitmap* pFormCanvasBitmap;
68         Tizen::Graphics::Bitmap* pWebCanvasBitmap;
69         Tizen::Base::String sceneID;
70   private:
71         static int __windowId;
72   };
73
74 class MultipleWindowPresentationModel
75 {
76 public:
77
78         /**
79          * This method add the windowInfo object in ArrayList
80          *
81          * @return              An error code
82          * @param[in]   WindowInfo The windowInfo object to be added.
83          * @exception   E_SUCCESS               The method is successful.
84          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
85          * @remarks             This method performs a shallow copy. It adds just the pointer; not the element itself.
86          */
87         result AddWindoInfo(WindowInfo* pWindowInfo);
88
89         /**
90          *@name         CreateNewMainViewScene
91          *@brief        Create new instance of MainScene form
92          *@param[in]    no input parameter
93          *@retval               no return value
94          */
95         WindowInfo* CreateNewMainViewSceneN(const Tizen::Base::String& Url = L"", bool isAppControlTriggered = false);
96
97         /**
98          * To get active Window URL and title
99          *
100          * @return              An error code
101          * @param       title
102          * @param       url
103          * @exception   E_SUCCESS                       The method is successful.
104          */
105         WindowInfo* GetActiveWindowInfo(void);
106
107         /**
108          * This method returns the ArrayList object
109          *
110          * @return              ArrayList*
111          * @param[in]   void
112          * @remarks             Return the ArrayList object
113          */
114         Tizen::Base::Collection::ArrayList* GetAllWindowArrayList(void);
115
116         /**
117          * To get current sceneID of Main Form
118          *
119          * @return              An error code
120          * @param       currentSceneID      The  Current Scene ID
121          * @exception   E_SUCCESS                       The method is successful.
122          */
123         void GetCurrentSceneId(Tizen::Base::String& currentSceneId);
124
125         /**
126          * @brief               The method used to get the already created instance of the MultipleWindowPresentationModel
127          */
128         static MultipleWindowPresentationModel* GetInstance(void);
129
130         /**
131          * Object is returned corresponding to its key value
132          *
133          * @return              An error code
134          * @param[in]   key The key of the object needed
135          * @param[in]   Object A pointer to a pointer to an objec_t
136          * @exception   E_SUCCESS               The method is successful.
137          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
138          * @remarks             To work properly, existing key has to be passed
139          */
140         result GetValue(Key key, Tizen::Base::Object**);
141
142         /**
143          * To set current sceneID of Main Form
144          *
145          * @return              An error code
146          * @param       currentSceneID      The  Current Scene ID
147          * @exception   E_SUCCESS                       The method is successful.
148          */
149         void SetCurrentSceneID(const Tizen::Base::String& currentSceneID);
150
151         /**
152          * Object is set corresponding to its key value
153          *
154          * @return              An error code
155          * @param[in]   key The key of the object to be set
156          * @param[in]   Object A pointer to an object
157          * @exception   E_SUCCESS                       The method is successful.
158          * @exception   E_INVALID_ARG           A specified input parameter is invalid, or
159          *                                                                      the comparer has failed to compare the keys.
160          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found in the map.
161          * @remarks             To work properly, existing key and object has to be passed
162          */
163         result SetValue(Key key, Tizen::Base::Object*);
164
165         /**
166          * Uninitialize MultiWindowManager
167          *
168          * @return              no return value
169          * @param[in]   no input parameters
170          */
171         void UnInitialize(void);
172
173         /**
174          * Uninitialize MultiWindowManager
175          *
176          * @return              no return value
177          * @param[in]   pTitle          The Title of the popup to be created
178          * @param[in]   pText           The Text of the popup to be created
179          */
180         void ShowPopup(Tizen::Base::String& pTitle, Tizen::Base::String& pText);
181
182 private:
183
184         /**
185          * Default constructor, It is declared as private to make this class a singleton class
186          */
187         MultipleWindowPresentationModel(void);
188
189         /**
190          * Default destructor
191          */
192         virtual ~MultipleWindowPresentationModel(void);
193
194         /**
195          * copy constructor
196          */
197         MultipleWindowPresentationModel(const MultipleWindowPresentationModel& multipleWindowModelObj);
198
199         /**
200          * assignment operator
201          */
202
203         MultipleWindowPresentationModel& operator=(const MultipleWindowPresentationModel& multipleWindowModelObj);
204
205         /**
206          * Initializing MultiWindowManager
207          *
208          * @return              An error code
209          * @param[in]   no input parameters
210          * @exception   E_SUCCESS               The method is successful.
211          * @exception   E_INVALID_ARG   A specified input parameter is invalid, or
212          *                                                              the @c capacity or the @c loadFactor is negative.
213          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
214          */
215
216         result Construct(void);
217
218         /**
219          * @brief               The method used to create the instance of the MultipleWindowPresentationModel class
220          */
221         static void CreateInstance(void);
222
223         /**
224          * @brief               The method used to remove the already created instance of the MultipleWindowPresentationModel
225          */
226         static void DestroyInstance(void);
227
228
229 private:
230         static Tizen::Base::String __currentSceneId;
231         static Tizen::Base::Collection::HashMapT< Key, Tizen::Base::Object* > __keyAndValues;
232         static Tizen::Base::Collection::ArrayList* __pAllWindowList;
233         static WindowInfo* __pCurWindowInfo;
234         static MultipleWindowPresentationModel* __pMultiWindowManager;
235         bool __isShowInProcess;
236 };
237
238 #endif // _INT_MULTIPLE_WINDOW_PRESENTATION_MODEL_H_