1  /*
2   * Copyright (c) 2021-2023 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_REMOTE_CLIENT_MANAGER_H
17  #define OHOS_ABILITY_RUNTIME_REMOTE_CLIENT_MANAGER_H
18  
19  #include "iremote_object.h"
20  #include "refbase.h"
21  
22  #include "app_spawn_client.h"
23  #include "bundle_mgr_helper.h"
24  
25  namespace OHOS {
26  namespace AppExecFwk {
27  class RemoteClientManager {
28  public:
29      RemoteClientManager();
30      virtual ~RemoteClientManager();
31  
32      /**
33       * GetSpawnClient, Get spawn client.
34       *
35       * @return the spawn client instance.
36       */
37      std::shared_ptr<AppSpawnClient> GetSpawnClient();
38  
39      /**
40       * @brief Setting spawn client instance.
41       *
42       * @param appSpawnClient, the spawn client instance.
43       */
44      void SetSpawnClient(const std::shared_ptr<AppSpawnClient> &appSpawnClient);
45  
46      /**
47       * GetBundleManager, Get bundle management services.
48       *
49       * @return the bundle management services instance.
50       */
51      std::shared_ptr<BundleMgrHelper> GetBundleManagerHelper();
52  
53      /**
54       * @brief Setting bundle management instance.
55       *
56       * @param appSpawnClient, the bundle management instance.
57       */
58      void SetBundleManagerHelper(const std::shared_ptr<BundleMgrHelper> &bundleMgrHelper);
59  
60      std::shared_ptr<AppSpawnClient> GetNWebSpawnClient();
61  
62      std::shared_ptr<AppSpawnClient> GetCJSpawnClient();
63  
64      std::shared_ptr<AppSpawnClient> GetNativeSpawnClient();
65  
66  private:
67      std::shared_ptr<AppSpawnClient> appSpawnClient_;
68      std::shared_ptr<BundleMgrHelper> bundleManagerHelper_;
69      std::shared_ptr<AppSpawnClient> nwebSpawnClient_;
70      std::shared_ptr<AppSpawnClient> cjAppSpawnClient_;
71      std::shared_ptr<AppSpawnClient> nativeSpawnClient_;
72  };
73  }  // namespace AppExecFwk
74  }  // namespace OHOS
75  
76  #endif  // OHOS_ABILITY_RUNTIME_REMOTE_CLIENT_MANAGER_H
77