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 OHOS_ABILITY_RUNTIME_STATIC_SUBSCRIBER_EXTENSION_H 17 #define OHOS_ABILITY_RUNTIME_STATIC_SUBSCRIBER_EXTENSION_H 18 19 #include "common_event_data.h" 20 #include "extension_base.h" 21 22 namespace OHOS { 23 namespace AbilityRuntime { 24 class StaticSubscriberExtensionContext; 25 class Runtime; 26 27 class StaticSubscriberExtension : public ExtensionBase<StaticSubscriberExtensionContext> { 28 public: 29 StaticSubscriberExtension() = default; 30 virtual ~StaticSubscriberExtension() = default; 31 32 std::shared_ptr<StaticSubscriberExtensionContext> CreateAndInitContext( 33 const std::shared_ptr<AbilityLocalRecord>& record, 34 const std::shared_ptr<OHOSApplication>& application, 35 std::shared_ptr<AbilityHandler>& handler, 36 const sptr<IRemoteObject>& token) override; 37 38 void Init(const std::shared_ptr<AbilityLocalRecord>& record, 39 const std::shared_ptr<OHOSApplication>& application, 40 std::shared_ptr<AbilityHandler>& handler, 41 const sptr<IRemoteObject>& token) override; 42 43 static StaticSubscriberExtension* Create(const std::unique_ptr<Runtime>& runtime); 44 45 virtual void OnReceiveEvent(std::shared_ptr<EventFwk::CommonEventData> data); 46 }; 47 } // namespace AbilityRuntime 48 } // namespace OHOS 49 #endif // OHOS_ABILITY_RUNTIME_STATIC_SUBSCRIBER_EXTENSION_H 50