1 /* 2 * Copyright (C) 2018 The Android Open Source Project 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 #ifndef LIBTEXTCLASSIFIER_UTILS_INTENTS_REMOTE_ACTION_TEMPLATE_H_ 18 #define LIBTEXTCLASSIFIER_UTILS_INTENTS_REMOTE_ACTION_TEMPLATE_H_ 19 20 #include <map> 21 #include <string> 22 #include <vector> 23 24 #include "utils/optional.h" 25 #include "utils/variant.h" 26 27 namespace libtextclassifier3 { 28 29 // A template with parameters for an Android remote action. 30 struct RemoteActionTemplate { 31 // Title shown for the action (see: RemoteAction.getTitle). 32 Optional<std::string> title_without_entity; 33 34 // Title with entity for the action. It is not guaranteed that the client 35 // will use this, so title should be always given and general enough. 36 Optional<std::string> title_with_entity; 37 38 // Description shown for the action (see: RemoteAction.getContentDescription). 39 Optional<std::string> description; 40 41 // Description shown for the action (see: RemoteAction.getContentDescription) 42 // when app name is available. Caller is expected to replace the placeholder 43 // by the name of the app that is going to handle the action. 44 Optional<std::string> description_with_app_name; 45 46 // The action to set on the Intent (see: Intent.setAction). 47 Optional<std::string> action; 48 49 // The data to set on the Intent (see: Intent.setData). 50 Optional<std::string> data; 51 52 // The type to set on the Intent (see: Intent.setType). 53 Optional<std::string> type; 54 55 // Flags for launching the Intent (see: Intent.setFlags). 56 Optional<int> flags; 57 58 // Categories to set on the Intent (see: Intent.addCategory). 59 std::vector<std::string> category; 60 61 // Explicit application package to set on the Intent (see: Intent.setPackage). 62 Optional<std::string> package_name; 63 64 // The list of all the extras to add to the Intent. 65 std::map<std::string, Variant> extra; 66 67 // Private request code to use for the Intent. 68 Optional<int> request_code; 69 }; 70 71 } // namespace libtextclassifier3 72 73 #endif // LIBTEXTCLASSIFIER_UTILS_INTENTS_REMOTE_ACTION_TEMPLATE_H_ 74