DESTINATION share/wrt-engine/
)
ADD_CUSTOM_COMMAND(
- OUTPUT ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
- COMMAND edje_cc
- ARGS ${PROJECT_SOURCE_DIR}/data/communicationBox.edc
- ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
- DEPENDS ${PROJECT_SOURCE_DIR}/data/communicationBox.edc
- )
-ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
COMMAND edje_cc -id ${PROJECT_SOURCE_DIR}/data/images
ARGS ${PROJECT_SOURCE_DIR}/data/wrt_theme.edc
${PROJECT_SOURCE_DIR}/data/Platform.edj
DEPENDS ${PROJECT_SOURCE_DIR}/data/Platform.edc
)
-ADD_CUSTOM_TARGET( ACE_EDJES ALL DEPENDS
- ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
- )
ADD_CUSTOM_TARGET( WRT_THEME_EDJES ALL DEPENDS
${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
)
INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
DESTINATION share/edje/ace/
)
-INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
- DESTINATION share/edje/ace/
- )
INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
DESTINATION share/edje/wrt/
)
static_cast<DPL::Event::Property<bool,
DPL::Event::PropertyReadOnly,
DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
- (& GlobalModel::ReadDeveloperMode)),
- SecureByDefault(this,
- static_cast<DPL::Event::Property<bool,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
- (& GlobalModel::ReadSecureByDefault)),
- ComplianceMode(this,
- static_cast<DPL::Event::Property<bool,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType>
- (& GlobalModel::readComplianceMode)),
- ComplianceFakeImei(this,
- & GlobalModel::readComplianceFakeImei),
- ComplianceFakeMeid(this,
- & GlobalModel::readComplianceFakeMeid)
+ (& GlobalModel::ReadDeveloperMode))
{
}
{
return GlobalDAOReadOnly::GetDeveloperMode();
}
-
-bool GlobalModel::ReadSecureByDefault(DPL::Event::Model */*model*/)
-{
- return GlobalDAOReadOnly::GetSecureByDefault();
-}
-
-bool GlobalModel::readComplianceMode(DPL::Event::Model * /* model */)
-{
- return GlobalDAOReadOnly::getComplianceMode();
-}
-
-std::string GlobalModel::readComplianceFakeImei(DPL::Event::Model * /* model */)
-{
- return GlobalDAOReadOnly::getComplianceFakeImei();
-}
-
-std::string GlobalModel::readComplianceFakeMeid(DPL::Event::Model * /* model */)
-{
- return GlobalDAOReadOnly::getComplianceFakeMeid();
-}
DPL::Event::PropertyReadOnly,
DPL::Event::PropertyStorageDynamicCached> DeveloperMode;
- DPL::Event::Property<bool,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached> SecureByDefault;
-
- DPL::Event::Property<bool,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached> ComplianceMode;
-
- DPL::Event::Property<std::string,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached> ComplianceFakeImei;
-
- DPL::Event::Property<std::string,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached> ComplianceFakeMeid;
-
GlobalModel();
private:
static NetworkAccessMode RoamingNetworkAccessReadProperty(DPL::Event::Model *model);
static bool ReadDeveloperMode(DPL::Event::Model *model);
-
- static bool ReadSecureByDefault(DPL::Event::Model *model);
-
- static bool readComplianceMode(DPL::Event::Model *model);
-
- static std::string readComplianceFakeImei(DPL::Event::Model *model);
-
- static std::string readComplianceFakeMeid(DPL::Event::Model *model);
};
#endif // WRT_COMMON_GLOBAL_MODEL_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 CommunicationBox.cpp
- * @author Justyna Mejzner (j.kwiatkowsk@samsung.com)
- * @version 1.0
- *
- */
-#include "CommunicationBox.h"
-#include <stddef.h>
-#include <dpl/log/log.h>
-
-namespace Wrt {
-void CommunicationBox::showAsync(
- const Prompt::PromptModel::PromptType promptType,
- const std::string& mainLabel,
- const std::vector<std::string>& buttonLabels,
- const DPL::OptionalString& checkLabel,
- ResponseDelegate callback,
- void* userdata)
-{
- m_callback = callback;
- m_userdata = userdata;
- m_promptType = promptType;
- using namespace DPL::Popup;
-
- CtrlPopupPtr popup = PopupControllerSingleton::Instance().CreatePopup();
- popup->Append(new PopupObject::Label(mainLabel));
-
- if (!!checkLabel)
- {
- popup->Append(new PopupObject::Check(DPL::ToUTF8String(*checkLabel)));
- }
-
- for (size_t questionIndex = 0; questionIndex < buttonLabels.size();
- ++questionIndex)
- {
- popup->Append(new PopupObject::Button(
- buttonLabels[questionIndex],questionIndex));
- }
-
-
- ListenForAnswer(popup);
-
- //nested loop is not used here
- ShowPopupEventShort event(popup,
- MakeAnswerCallback(
- this,
- &CommunicationBox::AnswerCallback));
-
- CONTROLLER_POST_EVENT(PopupController,
- event);
-}
-
-void CommunicationBox::AnswerCallback(const DPL::Popup::AnswerCallbackData &answer)
-{
- m_callback(answer.buttonAnswer, answer.chackState, m_userdata);
-}
-
-
-Prompt::PromptModel::PromptType CommunicationBox::getPromptType() const
-{
- return m_promptType;
-}
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 CommunicationBox.h
- * @author Justyna Mejzner (j.kwiatkowsk@samsung.com)
- * @version 1.0
- *
- */
-
-#ifndef _WRT_SRC_DOMAIN_EFL_COMMUNICATION_BOX_H
-#define _WRT_SRC_DOMAIN_EFL_COMMUNICATION_BOX_H
-
-#include <memory>
-#include <iostream>
-#include <dpl/string.h>
-#include <dpl/fast_delegate.h>
-#include <dpl/optional_typedefs.h>
-#include <dpl/popup/popup_controller.h>
-#include <dpl/popup/popup_manager.h>
-#include <dpl/popup/popup_renderer.h>
-#include <dpl/framework_efl.h>
-#include "PromptModel.h"
-
-namespace Wrt {
-class CommunicationBox :
- public DPL::Popup::PopupControllerUser
-{
- private:
- void AnswerCallback(const DPL::Popup::AnswerCallbackData &answer);
-
- public:
- typedef DPL::FastDelegate<void (int buttonAnswer,
- bool checkState,
- void* userdata)>
- ResponseDelegate;
-
- CommunicationBox() :
- m_promptType(Prompt::PromptModel::PROMPT_ONESHOT),
- m_callback(NULL),
- m_userdata(NULL)
- {
- }
-
- void showAsync(const Prompt::PromptModel::PromptType promptType,
- const std::string& mainLabel,
- const std::vector<std::string>& buttonLabels,
- const DPL::OptionalString& checkLabel,
- ResponseDelegate callback,
- void* userdata);
-
- Prompt::PromptModel::PromptType getPromptType() const;
-
- private:
-
- Prompt::PromptModel::PromptType m_promptType;
- ResponseDelegate m_callback;
- void* m_userdata;
-};
-}
-#endif //_WRT_SRC_DOMAIN_EFL_COMMUNICATION_BOX_H
#include <stdlib.h>
#include "PopupEnum.h"
#include "PopupSerializer.h"
-#include "security_daemon_dbus_config.h"
-#include "popup_response_server_api.h"
namespace {
const char *POPUP_EXEC = "/usr/bin/wrt-popup";
}
}
-bool PopupInvoker::showSyncPopup(int popupType, const AceUserdata& aceData)
-{
- Try
- {
- DPL::BinaryQueue data;
- PopupSerializer::appendArg(ACE_PROMPT, data);
- PopupSerializer::appendArg(popupType, data);
- PopupSerializer::appendArg(aceData.resource, data);
- DPL::NamedInputPipe tmp;
- tmp.Open(m_outputName);
- m_output.Open(m_outputName);
- m_input.Open(m_inputName);
- m_output.Write(data, data.Size());
-
- executePopup();
-
- //Result from popup application is available. Read it.
- DPL::BinaryQueueAutoPtr resultData =
- m_input.Read(std::numeric_limits<std::size_t>::max());
- const int result = PopupSerializer::getIntArg(*resultData);
- const int validity = PopupSerializer::getIntArg(*resultData);
-
- Assert(resultData->Empty());
-
- tmp.Close();
- m_input.Close();
- m_output.Close();
-
- Prompt::PromptAnswer answer(result,
- static_cast<Prompt::Validity>(validity));
-
- LogDebug("Answer: " << result << " Validity: " << validity);
-
- //ASK SECURITY DAEMON
- if (!result &&
- Prompt::Validity::ONCE == answer.getValidity())
- {
- LogInfo("User answer is DENY ONCE. Don't call security daemon");
- }
- else
- {
- LogInfo("calling security daemon");
- bool securityResponse =
- securityDaemonCall(answer.isAccessAllowed(),
- answer.getValidity(),
- aceData);
-
- if(!securityResponse)
- {
- LogError("Security Daemon has responded with false!");
- return false;
- }
- LogInfo("Security Daemon has responded with true");
- }
-
- return answer.isAccessAllowed();
- }
- Catch(DPL::Exception)
- {
- LogError("error occured");
- }
- // if error then return deny once
- return false;
-}
-
bool PopupInvoker::askYesNo(const std::string& title, const std::string& message)
{
Try
DPL::WaitableHandle handle = m_input.WaitableReadHandle();
DPL::WaitForSingleHandle(handle);
}
-
-bool PopupInvoker::securityDaemonCall(bool allowed,
- Prompt::Validity valid,
- const AceUserdata &data)
-{
- if(!m_dbusPopupClient)
- m_dbusPopupClient.reset(new DPL::DBus::Client(
- WrtSecurity::SecurityDaemonConfig::OBJECT_PATH(),
- WrtSecurity::SecurityDaemonConfig::SERVICE_NAME(),
- WrtSecurity::PopupServerApi::INTERFACE_NAME()));
-
- bool response = false;
- Try {
- m_dbusPopupClient->call(
- WrtSecurity::PopupServerApi::VALIDATION_METHOD(),
- allowed,
- static_cast<int>(valid),
- data.handle,
- data.subject,
- data.resource,
- data.paramKeys,
- data.paramValues,
- data.sessionId,
- &response);
- } Catch (DPL::DBus::Client::Exception::DBusClientException) {
- ReThrowMsg(PopupInvoker::Exception::PopupInvokerException,
- "Failed to call security daemon");
- }
-
- return response;
-}
} // Wrt
#ifndef WRT_POPUP_INVOKER_H
#define WRT_POPUP_INVOKER_H
-#include <PromptModel.h>
-
#include <string>
-#include <memory>
#include <dpl/named_input_pipe.h>
#include <dpl/named_output_pipe.h>
-#include <dpl/dbus/dbus_client.h>
#include "popup_ace_data_types.h"
PopupInvoker();
~PopupInvoker();
- bool showSyncPopup(int popupType, const AceUserdata& aceData);
-
bool askYesNo(const std::string &title, const std::string &message);
private:
void executePopup();
- bool securityDaemonCall(bool allowed,
- Prompt::Validity valid,
- const AceUserdata &data);
DPL::NamedInputPipe m_input;
DPL::NamedOutputPipe m_output;
const std::string m_inputName;
const std::string m_outputName;
- std::unique_ptr<DPL::DBus::Client> m_dbusPopupClient;
};
} // Wrt
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 PromptModel.cpp
- * @author Justyna Mejzner (j.kwiatkowsk@samsung.com)
- * @author Jaroslaw Osmanski (j.osmanski@samsung.com)
- * @version 1.0
- *
- */
-
-#include <PromptModel.h>
-
-#include <algorithm>
-#include <dpl/log/log.h>
-#include <dpl/assert.h>
-
-namespace Wrt {
-namespace {
-
-const char INFO[] = "Widget requires access to:";
-const char DENY[] = "Deny";
-const char ALLOW[] = "Permit";
-
-const char BLANKET_CHECKBOX_LABEL[] = "Keep setting as permanent";
-const char SESSION_CHECKBOX_LABEL[] = "Remember for one run";
-
-Prompt::ButtonLabels aceQuestionLabel = {DENY, ALLOW};
-
-static Prompt::PromptLabels* getModel(
- Prompt::PromptModel::PromptType promptType,
- const std::string& resourceId)
-{
- std::string strLabel;
- strLabel = INFO;
- strLabel += "<br>";
- strLabel += resourceId;
-
- return new Prompt::PromptLabels(promptType, aceQuestionLabel, strLabel);
-}
-
-Prompt::Validity fromPromptTypeToValidity(int aPromptType, bool checkClicked)
-{
- using namespace Prompt;
- PromptModel::PromptType promptTypeEnum =
- static_cast<PromptModel::PromptType>(aPromptType);
- switch (promptTypeEnum) {
- case PromptModel::PROMPT_ONESHOT:
- return Validity::ONCE;
- case PromptModel::PROMPT_SESSION:
- if (checkClicked)
- {
- return Validity::SESSION;
- }
- else
- {
- return Validity::ONCE;
- }
- case PromptModel::PROMPT_BLANKET:
- if (checkClicked)
- {
- return Validity::ALWAYS;
- }
- else
- {
- return Validity::ONCE;
- }
- default:
- Assert(0);
- return Validity::ONCE;
- }
-}
-} // namespace anonymous
-
-namespace Prompt {
-
-
-PromptLabels::PromptLabels(int promptType,
- const Prompt::ButtonLabels& questionLabel,
- const std::string& mainLabel) :
- m_promptType(promptType),
- m_buttonLabels(questionLabel),
- m_mainLabel(mainLabel)
-{
-
-}
-
-int PromptLabels::getPromptType() const
-{
- return m_promptType;
-}
-const ButtonLabels& PromptLabels::getButtonLabels() const
-{
- return m_buttonLabels;
-}
-const std::string& PromptLabels::getMainLabel() const
-{
- return m_mainLabel;
-}
-
-DPL::OptionalString PromptLabels::getCheckLabel() const
-{
- if (PromptModel::PROMPT_BLANKET == m_promptType)
- {
- return DPL::OptionalString(
- DPL::FromUTF8String(BLANKET_CHECKBOX_LABEL));
- }
- else if (PromptModel::PROMPT_SESSION == m_promptType)
- {
- return DPL::OptionalString(
- DPL::FromUTF8String(SESSION_CHECKBOX_LABEL));
- }
-
- return DPL::OptionalString::Null;
-}
-
-bool PromptLabels::isAllowed(const size_t buttonClicked) const
-{
- Assert(buttonClicked < aceQuestionLabel.size() &&
- "Button Clicked number is not in range of questionLabel");
-
- return aceQuestionLabel[buttonClicked] == ALLOW;
-}
-
-PromptAnswer::PromptAnswer(bool isAccessAllowed, Validity validity) :
- m_isAccessAllowed(isAccessAllowed),
- m_validity(validity)
-{
-
-}
-
-PromptAnswer::PromptAnswer(
- int aPromptType, unsigned int buttonAns, bool checkAns)
-{
- Assert(buttonAns < aceQuestionLabel.size() &&
- "Button Clicked number is not in range of questionLabel");
-
- m_isAccessAllowed = aceQuestionLabel[buttonAns] == ALLOW;
- m_validity = fromPromptTypeToValidity(aPromptType, checkAns);
-}
-
-bool PromptAnswer::isAccessAllowed() const
-{
- return m_isAccessAllowed;
-}
-
-Validity PromptAnswer::getValidity() const
-{
- return m_validity;
-}
-
-PromptLabels* PromptModel::getOneShotModel(const std::string& resourceId)
-{
- return getModel(PROMPT_ONESHOT, resourceId);
-}
-
-PromptLabels* PromptModel::getSessionModel(const std::string& resourceId)
-{
- return getModel(PROMPT_SESSION, resourceId);
-}
-
-PromptLabels* PromptModel::getBlanketModel(const std::string& resourceId)
-{
- return getModel(PROMPT_BLANKET, resourceId);
-}
-
-
-} // Prompt
-} // Wrt
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 PromptModel.h
- * @author Justyna Mejzner (j.kwiatkowsk@samsung.com)
- * @author Jaroslaw Osmanski (j.osmanski@samsung.com)
- * @version 1.0
- *
- */
-
-#ifndef WRT_SRC_ACCESSCONTROL_ENGINE_PROMPT_MODEL_H_
-#define WRT_SRC_ACCESSCONTROL_ENGINE_PROMPT_MODEL_H_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <dpl/optional_typedefs.h>
-
-namespace Wrt {
-namespace Prompt {
-typedef std::vector<std::string> ButtonLabels;
-
-class PromptLabels
-{
-public:
- PromptLabels(int promptType,
- const Prompt::ButtonLabels& questionLabel,
- const std::string& mainLabel);
- DPL::OptionalString getCheckLabel() const;
- bool isAllowed(const size_t buttonNumber) const;
- int getPromptType() const;
- const ButtonLabels& getButtonLabels() const;
- const std::string& getMainLabel() const;
-
-private:
- int m_promptType;
- ButtonLabels m_buttonLabels;
- std::string m_mainLabel;
-};
-
-typedef std::unique_ptr<PromptLabels> PromptLabelsPtr;
-
-enum Validity
-{
- ONCE,
- SESSION,
- ALWAYS
-};
-
-class PromptAnswer
-{
-public:
- PromptAnswer(bool isAccessAllowed, Validity validity);
- PromptAnswer(int aPromptType, unsigned int buttonAns, bool checkAns);
- bool isAccessAllowed() const;
- Validity getValidity() const;
-
-private:
- bool m_isAccessAllowed;
- Validity m_validity;
-};
-
-class PromptModel
-{
- public:
- static PromptLabels* getOneShotModel(const std::string& resourceId);
- static PromptLabels* getSessionModel(const std::string& resourceId);
- static PromptLabels* getBlanketModel(const std::string& resourceId);
-
- enum PromptType
- {
- PROMPT_ONESHOT,
- PROMPT_SESSION,
- PROMPT_BLANKET
- };
-};
-
-} // Prompt
-} // Wrt
-
-#endif /* WRT_SRC_ACCESSCONTROL_ENGINE_PROMPT_MODEL_H_ */
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_user_agent_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_vibration_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_web_notification_support.cpp
- ${PROJECT_SOURCE_DIR}/src/popup-process/CommunicationBox.cpp
${PROJECT_SOURCE_DIR}/src/popup-process/PopupSerializer
- ${PROJECT_SOURCE_DIR}/src/popup-process/PromptModel.cpp
${PROJECT_SOURCE_DIR}/src/popup-process/PopupInvoker.cpp
)
#include <dpl/scoped_fclose.h>
#include <dpl/string.h>
#include <dpl/optional.h>
+#include <dpl/foreach.h>
#include <wrt-commons/auto-save-dao-rw/auto_save_dao.h>
#include <Eina.h>