• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef UPDATER_UI_CALLBACK_MANAGER_H
17 #define UPDATER_UI_CALLBACK_MANAGER_H
18 
19 #include <functional>
20 #include <unordered_map>
21 #include <utility>
22 #include <vector>
23 #include "event_listener.h"
24 #include "json_node.h"
25 #include "updater_ui_traits.h"
26 
27 namespace Updater {
28 class CallbackManager {
29 public:
30     static void Init(bool hasFocus);
31     static void Register(const CallbackCfg &cbCfg);
32     static bool LoadCallbacks(const JsonNode &node);
33 private:
34     static std::unordered_map<std::string, EventType> evtTypes_;
35     static std::unordered_map<std::string, Callback> funcs_;
36     static std::vector<CallbackCfg> callbackCfgs_;
37 };
38 }
39 #endif
40