Skip to content

Commit

Permalink
Remove useless references to unsupported windows versions (1)
Browse files Browse the repository at this point in the history
This CL goes over all directories excluding base/ chrome/ content/
components/ and ui/.

Bug: 579196
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I4c792972b546b9de10669b7c3f66e85ab79cea94
Reviewed-on: https://chromium-review.googlesource.com/565897
Commit-Queue: Patrick Monette <[email protected]>
Reviewed-by: Chrome Cunningham <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: John Bauman <[email protected]>
Reviewed-by: Colin Blundell <[email protected]>
Reviewed-by: Julian Pastarmov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#490593}
  • Loading branch information
plmonette-zz authored and Commit Bot committed Jul 29, 2017
1 parent fe4fa70 commit af4d0ad
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 110 deletions.
23 changes: 7 additions & 16 deletions cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "base/strings/string_util.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/installer/launcher_support/chrome_launcher_support.h"
#include "cloud_print/common/win/cloud_print_utils.h"
Expand Down Expand Up @@ -113,11 +112,7 @@ base::FilePath GetLocalAppDataLow() {
}

base::FilePath GetAppDataDir() {
base::FilePath file_path;
if (base::win::GetVersion() >= base::win::VERSION_VISTA)
file_path = GetLocalAppDataLow();
else
PathService::Get(base::DIR_LOCAL_APP_DATA, &file_path);
base::FilePath file_path = GetLocalAppDataLow();
if (file_path.empty()) {
LOG(ERROR) << "Can't get app data dir";
}
Expand Down Expand Up @@ -304,19 +299,15 @@ bool ValidateCurrentUser() {
}
base::win::ScopedHandle token_scoped(token);

if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
DWORD session_id = 0;
DWORD dummy;
if (!GetTokenInformation(token_scoped.Get(), TokenSessionId,
DWORD session_id = 0;
DWORD dummy = 0;
if (!::GetTokenInformation(token_scoped.Get(), TokenSessionId,
reinterpret_cast<void*>(&session_id),
sizeof(DWORD), &dummy)) {
return false;
}
if (session_id == 0) {
return false;
}
return false;
}
return true;

return session_id != 0;
}
} // namespace

Expand Down
15 changes: 2 additions & 13 deletions gpu/config/gpu_info_collector_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "base/trace_event/trace_event.h"
#include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_comptr.h"
#include "base/win/windows_version.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface_egl.h"

Expand Down Expand Up @@ -84,18 +83,8 @@ CollectInfoResult CollectDriverInfoD3D(const std::wstring& device_id,
{0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}};

// create device info for the display device
HDEVINFO device_info;
if (base::win::GetVersion() <= base::win::VERSION_XP) {
// Collection of information on all adapters is much slower on XP (almost
// 100ms), and not very useful (as it's not going to use the GPU anyway), so
// just collect information on the current device. http://crbug.com/456178
device_info =
SetupDiGetClassDevsW(NULL, device_id.c_str(), NULL,
DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES);
} else {
device_info =
SetupDiGetClassDevsW(&display_class, NULL, NULL, DIGCF_PRESENT);
}
HDEVINFO device_info =
::SetupDiGetClassDevs(&display_class, NULL, NULL, DIGCF_PRESENT);
if (device_info == INVALID_HANDLE_VALUE) {
LOG(ERROR) << "Creating device info failed";
return kCollectInfoNonFatalFailure;
Expand Down
6 changes: 0 additions & 6 deletions gpu/config/gpu_test_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,6 @@ bool GPUTestBotConfig::CurrentConfigMatches(

// static
bool GPUTestBotConfig::GpuBlacklistedOnBot() {
#if defined(OS_WIN)
// Blacklist rule #79 disables all Gpu acceleration before Windows 7.
if (base::win::GetVersion() <= base::win::VERSION_VISTA) {
return true;
}
#endif
return false;
}

Expand Down
8 changes: 1 addition & 7 deletions media/audio/win/audio_manager_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,7 @@ static int NumberOfWaveOutBuffers() {
return buffers;
}

// Use 4 buffers for Vista, 3 for everyone else:
// - The entire Windows audio stack was rewritten for Windows Vista and wave
// out performance was degraded compared to XP.
// - The regression was fixed in Windows 7 and most configurations will work
// with 2, but some (e.g., some Sound Blasters) still need 3.
// - Some XP configurations (even multi-processor ones) also need 3.
return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3;
return 3;
}

AudioManagerWin::AudioManagerWin(std::unique_ptr<AudioThread> audio_thread,
Expand Down
5 changes: 1 addition & 4 deletions media/audio/win/audio_output_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "base/sync_socket.h"
#include "base/time/time.h"
#include "base/win/scoped_com_initializer.h"
#include "base/win/windows_version.h"
#include "media/audio/audio_device_info_accessor_for_tests.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_manager.h"
Expand Down Expand Up @@ -452,11 +451,9 @@ TEST_F(WinAudioTest, PCMWaveStreamPlay200HzToneLowLatency) {
audio_manager_device_info_->GetDefaultOutputStreamParameters();
int sample_rate = params.sample_rate();
uint32_t samples_10_ms = sample_rate / 100;
int n = 1;
(base::win::GetVersion() <= base::win::VERSION_XP) ? n = 5 : n = 1;
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
CHANNEL_LAYOUT_MONO, sample_rate, 16, n * samples_10_ms),
CHANNEL_LAYOUT_MONO, sample_rate, 16, samples_10_ms),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);

Expand Down
7 changes: 0 additions & 7 deletions media/audio/win/core_audio_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "base/win/scoped_handle.h"
#include "base/win/scoped_propvariant.h"
#include "base/win/scoped_variant.h"
#include "base/win/windows_version.h"
#include "media/audio/audio_device_description.h"
#include "media/base/media_switches.h"

