• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2018 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef UPDATE_ENGINE_COMMON_DLCSERVICE_INTERFACE_H_
18 #define UPDATE_ENGINE_COMMON_DLCSERVICE_INTERFACE_H_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include <base/macros.h>
25 
26 namespace chromeos_update_engine {
27 
28 // The abstract dlcservice interface defines the interaction with the
29 // platform's dlcservice.
30 class DlcServiceInterface {
31  public:
32   virtual ~DlcServiceInterface() = default;
33 
34   // Returns true and a list of installed DLC ids in |dlc_ids|.
35   // On failure it returns false.
36   virtual bool GetDlcsToUpdate(std::vector<std::string>* dlc_ids) = 0;
37 
38   // Returns true if dlcservice successfully handled the install completion
39   // method call, otherwise false.
40   virtual bool InstallCompleted(const std::vector<std::string>& dlc_ids) = 0;
41 
42   // Returns true if dlcservice successfully handled the update completion
43   // method call, otherwise false.
44   virtual bool UpdateCompleted(const std::vector<std::string>& dlc_ids) = 0;
45 
46  protected:
47   DlcServiceInterface() = default;
48 
49  private:
50   DISALLOW_COPY_AND_ASSIGN(DlcServiceInterface);
51 };
52 
53 // This factory function creates a new DlcServiceInterface instance for the
54 // current platform.
55 std::unique_ptr<DlcServiceInterface> CreateDlcService();
56 
57 }  // namespace chromeos_update_engine
58 
59 #endif  // UPDATE_ENGINE_COMMON_DLCSERVICE_INTERFACE_H_
60