2 * Copyright (c) 2017 - 2018 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
18 * @file ApiInterfaceImpl.h
19 * @author Piotr Sawicki <p.sawicki2@partner.samsung.com>
20 * @brief The declaration of ApiInterfaceImpl.
28 #include <ApiInterface.h>
29 #include <policy/AppInfo.h>
30 #include <policy/PkgInfo.h>
31 #include <StatusCallbackClosure.h>
33 #include <client-channel.h>
35 #include <askuser-notification-client.h>
41 class ApiInterfaceImpl : public ApiInterface {
43 explicit ApiInterfaceImpl(const StatusCallbackClosure &closure);
44 ApiInterfaceImpl(const ApiInterfaceImpl& orig) = delete;
45 virtual ~ApiInterfaceImpl();
47 ApiInterface &operator=(const ApiInterfaceImpl& orig) = delete;
49 virtual int process(int fd, int events);
50 virtual askuser_check_result checkPrivilege(const std::string &privilege);
51 virtual RequestId popupRequest(const std::string &privilege,
52 const askuser_popup_response_callback callback,
54 virtual bool popupRequestInProgress(const std::string &privilege) const;
56 void updateConnection(Protocol::ConnectionFd fd, int mask);
57 void popupResponse(Protocol::RequestId id, int response);
60 void respondToAllRequests(askuser_call_cause cause, askuser_popup_result result);
63 Protocol::RequestId m_requestId;
64 Protocol::ConnectionFd m_fd;
65 std::string m_privilege;
66 askuser_popup_response_callback m_callback;
70 StatusCallbackClosure m_statusClosure;
71 std::unique_ptr<Protocol::ClientChannel> m_channel;
72 std::vector<Request> m_requests;
79 } // namespace AskUser