Expand Down Expand Up @@ -204,12 +203,6 @@ static bool IsSupportedInternal() {
return false;
}

// Microsoft does not plan to make the Core Audio APIs available for use
// with earlier versions of Windows, including Microsoft Windows Server 2003,
// Windows XP, Windows Millennium Edition, Windows 2000, and Windows 98.
if (base::win::GetVersion() < base::win::VERSION_VISTA)
return false;

// The audio core APIs are implemented in the Mmdevapi.dll and Audioses.dll
// system components.
// Dependency Walker shows that it is enough to verify possibility to load
Expand Down
4 changes: 1 addition & 3 deletions mojo/edk/embedder/platform_channel_pair_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/win/windows_version.h"
#include "mojo/edk/embedder/platform_handle.h"

namespace mojo {
Expand Down Expand Up @@ -113,8 +112,7 @@ PlatformChannelPair::PrepareToPassClientHandleToChildProcessAsString(
DCHECK(handle_passing_info);
DCHECK(client_handle_.is_valid());

if (base::win::GetVersion() >= base::win::VERSION_VISTA)
handle_passing_info->push_back(client_handle_.get().handle);
handle_passing_info->push_back(client_handle_.get().handle);

return base::IntToString(HandleToLong(client_handle_.get().handle));
}
Expand Down
4 changes: 1 addition & 3 deletions mojo/edk/test/multiprocess_test_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
#include "mojo/edk/embedder/platform_channel_pair.h"
#include "testing/gtest/include/gtest/gtest.h"

#if defined(OS_WIN)
#include "base/win/windows_version.h"
#elif defined(OS_MACOSX) && !defined(OS_IOS)
#if defined(OS_MACOSX) && !defined(OS_IOS)
#include "base/mac/mach_port_broker.h"
#endif

Expand Down
42 changes: 1 addition & 41 deletions rlz/win/lib/process_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ HRESULT GetElevationType(PTOKEN_ELEVATION_TYPE elevation) {

*elevation = TokenElevationTypeDefault;

if (base::win::GetVersion() < base::win::VERSION_VISTA)
return E_FAIL;

HANDLE process_token;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &process_token))
return HRESULT_FROM_WIN32(GetLastError());
Expand All @@ -45,39 +42,6 @@ HRESULT GetElevationType(PTOKEN_ELEVATION_TYPE elevation) {
return S_OK;
}

// based on http://msdn2.microsoft.com/en-us/library/aa376389.aspx
bool GetUserGroup(long* group) {
if (!group)
return false;

*group = 0;

// groups are listed in DECREASING order of importance
// (eg. If a user is a member of both the admin group and
// the power user group, it is more useful to list the user
// as an admin)
DWORD user_groups[] = {DOMAIN_ALIAS_RID_ADMINS,
DOMAIN_ALIAS_RID_POWER_USERS};
SID_IDENTIFIER_AUTHORITY nt_authority = {SECURITY_NT_AUTHORITY};

for (size_t i = 0; i < arraysize(user_groups) && *group == 0; ++i) {
PSID current_group;
if (AllocateAndInitializeSid(&nt_authority, 2,
SECURITY_BUILTIN_DOMAIN_RID,
user_groups[i], 0, 0, 0, 0,
0, 0, &current_group)) {
BOOL current_level;
if (CheckTokenMembership(NULL, current_group, &current_level) &&
current_level) {
*group = user_groups[i];
}

FreeSid(current_group);
}
}

return group != 0;
}
} //anonymous


Expand All @@ -99,7 +63,7 @@ bool ProcessInfo::HasAdminRights() {
if (!evaluated) {
if (IsRunningAsSystem()) {
has_rights = true;
} else if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
} else {
TOKEN_ELEVATION_TYPE elevation;
if (SUCCEEDED(GetElevationType(&elevation))) {
base::IntegrityLevel level = base::GetCurrentProcessIntegrityLevel();
Expand All @@ -108,10 +72,6 @@ bool ProcessInfo::HasAdminRights() {
(level == base::HIGH_INTEGRITY);
}
}
} else {
long group = 0;
if (GetUserGroup(&group))
has_rights = (group == DOMAIN_ALIAS_RID_ADMINS);
}
}

Expand Down
3 changes: 0 additions & 3 deletions rlz/win/lib/registry_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ bool HasUserKeyAccess(bool write_access) {
}

if (write_access) {
if (base::win::GetVersion() < base::win::VERSION_VISTA)
return true;

if (base::GetCurrentProcessIntegrityLevel() <= base::LOW_INTEGRITY) {
ASSERT_STRING("UserKey::HasAccess: Cannot write from Low Integrity.");
return false;
Expand Down
7 changes: 0 additions & 7 deletions services/device/battery/battery_status_manager_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/metrics/histogram_macros.h"
#include "base/strings/string16.h"
#include "base/win/message_window.h"
#include "base/win/windows_version.h"
#include "services/device/battery/battery_status_manager.h"

namespace device {
Expand Down Expand Up @@ -120,17 +119,11 @@ class BatteryStatusObserver {
}

HPOWERNOTIFY RegisterNotification(LPCGUID power_setting) {
if (base::win::GetVersion() < base::win::VERSION_VISTA)
return NULL;

return RegisterPowerSettingNotification(window_->hwnd(), power_setting,
DEVICE_NOTIFY_WINDOW_HANDLE);
}

BOOL UnregisterNotification(HPOWERNOTIFY handle) {
if (base::win::GetVersion() < base::win::VERSION_VISTA)
return FALSE;

return UnregisterPowerSettingNotification(handle);
}

Expand Down

0 comments on commit af4d0ad

Please sign in to comment.