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 WINDOW_EXTENSION_CONTEXT_H
17 #define WINDOW_EXTENSION_CONTEXT_H
18 
19 #include <ability_manager_client.h>
20 #include <extension_context.h>
21 #include "wm_common.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 class WindowExtensionContext : public AbilityRuntime::ExtensionContext {
26 public:
27     WindowExtensionContext() = default;
28     ~WindowExtensionContext() = default;
29 
30     /**
31      * @brief Starts a new ability.
32      * An ability using the AbilityInfo.AbilityType.SERVICE or AbilityInfo.AbilityType.PAGE template uses this method
33      * to start a specific ability. The system locates the target ability from installed abilities based on the value
34      * of the want parameter and the startOptions parameter and then starts it. You can specify the ability to start
35      * using the want parameter.
36      *
37      * @param want Indicates the Want containing information about the target ability to start.
38      * @param startOptions Indicates the startOptions containing information about WindowMode and displayId to start.
39      *
40      * @return errCode WM_OK on success, others on failure.
41      */
42     WMError StartAbility(const AAFwk::Want& want, const AAFwk::StartOptions& startOptions) const;
43 
44     static const size_t CONTEXT_TYPE_ID;
45 private:
46     static int ILLEGAL_REQUEST_CODE;
47 };
48 } // namespace Rosen
49 } // namespace OHOS
50 #endif // WINDOW_EXTENSION_CONTEXT_HP