1 /* 2 * Copyright (c) 2020 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 OHOS_ABILITY_MISSION_STACK_H 17 #define OHOS_ABILITY_MISSION_STACK_H 18 19 #include <list> 20 21 #include "ability_connect_mission.h" 22 #include "ability_mission_record.h" 23 24 namespace OHOS { 25 typedef enum { 26 LAUNCHER, 27 DEFAULT, 28 } StackType; 29 class AbilityMissionStack { 30 public: 31 explicit AbilityMissionStack(StackType type); 32 ~AbilityMissionStack(); 33 StackType GetStackType() const; 34 // MissionRecord 35 void PushTopMissionRecord(AbilityMissionRecord &missionRecord); 36 void MoveMissionRecordToTop(AbilityMissionRecord &missionRecord); 37 AbilityMissionRecord *GetTargetMissionRecord(const char *bundleName) const; 38 const AbilityMissionRecord *GetTopMissionRecord() const; 39 void RemoveMissionRecord(AbilityMissionRecord &missionRecord); 40 void RemoveMissionRecord(AbilityConnectMission *connectMission, const char *bundleName); 41 bool IsTopMissionRecord(const char *bundleName) const; 42 // PageAbilityRecord 43 PageAbilityRecord *FindPageAbility(uint64_t token) const; 44 PageAbilityRecord *FindPageAbility(const Want &want) const; 45 const PageAbilityRecord *GetTopPageAbility() const; 46 #ifdef OHOS_DEBUG 47 AbilityMsStatus DumpMissionStack() const; 48 #endif 49 private: 50 std::list<AbilityMissionRecord *> missionRecords_; 51 StackType stackType_; 52 }; 53 } // namespace OHOS 54 #endif // OHOS_ABILITY_MISSION_STACK_H 55