Add files via upload

This commit is contained in:
Alexander David Frick 2023-01-25 06:46:46 -06:00 committed by GitHub
parent 684710fcd7
commit 846cefcef9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,45 @@
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/obsolete_system/obsolete_system.h"
#include "base/linux_util.h"
#include "base/strings/string_util.h"
#include "chrome/grit/chromium_strings.h"
#include "ui/base/l10n/l10n_util.h"
const char kLinuxObsoleteUrl[] =
"https://support.google.com/chrome/?p=unsupported_linux";
// This list contains the 2 most recently obsoleted distros according to
// `kLinuxObsoleteUrl`.
const char* const kObsoleteDistros[] = {
"Ubuntu 12.04", "Ubuntu 14.04", "Debian 7", "Debian 8",
"Fedora 30", "Fedora 31", "openSUSE Leap 15.0", "openSUSE Leap 15.1",
};
// static
bool ObsoleteSystem::IsObsoleteNowOrSoon() {
auto distro = base::GetLinuxDistro();
for (const char* obsolete : kObsoleteDistros) {
if (base::StartsWith(distro, obsolete))
return true;
}
return false;
}
// static
std::u16string ObsoleteSystem::LocalizedObsoleteString() {
return l10n_util::GetStringUTF16(IDS_LINUX_OBSOLETE);
}
// static
bool ObsoleteSystem::IsEndOfTheLine() {
return false;
}
// static
const char* ObsoleteSystem::GetLinkURL() {
return kLinuxObsoleteUrl;
}

View file

@ -0,0 +1,59 @@
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/obsolete_system/obsolete_system.h"
#include "base/cpu.h"
#include "base/win/windows_version.h"
#include "build/build_config.h"
#include "chrome/common/chrome_version.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
// Obsolete-system checks get the system version from kernel32.dll's version, to
// avoid getting an incorrect version reported by App Compatibility mode. This
// prevents obsolete-system warnings from appearing when Chrome is run in
// compatibility mode on modern versions of Windows.
base::win::Version GetRealOSVersion() {
return base::win::OSInfo::GetInstance()->Kernel32Version();
}
bool IsObsoleteOsVersion() {
return false;
}
} // namespace
// static
bool ObsoleteSystem::IsObsoleteNowOrSoon() {
return false;
}
// static
std::u16string ObsoleteSystem::LocalizedObsoleteString() {
const auto version = GetRealOSVersion();
if (version == base::win::Version::WIN7)
return l10n_util::GetStringUTF16(IDS_WIN_7_OBSOLETE);
if (version == base::win::Version::WIN8)
return l10n_util::GetStringUTF16(IDS_WIN_8_OBSOLETE);
if (version == base::win::Version::WIN8_1)
return l10n_util::GetStringUTF16(IDS_WIN_8_1_OBSOLETE);
return l10n_util::GetStringUTF16(IDS_WIN_XP_VISTA_OBSOLETE);
}
// static
bool ObsoleteSystem::IsEndOfTheLine() {
return true;
}
// static
const char* ObsoleteSystem::GetLinkURL() {
const auto version = GetRealOSVersion();
if (version < base::win::Version::WIN7)
return chrome::kWindowsXPVistaDeprecationURL;
return chrome::kWindows78DeprecationURL;
}