| Xiaochu Liu | 8ba486f | 2018-11-06 11:14:10 -0800 | [diff] [blame] | 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 |  | 
| Jae Hoon Kim | 50f2673 | 2020-05-14 10:46:15 -0700 | [diff] [blame] | 20 | #include <memory> | 
| Xiaochu Liu | 8ba486f | 2018-11-06 11:14:10 -0800 | [diff] [blame] | 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 |  | 
| Amin Hassani | 2b68e6b | 2020-04-17 10:49:12 -0700 | [diff] [blame] | 34 | // Returns true and a list of installed DLC ids in |dlc_ids|. | 
| Xiaochu Liu | 8ba486f | 2018-11-06 11:14:10 -0800 | [diff] [blame] | 35 | // On failure it returns false. | 
| Amin Hassani | 2b68e6b | 2020-04-17 10:49:12 -0700 | [diff] [blame] | 36 | virtual bool GetDlcsToUpdate(std::vector<std::string>* dlc_ids) = 0; | 
| Xiaochu Liu | 8ba486f | 2018-11-06 11:14:10 -0800 | [diff] [blame] | 37 |  | 
| Jae Hoon Kim | 7fdfbf1 | 2020-04-10 18:15:50 -0700 | [diff] [blame] | 38 | // Returns true if dlcservice successfully handled the install completion | 
|  | 39 | // method call, otherwise false. | 
| Amin Hassani | 2b68e6b | 2020-04-17 10:49:12 -0700 | [diff] [blame] | 40 | virtual bool InstallCompleted(const std::vector<std::string>& dlc_ids) = 0; | 
| Jae Hoon Kim | 7fdfbf1 | 2020-04-10 18:15:50 -0700 | [diff] [blame] | 41 |  | 
|  | 42 | // Returns true if dlcservice successfully handled the update completion | 
|  | 43 | // method call, otherwise false. | 
| Amin Hassani | 2b68e6b | 2020-04-17 10:49:12 -0700 | [diff] [blame] | 44 | virtual bool UpdateCompleted(const std::vector<std::string>& dlc_ids) = 0; | 
| Jae Hoon Kim | 7fdfbf1 | 2020-04-10 18:15:50 -0700 | [diff] [blame] | 45 |  | 
| Xiaochu Liu | 8ba486f | 2018-11-06 11:14:10 -0800 | [diff] [blame] | 46 | protected: | 
|  | 47 | DlcServiceInterface() = default; | 
|  | 48 |  | 
|  | 49 | private: | 
|  | 50 | DISALLOW_COPY_AND_ASSIGN(DlcServiceInterface); | 
|  | 51 | }; | 
|  | 52 |  | 
| Jae Hoon Kim | 50f2673 | 2020-05-14 10:46:15 -0700 | [diff] [blame] | 53 | // This factory function creates a new DlcServiceInterface instance for the | 
|  | 54 | // current platform. | 
|  | 55 | std::unique_ptr<DlcServiceInterface> CreateDlcService(); | 
|  | 56 |  | 
| Xiaochu Liu | 8ba486f | 2018-11-06 11:14:10 -0800 | [diff] [blame] | 57 | }  // namespace chromeos_update_engine | 
|  | 58 |  | 
|  | 59 | #endif  // UPDATE_ENGINE_COMMON_DLCSERVICE_INTERFACE_H_ |