Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2022 The Chromium Authors |
Tom Anderson | d5044f5 | 2022-05-02 21:52:21 | [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 | |
| 5 | #include "chrome/browser/obsolete_system/obsolete_system.h" |
| 6 | |
| 7 | #include "base/linux_util.h" |
| 8 | #include "base/strings/string_util.h" |
| 9 | #include "chrome/grit/chromium_strings.h" |
| 10 | #include "ui/base/l10n/l10n_util.h" |
| 11 | |
| 12 | const char kLinuxObsoleteUrl[] = |
| 13 | "https://support.google.com/chrome/?p=unsupported_linux"; |
| 14 | |
| 15 | // This list contains the 2 most recently obsoleted distros according to |
| 16 | // `kLinuxObsoleteUrl`. |
| 17 | const char* const kObsoleteDistros[] = { |
| 18 | "Ubuntu 14.04", "Ubuntu 16.04", "Debian 8", "Debian 9", |
| 19 | "Fedora 30", "Fedora 31", "openSUSE Leap 15.0", "openSUSE Leap 15.1", |
| 20 | }; |
| 21 | |
| 22 | // static |
| 23 | bool ObsoleteSystem::IsObsoleteNowOrSoon() { |
| 24 | auto distro = base::GetLinuxDistro(); |
| 25 | for (const char* obsolete : kObsoleteDistros) { |
| 26 | if (base::StartsWith(distro, obsolete)) |
| 27 | return true; |
| 28 | } |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | // static |
| 33 | std::u16string ObsoleteSystem::LocalizedObsoleteString() { |
| 34 | return l10n_util::GetStringUTF16(IDS_LINUX_OBSOLETE); |
| 35 | } |
| 36 | |
| 37 | // static |
| 38 | bool ObsoleteSystem::IsEndOfTheLine() { |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | // static |
| 43 | const char* ObsoleteSystem::GetLinkURL() { |
| 44 | return kLinuxObsoleteUrl; |
| 45 | } |