1 /* 2 * Copyright (c) 2021-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 #include "js_runtime_utils.h" 17 #include "js_window_register_manager.h" 18 #include "native_engine/native_engine.h" 19 #include "native_engine/native_reference.h" 20 #include "native_engine/native_value.h" 21 #include "wm_common.h" 22 23 #ifndef OHOS_JS_WINDOW_MANAGER_H 24 #define OHOS_JS_WINDOW_MANAGER_H 25 namespace OHOS { 26 namespace Rosen { 27 NativeValue* JsWindowManagerInit(NativeEngine* engine, NativeValue* exportObj); 28 class JsWindowManager { 29 public: 30 JsWindowManager(); 31 ~JsWindowManager(); 32 static void Finalizer(NativeEngine* engine, void* data, void* hint); 33 static NativeValue* CreateWindow(NativeEngine* engine, NativeCallbackInfo* info); 34 static NativeValue* FindWindow(NativeEngine* engine, NativeCallbackInfo* info); 35 static NativeValue* MinimizeAll(NativeEngine* engine, NativeCallbackInfo* info); 36 static NativeValue* RegisterWindowManagerCallback(NativeEngine* engine, NativeCallbackInfo* info); 37 static NativeValue* UnregisterWindowMangerCallback(NativeEngine* engine, NativeCallbackInfo* info); 38 static NativeValue* GetTopWindow(NativeEngine* engine, NativeCallbackInfo* info); 39 static NativeValue* SetWindowLayoutMode(NativeEngine* engine, NativeCallbackInfo* info); 40 41 private: 42 NativeValue* OnCreateWindow(NativeEngine& engine, NativeCallbackInfo& info); 43 NativeValue* OnFindWindow(NativeEngine& engine, NativeCallbackInfo& info); 44 NativeValue* OnMinimizeAll(NativeEngine& engine, NativeCallbackInfo& info); 45 NativeValue* OnRegisterWindowMangerCallback(NativeEngine& engine, NativeCallbackInfo& info); 46 NativeValue* OnUnregisterWindowManagerCallback(NativeEngine& engine, NativeCallbackInfo& info); 47 NativeValue* OnGetTopWindow(NativeEngine& engine, NativeCallbackInfo& info); 48 NativeValue* OnSetWindowLayoutMode(NativeEngine& engine, NativeCallbackInfo& info); 49 std::unique_ptr<JsWindowRegisterManager> registerManager_ = nullptr; 50 }; 51 } // namespace Rosen 52 } // namespace OHOS 53 54 #endif 55