Fix group name for noti_ex
[platform/core/api/notification.git] / notification-ex / default_action_factory.cc
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include <dlog.h>
18
19 #include <memory>
20
21 #include "notification-ex/app_control_action.h"
22 #include "notification-ex/visibility_action.h"
23 #include "notification-ex/default_action_factory.h"
24 #include "notification-ex/exception.h"
25
26 #ifdef LOG_TAG
27 #undef LOG_TAG
28 #endif
29
30 #define LOG_TAG "NOTIFICATION_EX"
31
32 using namespace std;
33 namespace notification {
34 namespace item {
35
36 unique_ptr<AbstractAction> DefaultActionFactory::CreateAction(int type) {
37   switch (type) {
38     case AbstractAction::NullObject :
39       THROW(ERROR_INVALID_PARAMETER);
40     case AbstractAction::AppControl : {
41       app_control_h control;
42       app_control_create(&control);
43       unique_ptr<AbstractAction> action(new AppControlAction(control));
44       app_control_destroy(control);
45       return action;
46     }
47     case AbstractAction::Visibility :
48       return unique_ptr<AbstractAction>(new VisibilityAction());
49     case AbstractAction::Custom :
50       return nullptr;
51   }
52
53   return nullptr;
54 }
55
56 }  // namespace item
57 }  // namespace notification