Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | ea4d1c874 | 2012-06-13 03:51:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Joshua Pawlicki | 1bab78d | 2024-02-13 15:06:56 | [diff] [blame] | 5 | #include <memory> |
Jan Wilken Dörrie | ad587c3 | 2021-03-11 14:09:27 | [diff] [blame] | 6 | #include <string> |
| 7 | |
Peter Kasting | a486324 | 2024-12-23 00:19:43 | [diff] [blame] | 8 | #include "chrome/browser/ui/webui/help/version_updater.h" |
Greg Thompson | 8bcd799b | 2018-08-10 09:49:33 | [diff] [blame] | 9 | #include "chrome/browser/upgrade_detector/upgrade_detector.h" |
[email protected] | ea4d1c874 | 2012-06-13 03:51:55 | [diff] [blame] | 10 | |
Joshua Pawlicki | 1bab78d | 2024-02-13 15:06:56 | [diff] [blame] | 11 | namespace { |
[email protected] | ea4d1c874 | 2012-06-13 03:51:55 | [diff] [blame] | 12 | |
Joshua Pawlicki | 1bab78d | 2024-02-13 15:06:56 | [diff] [blame] | 13 | // Bare bones implementation just checks if a new version is ready. |
| 14 | class VersionUpdaterBasic : public VersionUpdater { |
| 15 | public: |
| 16 | VersionUpdaterBasic(const VersionUpdaterBasic&) = delete; |
| 17 | VersionUpdaterBasic& operator=(const VersionUpdaterBasic&) = delete; |
| 18 | VersionUpdaterBasic() = default; |
| 19 | ~VersionUpdaterBasic() override = default; |
| 20 | |
| 21 | // VersionUpdater implementation. |
| 22 | void CheckForUpdate(StatusCallback callback, PromoteCallback) override { |
| 23 | const Status status = UpgradeDetector::GetInstance()->is_upgrade_available() |
| 24 | ? NEARLY_UPDATED |
| 25 | : DISABLED; |
| 26 | callback.Run(status, 0, false, false, std::string(), 0, std::u16string()); |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | } // namespace |
| 31 | |
| 32 | std::unique_ptr<VersionUpdater> VersionUpdater::Create( |
| 33 | content::WebContents* web_contents) { |
| 34 | return std::make_unique<VersionUpdaterBasic>(); |
[email protected] | ea4d1c874 | 2012-06-13 03:51:55 | [diff] [blame] | 35 | } |