2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file widget_model.cpp
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief Implementation file for widget model
22 #include <widget_model.h>
23 #include <dpl/sstream.h>
24 #include <dpl/event/model_bind_to_dao.h>
25 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
27 #include <dpl/utils/folder_size.h>
29 using namespace WrtDB;
31 template <typename RetType, RetType(WidgetDAOReadOnly::*extFun) () const >
32 struct BindToWidgetDAO :
33 DPL::Event::BindToDAO<WidgetModel,
37 &WidgetModel::getTizenId,
41 template <typename RetType, RetType(*extFun) (DPL::String)>
42 struct BindToWidgetDAOStatic :
43 DPL::Event::BindToDAO_Static<WidgetModel,
46 &WidgetModel::getTizenId,
50 WidgetModel::WidgetModel(const std::string &tizenId) :
51 TizenId(DPL::FromASCIIString(tizenId)),
52 TzPkgId(this, &BindToWidgetDAO<WrtDB::TizenPkgId,
53 &WidgetDAOReadOnly::getTizenPkgId>::Get),
54 Type(this, &BindToWidgetDAO<WidgetType,
55 &WidgetDAOReadOnly::getWidgetType>::Get),
56 CspPolicy(this, &BindToWidgetDAO<DPL::OptionalString,
57 &WidgetDAOReadOnly::getCspPolicy>::Get),
58 CspReportOnlyPolicy(this, &BindToWidgetDAO<DPL::OptionalString,
59 &WidgetDAOReadOnly::getCspPolicyReportOnly>::Get),
62 &BindToWidgetDAO<WidgetSize,
63 &WidgetDAOReadOnly::getPreferredSize>::Get),
65 //localized, so not binded
67 #ifdef APP_SCHEME_ENABLED
68 PrefixURL(this, DPL::String(L"app://") + DPL::FromASCIIString(tizenId) + L"/"),
70 //localized, so not binded
71 // file:// + / : without "/" path, webkit return security error
72 PrefixURL(this, L"file:///"),
76 &BindToWidgetDAO<DPL::String, &WidgetDAOReadOnly::getFullPath>::Get),
77 PersistentStoragePath(this),
78 TemporaryStoragePath(this),
81 &BindToWidgetDAO<DPL::OptionalString,
82 &WidgetDAOReadOnly::getDefaultlocale>::Get),
84 //localized, so not binded
86 //localized, so not binded
88 //localized, so not binded
90 //localized, so not binded
92 //localized, so not binded
96 &BindToWidgetDAO<DPL::OptionalString,
97 &WidgetDAOReadOnly::getSplashImgSrc>::Get),
100 &BindToWidgetDAO<WindowModeList,
101 &WidgetDAOReadOnly::getWindowModes>::Get),
102 //localized, so not binded
103 // AccessNetwork(this, false),
104 // WarpDefinitionEmpty(this),
107 //TODO this type has to be here now, as Property constructor is wrongly
109 (DPL::Event::Property<bool,
110 DPL::Event::PropertyReadOnly,
111 DPL::Event::PropertyStorageDynamicCached>::
113 BindToWidgetDAO<bool, &WidgetDAOReadOnly::getBackSupported>::Get),
116 AppControlList(this),
117 AppControlIndex(this),
118 SecurityModelVersion(this, &BindToWidgetDAO<WidgetSecurityModelVersion, &WidgetDAOReadOnly::getSecurityModelVersion>::Get),
119 SecurePopupUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getSecurityPopupUsage>::Get),
120 GeolocationUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getGeolocationUsage>::Get),
121 WebNotificationUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getWebNotificationUsage>::Get),
122 WebStorageUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getWebDatabaseUsage>::Get)
125 DPL::String WidgetModel::getTizenId() const