Foromo Daniel Soromou | 67860ff | 2025-05-05 15:38:33 | [diff] [blame^] | 1 | // Copyright 2025 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/win/installer_downloader/installer_downloader_controller.h" |
| 6 | |
| 7 | #include <memory> |
| 8 | #include <optional> |
| 9 | #include <utility> |
| 10 | |
| 11 | #include "base/check.h" |
| 12 | #include "base/feature_list.h" |
| 13 | #include "base/files/file_path.h" |
| 14 | #include "chrome/browser/win/installer_downloader/installer_downloader_feature.h" |
| 15 | #include "chrome/browser/win/installer_downloader/installer_downloader_model.h" |
| 16 | #include "chrome/browser/win/installer_downloader/installer_downloader_model_impl.h" |
| 17 | |
| 18 | namespace installer_downloader { |
| 19 | |
| 20 | InstallerDownloaderController::InstallerDownloaderController( |
| 21 | std::unique_ptr<InstallerDownloaderModel> model) |
| 22 | : model_(model ? std::move(model) |
| 23 | : std::make_unique<InstallerDownloaderModelImpl>()) { |
| 24 | CHECK(base::FeatureList::IsEnabled(kInstallerDownloader)); |
| 25 | } |
| 26 | |
| 27 | InstallerDownloaderController::~InstallerDownloaderController() = default; |
| 28 | |
| 29 | void InstallerDownloaderController::MaybeShowInfoBar() { |
| 30 | // At this point, the decision to show the infobar should be taken. |
| 31 | // 1. Check local state whether shown limit has been reached or not. |
| 32 | // 2. Check eligibility. |
| 33 | } |
| 34 | |
| 35 | void InstallerDownloaderController::OnEligibilityReady( |
| 36 | const std::optional<base::FilePath>& destination) { |
| 37 | // At this point, eligibility is the last item to take the decision to show |
| 38 | // the infobar. Trigger infobar display based on `result`. |
| 39 | } |
| 40 | |
| 41 | void InstallerDownloaderController::OnDownloadRequestAccepted( |
| 42 | content::WebContents* /*web_contents*/) { |
| 43 | // User have explicitly gave download consent. Therefore, a background |
| 44 | // download should be issued. |
| 45 | } |
| 46 | |
| 47 | void InstallerDownloaderController::OnDownloadCompleted() { |
| 48 | // Update local state to indicated that downloaded have been successfully |
| 49 | // completed. |
| 50 | } |
| 51 | |
| 52 | } // namespace installer_downloader |