summaryrefslogtreecommitdiff
path: root/src/include/cchecker
diff options
context:
space:
mode:
authorJanusz Kozerski <j.kozerski@samsung.com>2015-09-25 14:47:34 +0200
committerJanusz Kozerski <j.kozerski@samsung.com>2015-11-10 11:43:34 +0100
commit473de0fb27052aff62e4b391feb1b6447f83ec41 (patch)
treed8e7ddf77eb3e3424394fd0529b004a77dfd6b77 /src/include/cchecker
parent7871c1f106e6c11503b4a2a6f7bbbd876d2ec1fc (diff)
downloadcert-checker-473de0fb27052aff62e4b391feb1b6447f83ec41.tar.gz
cert-checker-473de0fb27052aff62e4b391feb1b6447f83ec41.tar.bz2
cert-checker-473de0fb27052aff62e4b391feb1b6447f83ec41.zip
Add popup
Since Notification framework doesn't support system daemons, the cert-checker's internal popup should be provided. Add implementation of popup binary - /usr/bin/cert-checker-popup Cert-checker forks(), execs a popup binary, waits for popup termination, and then reads user response from pipe. Change-Id: Ie2e70f661feb1f262841d59a1b4c6a7ec49901f9
Diffstat (limited to 'src/include/cchecker')
-rw-r--r--src/include/cchecker/UIBackend.h21
-rw-r--r--src/include/cchecker/popup-runner.h50
2 files changed, 60 insertions, 11 deletions
diff --git a/src/include/cchecker/UIBackend.h b/src/include/cchecker/UIBackend.h
index e59f0d7..6133078 100644
--- a/src/include/cchecker/UIBackend.h
+++ b/src/include/cchecker/UIBackend.h
@@ -21,24 +21,25 @@
#pragma once
-#include <notification.h>
-
#include <cchecker/app.h>
namespace CCHECKER {
namespace UI {
-enum response_e {
- DONT_UNINSTALL,
- UNINSTALL,
- ERROR
+enum popup_status : int {
+ NO_ERROR = 0,
+ EXIT_ERROR = 1
};
-// FIXME: notification framework is corrupted and it doesn't work as it should
+enum response_e : int {
+ DONT_UNINSTALL = 2,
+ UNINSTALL = 3,
+ RESPONSE_ERROR = 4
+};
class UIBackend {
public:
- explicit UIBackend(int timeout = 60); //timeout in seconds
+ explicit UIBackend(int timeout = 60); //timeout in seconds (zero or less means infinity)
virtual ~UIBackend();
// Displays popup with question, and - if needed - app_control for removing application.
@@ -48,10 +49,8 @@ public:
bool call_popup(const app_t &app);
private:
- response_e run();
- bool create_ui(const std::string &app_id, const std::string &pkg_id);
+ response_e run(const app_t &app);
- notification_h m_notification;
const int m_responseTimeout; // seconds
};
diff --git a/src/include/cchecker/popup-runner.h b/src/include/cchecker/popup-runner.h
new file mode 100644
index 0000000..addaa3b
--- /dev/null
+++ b/src/include/cchecker/popup-runner.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015 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 popup-runner.h
+ * @author Janusz Kozerski (j.kozerski@samsung.com)
+ * @version 1.0
+ */
+
+#include <vector>
+
+#include <cchecker/dpl/serialization.h>
+
+namespace CCHECKER{
+namespace UI{
+
+class BinaryStream : public CCHECKER::IStream {
+ public:
+ void Read (size_t num, void * bytes);
+ void Write(size_t num, const void * bytes);
+
+ BinaryStream();
+ ~BinaryStream();
+
+ const unsigned char* char_pointer() const;
+ size_t size() const;
+
+ private:
+ std::vector<unsigned char> m_data;
+ size_t m_readPosition;
+};
+
+response_e run_popup(
+ const app_t &app,
+ int timeout); // zero or negative timeout means infinity
+
+} // UI
+} // CCHECKER