From 9df1795ebb7b47214e380d142d6051ede910a74b Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Wed, 21 Nov 2012 08:57:57 +0100 Subject: [PATCH] Unused code [Issue#] LINUXNGWAP-561 [Bug] Unused code [Cause] N/A [Solution] Removing code that is never used [Verification] Run quick tests Change-Id: Ia12bbf2c8a9913f975c171813856fb0d95a513e0 --- CMakeLists.txt | 13 -- src/global_logic/global_model.cpp | 36 +---- src/global_logic/global_model.h | 24 ---- src/popup-process/CommunicationBox.cpp | 77 ---------- src/popup-process/CommunicationBox.h | 72 ---------- src/popup-process/PopupInvoker.cpp | 98 ------------- src/popup-process/PopupInvoker.h | 10 -- src/popup-process/PromptModel.cpp | 180 ------------------------ src/popup-process/PromptModel.h | 94 ------------- src/view/common/CMakeLists.txt | 2 - src/view/common/view_logic_password_support.cpp | 1 + 11 files changed, 2 insertions(+), 605 deletions(-) delete mode 100644 src/popup-process/CommunicationBox.cpp delete mode 100644 src/popup-process/CommunicationBox.h delete mode 100644 src/popup-process/PromptModel.cpp delete mode 100644 src/popup-process/PromptModel.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b231cfe..c8e2ce9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,13 +178,6 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/AutoSave.js 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 @@ -205,9 +198,6 @@ ADD_CUSTOM_COMMAND( ${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 ) @@ -230,9 +220,6 @@ ADD_CUSTOM_TARGET(generic_popup ALL DEPENDS 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/ ) diff --git a/src/global_logic/global_model.cpp b/src/global_logic/global_model.cpp index 26e12f9..f9c703c 100644 --- a/src/global_logic/global_model.cpp +++ b/src/global_logic/global_model.cpp @@ -31,21 +31,7 @@ GlobalModel::GlobalModel() : static_cast::ReadDelegateType> - (& GlobalModel::ReadDeveloperMode)), - SecureByDefault(this, - static_cast::ReadDelegateType> - (& GlobalModel::ReadSecureByDefault)), - ComplianceMode(this, - static_cast::ReadDelegateType> - (& GlobalModel::readComplianceMode)), - ComplianceFakeImei(this, - & GlobalModel::readComplianceFakeImei), - ComplianceFakeMeid(this, - & GlobalModel::readComplianceFakeMeid) + (& GlobalModel::ReadDeveloperMode)) { } @@ -87,23 +73,3 @@ bool GlobalModel::ReadDeveloperMode(DPL::Event::Model */*model*/) { 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(); -} diff --git a/src/global_logic/global_model.h b/src/global_logic/global_model.h index 88cf256..065ca3b 100644 --- a/src/global_logic/global_model.h +++ b/src/global_logic/global_model.h @@ -52,22 +52,6 @@ class GlobalModel : public DPL::Event::Model DPL::Event::PropertyReadOnly, DPL::Event::PropertyStorageDynamicCached> DeveloperMode; - DPL::Event::Property SecureByDefault; - - DPL::Event::Property ComplianceMode; - - DPL::Event::Property ComplianceFakeImei; - - DPL::Event::Property ComplianceFakeMeid; - GlobalModel(); private: @@ -77,14 +61,6 @@ class GlobalModel : public DPL::Event::Model 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_ diff --git a/src/popup-process/CommunicationBox.cpp b/src/popup-process/CommunicationBox.cpp deleted file mode 100644 index 1204971..0000000 --- a/src/popup-process/CommunicationBox.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 -#include - -namespace Wrt { -void CommunicationBox::showAsync( - const Prompt::PromptModel::PromptType promptType, - const std::string& mainLabel, - const std::vector& 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 diff --git a/src/popup-process/CommunicationBox.h b/src/popup-process/CommunicationBox.h deleted file mode 100644 index bc246f6..0000000 --- a/src/popup-process/CommunicationBox.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include "PromptModel.h" - -namespace Wrt { -class CommunicationBox : - public DPL::Popup::PopupControllerUser -{ - private: - void AnswerCallback(const DPL::Popup::AnswerCallbackData &answer); - - public: - typedef DPL::FastDelegate - 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& 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 diff --git a/src/popup-process/PopupInvoker.cpp b/src/popup-process/PopupInvoker.cpp index 783f44b..7a184b6 100644 --- a/src/popup-process/PopupInvoker.cpp +++ b/src/popup-process/PopupInvoker.cpp @@ -26,8 +26,6 @@ #include #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"; @@ -64,71 +62,6 @@ PopupInvoker::~PopupInvoker() } } -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::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(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 @@ -195,35 +128,4 @@ void PopupInvoker::executePopup() 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(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 diff --git a/src/popup-process/PopupInvoker.h b/src/popup-process/PopupInvoker.h index b3a4cc0..43ac08c 100644 --- a/src/popup-process/PopupInvoker.h +++ b/src/popup-process/PopupInvoker.h @@ -17,14 +17,10 @@ #ifndef WRT_POPUP_INVOKER_H #define WRT_POPUP_INVOKER_H -#include - #include -#include #include #include -#include #include "popup_ace_data_types.h" @@ -49,22 +45,16 @@ public: 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 m_dbusPopupClient; }; } // Wrt diff --git a/src/popup-process/PromptModel.cpp b/src/popup-process/PromptModel.cpp deleted file mode 100644 index c1b3d32..0000000 --- a/src/popup-process/PromptModel.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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 - -#include -#include -#include - -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 += "
"; - strLabel += resourceId; - - return new Prompt::PromptLabels(promptType, aceQuestionLabel, strLabel); -} - -Prompt::Validity fromPromptTypeToValidity(int aPromptType, bool checkClicked) -{ - using namespace Prompt; - PromptModel::PromptType promptTypeEnum = - static_cast(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 diff --git a/src/popup-process/PromptModel.h b/src/popup-process/PromptModel.h deleted file mode 100644 index 95daadd..0000000 --- a/src/popup-process/PromptModel.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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 -#include -#include - -#include - -namespace Wrt { -namespace Prompt { -typedef std::vector 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 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_ */ diff --git a/src/view/common/CMakeLists.txt b/src/view/common/CMakeLists.txt index 36c6b92..a40f9c4 100644 --- a/src/view/common/CMakeLists.txt +++ b/src/view/common/CMakeLists.txt @@ -67,9 +67,7 @@ SET(VIEW_COMMON_SOURCES ${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 ) diff --git a/src/view/common/view_logic_password_support.cpp b/src/view/common/view_logic_password_support.cpp index 0d4f159..9533121 100644 --- a/src/view/common/view_logic_password_support.cpp +++ b/src/view/common/view_logic_password_support.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include -- 2.7.4