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 ACE_UICAST_IMPL_UICAST_CONTEXT_IMPL_H 17 #define ACE_UICAST_IMPL_UICAST_CONTEXT_IMPL_H 18 19 #include "base/memory/referenced.h" 20 #include "base/utils/macros.h" 21 #include "core/components/dialog/dialog_properties.h" 22 23 #define RETURN_VOID_IF_NOT_ENABLE \ 24 if (!OHOS::Ace::UICastContextImpl::IsEnable()) { \ 25 return; \ 26 } 27 #define RETURN_DEFAULT_IF_NOT_ENABLE \ 28 if (!OHOS::Ace::UICastContextImpl::IsEnable()) { \ 29 return 0; \ 30 } 31 32 namespace OHOS::Ace { 33 class RenderNode; 34 class PipelineContext; 35 36 class ACE_EXPORT UICastContextImpl { 37 public: 38 UICastContextImpl() = delete; 39 static bool IsEnable(); 40 static void Init(const WeakPtr<PipelineContext>& context); 41 static bool NeedsRebuild(); 42 static void OnFlushBuildStart(); 43 static void OnFlushBuildFinish(); 44 static bool CallRouterBackToPopPage(); 45 static void CheckEvent(); 46 static void HandleRouterPageCall(const std::string& cmd, const std::string& url); 47 static void ShowToast(const std::string& message, int32_t duration, const std::string& bottom); 48 static void ShowDialog(const DialogProperties& dialogProperties); 49 50 private: 51 static int enable_; 52 }; 53 } // namespace OHOS::Ace 54 55 #endif // ACE_UICAST_IMPL_UICAST_CONTEXT_IMPL_H