• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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_ROSEN_FUTURE_CALLBACK_H
17 #define OHOS_ROSEN_FUTURE_CALLBACK_H
18 
19 #include <future.h>
20 #include "interfaces/include/ws_common.h"
21 #include "wm_common.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 class FutureCallback : public RefBase {
26 public:
27     WSError OnUpdateSessionRect(
28         const Rect& rect, WindowSizeChangeReason reason, int32_t persistentId);
29     WSError OnUpdateGlobalDisplayRect(
30         const Rect& rect, WindowSizeChangeReason reason, int32_t persistentId);
31     Rect GetResizeAsyncResult(long timeoutMs);
32     Rect GetMoveToAsyncResult(long timeoutMs);
33     Rect GetMoveWindowToGlobalDisplayAsyncResult(long timeoutMs);
34     void ResetResizeLock();
35     void ResetMoveToLock();
36     void ResetMoveWindowToGlobalDisplayLock();
37     int32_t GetUpdateRectResult(long timeoutMs);
38     void OnFirstValidRectUpdate(int32_t persistentId);
39 
40     // oriention
41     OrientationInfo GetTargetOrientationResult(long timeoutMs);
42     void ResetGetTargetRotationLock();
43     WSError OnUpdateTargetOrientationInfo(OrientationInfo& info);
44 
45     // rotation change
46     RotationChangeResult GetRotationResult(long timeoutMs);
47     void ResetRotationResultLock();
48     void OnUpdateRotationResult(RotationChangeResult rotationChangeResult);
49 
50 private:
51     RunnableFuture<Rect> resizeFuture_{};
52     RunnableFuture<Rect> moveToFuture_{};
53     RunnableFuture<Rect> moveWindowToGlobalDisplayFuture_{};
54     RunnableFuture<OrientationInfo> getTargetRotationFuture_{};
55     RunnableFuture<RotationChangeResult> getRotationResultFuture_{};
56     RunnableFuture<int32_t> updateRectFuture_{};
57 };
58 } // namespace Rosen
59 } // namespace OHOS
60 #endif // OHOS_ROSEN_FUTURE_CALLBACK_H