Tizen 2.0 Release
[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.0 (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         Tizen::Base::String pageTitle;
63         Tizen::Base::String pageUrl;
64         Tizen::Web::Controls::Web* pCurrentWeb;
65         Tizen::Graphics::Bitmap* pFavicon;
66         static Tizen::Graphics::Bitmap* pFormCanvasBitmap;
67         Tizen::Graphics::Bitmap* pWebCanvasBitmap;
68         Tizen::Base::String sceneID;
69   private:
70         static int __windowId;
71   };
72
73 class MultipleWindowPresentationModel
74 {
75 public:
76
77         /**
78          * This method add the windowInfo object in ArrayList
79          *
80          * @return              An error code
81          * @param[in]   WindowInfo The windowInfo object to be added.
82          * @exception   E_SUCCESS               The method is successful.
83          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
84          * @remarks             This method performs a shallow copy. It adds just the pointer; not the element itself.
85          */
86         result AddWindoInfo(WindowInfo* pWindowInfo);
87
88         /**
89          *@name         CreateNewMainViewScene
90          *@brief        Create new instance of MainScene form
91          *@param[in]    no input parameter
92          *@retval               no return value
93          */
94         WindowInfo* CreateNewMainViewScene(const Tizen::Base::String& Url = L"", bool isAppControlTriggered = false);
95
96         /**
97          * To get active Window URL and title
98          *
99          * @return              An error code
100          * @param       title
101          * @param       url
102          * @exception   E_SUCCESS                       The method is successful.
103          */
104         WindowInfo* GetActiveWindowInfo(void);
105
106         /**
107          * This method returns the ArrayList object
108          *
109          * @return              ArrayList*
110          * @param[in]   void
111          * @remarks             Return the ArrayList object
112          */
113         Tizen::Base::Collection::ArrayList* GetAllWindowArrayList(void);
114
115         /**
116          * To get current sceneID of Main Form
117          *
118          * @return              An error code
119          * @param       currentSceneID      The  Current Scene ID
120          * @exception   E_SUCCESS                       The method is successful.
121          */
122         void GetCurrentSceneId(Tizen::Base::String& currentSceneId);
123
124         /**
125          * @brief               The method used to get the already created instance of the MultipleWindowPresentationModel
126          */
127         static MultipleWindowPresentationModel* GetInstance(void);
128
129         /**
130          * Object is returned corresponding to its key value
131          *
132          * @return              An error code
133          * @param[in]   key The key of the object needed
134          * @param[in]   Object A pointer to a pointer to an objec_t
135          * @exception   E_SUCCESS               The method is successful.
136          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
137          * @remarks             To work properly, existing key has to be passed
138          */
139         result GetValue(Key key, Tizen::Base::Object**);
140
141         /**
142          * To set current sceneID of Main Form
143          *
144          * @return              An error code
145          * @param       currentSceneID      The  Current Scene ID
146          * @exception   E_SUCCESS                       The method is successful.
147          */
148         void SetCurrentSceneID(const Tizen::Base::String& currentSceneID);
149
150         /**
151          * Object is set corresponding to its key value
152          *
153          * @return              An error code
154          * @param[in]   key The key of the object to be set
155          * @param[in]   Object A pointer to an object
156          * @exception   E_SUCCESS                       The method is successful.
157          * @exception   E_INVALID_ARG           A specified input parameter is invalid, or
158          *                                                                      the comparer has failed to compare the keys.
159          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found in the map.
160          * @remarks             To work properly, existing key and object has to be passed
161          */
162         result SetValue(Key key, Tizen::Base::Object*);
163
164         /**
165          * Uninitialize MultiWindowManager
166          *
167          * @return              no return value
168          * @param[in]   no input parameters
169          */
170         void UnInitialize(void);
171 private:
172
173         /**
174          * Default constructor, It is declared as private to make this class a singleton class
175          */
176         MultipleWindowPresentationModel(void);
177
178         /**
179          * Default destructor
180          */
181         virtual ~MultipleWindowPresentationModel(void);
182
183         /**
184          * copy constructor
185          */
186         MultipleWindowPresentationModel(const MultipleWindowPresentationModel& multipleWindowModelObj);
187
188         /**
189          * assignment operator
190          */
191
192         MultipleWindowPresentationModel& operator=(const MultipleWindowPresentationModel& multipleWindowModelObj);
193
194         /**
195          * Initializing MultiWindowManager
196          *
197          * @return              An error code
198          * @param[in]   no input parameters
199          * @exception   E_SUCCESS               The method is successful.
200          * @exception   E_INVALID_ARG   A specified input parameter is invalid, or
201          *                                                              the @c capacity or the @c loadFactor is negative.
202          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
203          */
204
205         result Construct(void);
206
207         /**
208          * @brief               The method used to create the instance of the MultipleWindowPresentationModel class
209          */
210         static void CreateInstance(void);
211
212         /**
213          * @brief               The method used to remove the already created instance of the MultipleWindowPresentationModel
214          */
215         static void DestroyInstance(void);
216
217
218 private:
219         static Tizen::Base::String __currentSceneId;
220         static Tizen::Base::Collection::HashMapT< Key, Tizen::Base::Object* > __keyAndValues;
221         static Tizen::Base::Collection::ArrayList* __pAllWindowList;
222         static WindowInfo* __pCurWindowInfo;
223         static MultipleWindowPresentationModel* __pMultiWindowManager;
224 };
225
226 #endif // _INT_MULTIPLE_WINDOW_PRESENTATION_MODEL_H_