Removing useless Win7 checks + standardize its use
For example, if the comment mention Win8+, the check
will be base::win::GetVersion() >= base::win::VERSION_WIN8.
BUG=579196
Review-Url: https://codereview.chromium.org/2909943003
Cr-Commit-Position: refs/heads/master@{#476823}
diff --git a/base/files/file_enumerator_win.cc b/base/files/file_enumerator_win.cc
index 402a072..e629cc2 100644
--- a/base/files/file_enumerator_win.cc
+++ b/base/files/file_enumerator_win.cc
@@ -9,7 +9,6 @@
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
-#include "base/win/windows_version.h"
namespace base {
@@ -102,18 +101,14 @@
else
src = src.Append(pattern_);
- if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
- // Use a "large fetch" on newer Windows which should speed up large
- // enumerations (we seldom abort in the middle).
- find_handle_ = FindFirstFileEx(src.value().c_str(),
- FindExInfoBasic, // Omit short name.
- &find_data_,
- FindExSearchNameMatch,
- NULL,
- FIND_FIRST_EX_LARGE_FETCH);
- } else {
- find_handle_ = FindFirstFile(src.value().c_str(), &find_data_);
- }
+ // Use a "large fetch" which should speed up large enumerations (we seldom
+ // abort in the middle).
+ find_handle_ = FindFirstFileEx(src.value().c_str(),
+ FindExInfoBasic, // Omit short name.
+ &find_data_,
+ FindExSearchNameMatch,
+ NULL,
+ FIND_FIRST_EX_LARGE_FETCH);
has_find_data_ = true;
} else {
// Search for the next file/directory.
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc
index d86bc0f..ad3334a 100644
--- a/base/path_service_unittest.cc
+++ b/base/path_service_unittest.cc
@@ -42,13 +42,6 @@
if (dir_type == DIR_USER_DESKTOP)
check_path_exists = false;
#endif
-#if defined(OS_WIN)
- if (dir_type == DIR_TASKBAR_PINS) {
- // There is no pinned-to-taskbar shortcuts prior to Win7.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- check_path_exists = false;
- }
-#endif
#if defined(OS_MACOSX)
if (dir_type != DIR_EXE && dir_type != DIR_MODULE &&
dir_type != FILE_EXE && dir_type != FILE_MODULE) {
diff --git a/base/test/test_shortcut_win.cc b/base/test/test_shortcut_win.cc
index 25dc372..196cee9 100644
--- a/base/test/test_shortcut_win.cc
+++ b/base/test/test_shortcut_win.cc
@@ -14,7 +14,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_comptr.h"
#include "base/win/scoped_propvariant.h"
-#include "base/win/windows_version.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -113,44 +112,42 @@
EXPECT_EQ(properties.icon_index, read_icon_index);
}
- if (GetVersion() >= VERSION_WIN7) {
- ScopedComPtr<IPropertyStore> property_store;
- EXPECT_TRUE(
- SUCCEEDED(hr = i_shell_link.CopyTo(property_store.GetAddressOf())));
- if (FAILED(hr))
- return;
+ ScopedComPtr<IPropertyStore> property_store;
+ EXPECT_TRUE(
+ SUCCEEDED(hr = i_shell_link.CopyTo(property_store.GetAddressOf())));
+ if (FAILED(hr))
+ return;
- if (properties.options & ShortcutProperties::PROPERTIES_APP_ID) {
- ScopedPropVariant pv_app_id;
- EXPECT_EQ(S_OK, property_store->GetValue(PKEY_AppUserModel_ID,
- pv_app_id.Receive()));
- switch (pv_app_id.get().vt) {
- case VT_EMPTY:
- EXPECT_TRUE(properties.app_id.empty());
- break;
- case VT_LPWSTR:
- EXPECT_EQ(properties.app_id, pv_app_id.get().pwszVal);
- break;
- default:
- ADD_FAILURE() << "Unexpected variant type: " << pv_app_id.get().vt;
- }
+ if (properties.options & ShortcutProperties::PROPERTIES_APP_ID) {
+ ScopedPropVariant pv_app_id;
+ EXPECT_EQ(S_OK, property_store->GetValue(PKEY_AppUserModel_ID,
+ pv_app_id.Receive()));
+ switch (pv_app_id.get().vt) {
+ case VT_EMPTY:
+ EXPECT_TRUE(properties.app_id.empty());
+ break;
+ case VT_LPWSTR:
+ EXPECT_EQ(properties.app_id, pv_app_id.get().pwszVal);
+ break;
+ default:
+ ADD_FAILURE() << "Unexpected variant type: " << pv_app_id.get().vt;
}
+ }
- if (properties.options & ShortcutProperties::PROPERTIES_DUAL_MODE) {
- ScopedPropVariant pv_dual_mode;
- EXPECT_EQ(S_OK, property_store->GetValue(PKEY_AppUserModel_IsDualMode,
- pv_dual_mode.Receive()));
- switch (pv_dual_mode.get().vt) {
- case VT_EMPTY:
- EXPECT_FALSE(properties.dual_mode);
- break;
- case VT_BOOL:
- EXPECT_EQ(properties.dual_mode,
- static_cast<bool>(pv_dual_mode.get().boolVal));
- break;
- default:
- ADD_FAILURE() << "Unexpected variant type: " << pv_dual_mode.get().vt;
- }
+ if (properties.options & ShortcutProperties::PROPERTIES_DUAL_MODE) {
+ ScopedPropVariant pv_dual_mode;
+ EXPECT_EQ(S_OK, property_store->GetValue(PKEY_AppUserModel_IsDualMode,
+ pv_dual_mode.Receive()));
+ switch (pv_dual_mode.get().vt) {
+ case VT_EMPTY:
+ EXPECT_FALSE(properties.dual_mode);
+ break;
+ case VT_BOOL:
+ EXPECT_EQ(properties.dual_mode,
+ static_cast<bool>(pv_dual_mode.get().boolVal));
+ break;
+ default:
+ ADD_FAILURE() << "Unexpected variant type: " << pv_dual_mode.get().vt;
}
}
}
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
index 8cabf38..95adfce0 100644
--- a/base/win/shortcut.cc
+++ b/base/win/shortcut.cc
@@ -137,8 +137,7 @@
(properties.options & ShortcutProperties::PROPERTIES_APP_ID) != 0;
bool has_dual_mode =
(properties.options & ShortcutProperties::PROPERTIES_DUAL_MODE) != 0;
- if ((has_app_id || has_dual_mode) &&
- GetVersion() >= VERSION_WIN7) {
+ if (has_app_id || has_dual_mode) {
ScopedComPtr<IPropertyStore> property_store;
if (FAILED(i_shell_link.CopyTo(property_store.GetAddressOf())) ||
!property_store.Get())
@@ -248,9 +247,7 @@
properties->set_icon(FilePath(temp), temp_index);
}
- // Windows 7+ options, avoiding unnecessary work.
- if ((options & ShortcutProperties::PROPERTIES_WIN7) &&
- GetVersion() >= VERSION_WIN7) {
+ if (options & ShortcutProperties::PROPERTIES_WIN7) {
ScopedComPtr<IPropertyStore> property_store;
if (FAILED(i_shell_link.CopyTo(property_store.GetAddressOf())))
return false;
@@ -319,9 +316,8 @@
}
bool CanPinShortcutToTaskbar() {
- // "Pin to taskbar" appeared in Windows 7 and stopped being supported in
- // Windows 10.
- return GetVersion() >= VERSION_WIN7 && GetVersion() < VERSION_WIN10;
+ // "Pin to taskbar" stopped being supported in Windows 10.
+ return GetVersion() < VERSION_WIN10;
}
bool PinShortcutToTaskbar(const FilePath& shortcut) {
@@ -336,11 +332,6 @@
bool UnpinShortcutFromTaskbar(const FilePath& shortcut) {
base::ThreadRestrictions::AssertIOAllowed();
- // "Unpin from taskbar" is only supported after Win7. It is possible to remove
- // a shortcut pinned by a user on Windows 10+.
- if (GetVersion() < VERSION_WIN7)
- return false;
-
intptr_t result = reinterpret_cast<intptr_t>(ShellExecute(
NULL, L"taskbarunpin", shortcut.value().c_str(), NULL, NULL, 0));
return result > 32;
diff --git a/base/win/shortcut.h b/base/win/shortcut.h
index c48ec12..3cd70fc9 100644
--- a/base/win/shortcut.h
+++ b/base/win/shortcut.h
@@ -46,6 +46,8 @@
PROPERTIES_ARGUMENTS |
PROPERTIES_DESCRIPTION |
PROPERTIES_ICON,
+ // TODO(pmonette): Get rid of PROPERTIES_WIN7 now that Windows 7 is the last
+ // supported Windows version.
PROPERTIES_WIN7 = PROPERTIES_APP_ID | PROPERTIES_DUAL_MODE,
PROPERTIES_ALL = PROPERTIES_BASIC | PROPERTIES_WIN7
};
diff --git a/base/win/shortcut_unittest.cc b/base/win/shortcut_unittest.cc
index 1bb6325..b1d9345 100644
--- a/base/win/shortcut_unittest.cc
+++ b/base/win/shortcut_unittest.cc
@@ -15,7 +15,6 @@
#include "base/test/test_file_util.h"
#include "base/test/test_shortcut_win.h"
#include "base/win/scoped_com_initializer.h"
-#include "base/win/windows_version.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -84,8 +83,7 @@
TEST_F(ShortcutTest, CreateAndResolveShortcutProperties) {
uint32_t valid_properties = ShortcutProperties::PROPERTIES_BASIC;
- if (GetVersion() >= VERSION_WIN7)
- valid_properties |= ShortcutProperties::PROPERTIES_WIN7;
+ valid_properties |= ShortcutProperties::PROPERTIES_WIN7;
// Test all properties.
FilePath file_1(temp_dir_.GetPath().Append(L"Link1.lnk"));
@@ -103,10 +101,8 @@
EXPECT_EQ(link_properties_.description, properties_read_1.description);
ValidatePathsAreEqual(link_properties_.icon, properties_read_1.icon);
EXPECT_EQ(link_properties_.icon_index, properties_read_1.icon_index);
- if (GetVersion() >= VERSION_WIN7) {
- EXPECT_EQ(link_properties_.app_id, properties_read_1.app_id);
- EXPECT_EQ(link_properties_.dual_mode, properties_read_1.dual_mode);
- }
+ EXPECT_EQ(link_properties_.app_id, properties_read_1.app_id);
+ EXPECT_EQ(link_properties_.dual_mode, properties_read_1.dual_mode);
// Test simple shortcut with no special properties set.
FilePath file_2(temp_dir_.GetPath().Append(L"Link2.lnk"));
@@ -126,10 +122,8 @@
EXPECT_EQ(L"", properties_read_2.description);
ValidatePathsAreEqual(FilePath(), properties_read_2.icon);
EXPECT_EQ(0, properties_read_2.icon_index);
- if (GetVersion() >= VERSION_WIN7) {
- EXPECT_EQ(L"", properties_read_2.app_id);
- EXPECT_FALSE(properties_read_2.dual_mode);
- }
+ EXPECT_EQ(L"", properties_read_2.app_id);
+ EXPECT_FALSE(properties_read_2.dual_mode);
}
TEST_F(ShortcutTest, CreateAndResolveShortcut) {
diff --git a/chrome/browser/download/download_status_updater_win.cc b/chrome/browser/download/download_status_updater_win.cc
index 93a36f00..6f6b3d7 100644
--- a/chrome/browser/download/download_status_updater_win.cc
+++ b/chrome/browser/download/download_status_updater_win.cc
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "base/win/scoped_comptr.h"
-#include "base/win/windows_version.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
@@ -21,10 +20,6 @@
void UpdateTaskbarProgressBar(int download_count,
bool progress_known,
float progress) {
- // Taskbar progress bar is only supported on Win7.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::win::ScopedComPtr<ITaskbarList3> taskbar;
HRESULT result = ::CoCreateInstance(
CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&taskbar));
diff --git a/chrome/browser/media/webrtc/webrtc_audio_quality_browsertest.cc b/chrome/browser/media/webrtc/webrtc_audio_quality_browsertest.cc
index 894f45e..cf50555 100644
--- a/chrome/browser/media/webrtc/webrtc_audio_quality_browsertest.cc
+++ b/chrome/browser/media/webrtc/webrtc_audio_quality_browsertest.cc
@@ -662,9 +662,9 @@
void MAYBE_WebRtcAudioQualityBrowserTest::TestWithFakeDeviceGetUserMedia(
const std::string& constraints,
const std::string& perf_modifier) {
- if (OnWin8()) {
+ if (OnWin8OrHigher()) {
// http://crbug.com/379798.
- LOG(ERROR) << "This test is not implemented for Windows XP/Win8.";
+ LOG(ERROR) << "This test is not implemented for Win8 or higher.";
return;
}
@@ -689,9 +689,9 @@
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
MANUAL_TestCallQualityWithAudioFromWebAudio) {
base::ThreadRestrictions::ScopedAllowIO allow_io;
- if (OnWin8()) {
+ if (OnWin8OrHigher()) {
// http://crbug.com/379798.
- LOG(ERROR) << "This test is not implemented for Windows XP/Win8.";
+ LOG(ERROR) << "This test is not implemented for Win8 or higher.";
return;
}
ASSERT_TRUE(test::HasReferenceFilesInCheckout());
@@ -764,9 +764,9 @@
const base::FilePath::StringType& reference_filename,
const std::string& constraints,
const std::string& perf_modifier) {
- if (OnWin8()) {
+ if (OnWin8OrHigher()) {
// http://crbug.com/379798.
- LOG(ERROR) << "This test is not implemented for Windows XP/Win8.";
+ LOG(ERROR) << "This test is not implemented for Win8 or higher.";
return;
}
base::FilePath reference_file =
diff --git a/chrome/browser/media/webrtc/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
index 562ca64..e258eb2 100644
--- a/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
+++ b/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
@@ -461,9 +461,9 @@
return result.substr(3);
}
-bool WebRtcTestBase::OnWin8() const {
+bool WebRtcTestBase::OnWin8OrHigher() const {
#if defined(OS_WIN)
- return base::win::GetVersion() > base::win::VERSION_WIN7;
+ return base::win::GetVersion() >= base::win::VERSION_WIN8;
#else
return false;
#endif
diff --git a/chrome/browser/media/webrtc/webrtc_browsertest_base.h b/chrome/browser/media/webrtc/webrtc_browsertest_base.h
index 4e1b150..5546ec8 100644
--- a/chrome/browser/media/webrtc/webrtc_browsertest_base.h
+++ b/chrome/browser/media/webrtc/webrtc_browsertest_base.h
@@ -158,8 +158,8 @@
std::string GetStreamSize(content::WebContents* tab_contents,
const std::string& video_element) const;
- // Returns true if we're on win 8.
- bool OnWin8() const;
+ // Returns true if we're on Windows 8 or higher.
+ bool OnWin8OrHigher() const;
void OpenDatabase(content::WebContents* tab) const;
void CloseDatabase(content::WebContents* tab) const;
diff --git a/chrome/browser/password_manager/password_manager_util_win.cc b/chrome/browser/password_manager/password_manager_util_win.cc
index 01dd5c2..c883e8f 100644
--- a/chrome/browser/password_manager/password_manager_util_win.cc
+++ b/chrome/browser/password_manager/password_manager_util_win.cc
@@ -25,7 +25,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/time/time.h"
-#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/grit/chromium_strings.h"
#include "components/password_manager/core/browser/password_manager.h"
@@ -178,10 +177,7 @@
*status = PASSWORD_STATUS_WIN_DOMAIN;
} else {
username_length = CREDUI_MAX_USERNAME_LENGTH;
- // CheckBlankPasswordWithPrefs() isn't safe to call on before Windows 7.
- // http://crbug.com/345916
- if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
- GetUserName(username, &username_length)) {
+ if (GetUserName(username, &username_length)) {
*status = CheckBlankPasswordWithPrefs(username, prefs) ?
PASSWORD_STATUS_BLANK :
PASSWORD_STATUS_NONBLANK;
diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc
index b5324b3..d00d33a7 100644
--- a/chrome/browser/prefs/incognito_mode_prefs.cc
+++ b/chrome/browser/prefs/incognito_mode_prefs.cc
@@ -29,7 +29,6 @@
#include "base/bind_helpers.h"
#include "base/memory/singleton.h"
#include "base/win/scoped_comptr.h"
-#include "base/win/windows_version.h"
#endif // OS_WIN
#if defined(OS_ANDROID)
@@ -77,10 +76,6 @@
// Since we can potentially block, make sure the thread is okay with this.
base::ThreadRestrictions::AssertIOAllowed();
- // Query this info on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return false;
-
ThreadType thread_type = ThreadType::BLOCKING;
if (BrowserThread::IsThreadInitialized(BrowserThread::UI) &&
content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index c8fc1ac..fb717d2 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -746,9 +746,6 @@
}
void MigrateTaskbarPins() {
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
// This needs to happen (e.g. so that the appid is fixed and the
// run-time Chrome icon is merged with the taskbar shortcut), but it is not an
// urgent task.
@@ -765,8 +762,6 @@
int MigrateShortcutsInPathInternal(const base::FilePath& chrome_exe,
const base::FilePath& path) {
- DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN7);
-
// Enumerate all pinned shortcuts in the given path directly.
base::FileEnumerator shortcuts_enum(
path, false, // not recursive
diff --git a/chrome/browser/shell_integration_win_unittest.cc b/chrome/browser/shell_integration_win_unittest.cc
index 7276263..89596e7 100644
--- a/chrome/browser/shell_integration_win_unittest.cc
+++ b/chrome/browser/shell_integration_win_unittest.cc
@@ -17,7 +17,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/test/test_shortcut_win.h"
#include "base/win/scoped_com_initializer.h"
-#include "base/win/windows_version.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths_internal.h"
@@ -257,9 +256,6 @@
} // namespace
TEST_F(ShellIntegrationWinMigrateShortcutTest, ClearDualModeAndAdjustAppIds) {
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
// 9 shortcuts should have their app id updated below and shortcut 11 should
// be migrated away from dual_mode for a total of 10 shortcuts migrated.
EXPECT_EQ(10,
diff --git a/chrome/browser/ui/pdf/adobe_reader_info_win.cc b/chrome/browser/ui/pdf/adobe_reader_info_win.cc
index 16893f6..8b180af 100644
--- a/chrome/browser/ui/pdf/adobe_reader_info_win.cc
+++ b/chrome/browser/ui/pdf/adobe_reader_info_win.cc
@@ -18,7 +18,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/version.h"
#include "base/win/registry.h"
-#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
namespace {
@@ -41,9 +40,8 @@
base::FilePath filepath;
base::win::RegKey hkcu_key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ);
base::string16 path;
- // As of Win7 AppPaths can also be registered in HKCU: http://goo.gl/UgFOf.
- if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
- hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) {
+ // AppPaths can also be registered in HKCU: http://goo.gl/UgFOf.
+ if (hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) {
filepath = base::FilePath(path);
} else {
base::win::RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ);
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc
index cafaf26..4d4fd0e7 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.cc
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc
@@ -58,10 +58,6 @@
#include "chrome/browser/themes/theme_service_factory.h"
#endif
-#if defined(OS_WIN)
-#include "base/win/windows_version.h"
-#endif
-
using content::WebContents;
using content::WebPreferences;
@@ -166,8 +162,7 @@
return false;
UINT smooth_type = 0;
SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &smooth_type, 0);
- return (base::win::GetVersion() >= base::win::VERSION_WIN7) &&
- (smooth_type == FE_FONTSMOOTHINGCLEARTYPE);
+ return smooth_type == FE_FONTSMOOTHINGCLEARTYPE;
}
#endif
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
index ae3f329..d089d9b 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -158,12 +158,8 @@
return LM_SHORTCUT_NONAME;
base::string16 shortcut(si.lpTitle);
// The windows quick launch path is not localized.
- if (shortcut.find(L"\\Quick Launch\\") != base::string16::npos) {
- if (base::win::GetVersion() >= base::win::VERSION_WIN7)
- return LM_SHORTCUT_TASKBAR;
- else
- return LM_SHORTCUT_QUICKLAUNCH;
- }
+ if (shortcut.find(L"\\Quick Launch\\") != base::string16::npos)
+ return LM_SHORTCUT_TASKBAR;
std::unique_ptr<base::Environment> env(base::Environment::Create());
std::string appdata_path;
env->GetVar("USERPROFILE", &appdata_path);
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
index bbd6e94..f70dabe1 100644
--- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
+++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
@@ -325,7 +325,7 @@
gfx::Point right_bottom = display::win::ScreenWin::DIPToClientPoint(
hwnd, gfx::Point(thicknesses.right(), thicknesses.bottom()));
- if (base::win::GetVersion() <= base::win::VERSION_WIN7) {
+ if (base::win::GetVersion() < base::win::VERSION_WIN8) {
// The 2 px (not DIP) at the inner edges of the glass are a light and
// dark line, so we must inset further to account for those.
constexpr gfx::Vector2d kDWMEdgeThickness(2, 2);
diff --git a/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc b/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc
index ef906ff..79aa8d6 100644
--- a/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc
+++ b/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc
@@ -17,7 +17,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_comptr.h"
#include "base/win/scoped_propvariant.h"
-#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/profiles/profile.h"
@@ -183,10 +182,6 @@
// http://crbug.com/396344
IN_PROC_BROWSER_TEST_F(BrowserTestWithProfileShortcutManager,
DISABLED_WindowProperties) {
- // This test checks HWND properties that are only available on Win7+.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
// Single profile case. The profile name should not be shown.
WaitAndValidateBrowserWindowProperties(base::Bind(
&ValidateBrowserWindowProperties, browser(), base::string16()));
@@ -230,10 +225,6 @@
// http://crbug.com/396344
IN_PROC_BROWSER_TEST_F(BrowserWindowPropertyManagerTest, DISABLED_HostedApp) {
- // This test checks HWND properties that are only available on Win7+.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
// Load an app.
const extensions::Extension* extension =
LoadExtension(test_data_dir_.AppendASCII("app/"));
diff --git a/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc b/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
index 00fcecd..3080979d 100644
--- a/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
+++ b/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
@@ -97,9 +97,6 @@
BrowserWindowPropertyManager::CreateBrowserWindowPropertyManager(
BrowserView* view,
HWND hwnd) {
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return nullptr;
-
std::unique_ptr<BrowserWindowPropertyManager> browser_window_property_manager(
new BrowserWindowPropertyManager(view, hwnd));
browser_window_property_manager->UpdateWindowProperties();
diff --git a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc
index 5f99203..aab7e5a 100644
--- a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc
+++ b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc
@@ -12,7 +12,6 @@
#include "base/task_scheduler/post_task.h"
#include "base/win/scoped_comptr.h"
#include "base/win/scoped_gdi_object.h"
-#include "base/win/windows_version.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
@@ -69,9 +68,6 @@
} // namespace
void DrawTaskbarDecoration(gfx::NativeWindow window, const gfx::Image* image) {
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
HWND hwnd = views::HWNDForNativeWindow(window);
// SetOverlayIcon() does nothing if the window is not visible so testing here
diff --git a/chrome/browser/ui/webui/set_as_default_browser_ui_browsertest_win.cc b/chrome/browser/ui/webui/set_as_default_browser_ui_browsertest_win.cc
index eef463871..80e5953 100644
--- a/chrome/browser/ui/webui/set_as_default_browser_ui_browsertest_win.cc
+++ b/chrome/browser/ui/webui/set_as_default_browser_ui_browsertest_win.cc
@@ -40,8 +40,8 @@
IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithFirstRun, Test) {
// Windows 8 only test case.
- if (base::win::GetVersion() <= base::win::VERSION_WIN7 ||
- base::win::GetVersion() >= base::win::VERSION_WIN10) {
+ if (base::win::GetVersion() != base::win::VERSION_WIN8 &&
+ base::win::GetVersion() != base::win::VERSION_WIN8_1) {
return;
}
ASSERT_FALSE(IsBrowserVisible(browser()));
diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc
index 6b50fa4c..92a2c1b 100644
--- a/chrome/browser/unload_browsertest.cc
+++ b/chrome/browser/unload_browsertest.cc
@@ -32,11 +32,6 @@
#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request_test_util.h"
-#if defined(OS_WIN)
-// For version specific disabled tests below (http://crbug.com/267597).
-#include "base/win/windows_version.h"
-#endif
-
using base::TimeDelta;
using content::BrowserThread;
@@ -761,12 +756,8 @@
}
// Fails on Mac, Linux, Win7 (http://crbug.com/301173).
+// Flaky on Windows bots (http://crbug.com/267597).
IN_PROC_BROWSER_TEST_F(FastUnloadTest, DISABLED_ClosingLastTabFinishesUnload) {
-#if defined(OS_WIN)
- // Flaky on Win7+ bots (http://crbug.com/267597).
- if (base::win::GetVersion() >= base::win::VERSION_WIN7)
- return;
-#endif
// Check for cookie set in unload handler of PRE_ test.
NavigateToPage("no_listeners");
EXPECT_EQ("unloaded=ohyeah", GetCookies("no_listeners"));
diff --git a/chrome/browser/web_applications/update_shortcut_worker_win.cc b/chrome/browser/web_applications/update_shortcut_worker_win.cc
index cd24d08..9d3ae82 100644
--- a/chrome/browser/web_applications/update_shortcut_worker_win.cc
+++ b/chrome/browser/web_applications/update_shortcut_worker_win.cc
@@ -15,7 +15,6 @@
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/shortcut.h"
-#include "base/win/windows_version.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/profiles/profile.h"
@@ -159,9 +158,7 @@
}, {
// For Win7, create_in_quick_launch_bar means pinning to taskbar.
base::DIR_APP_DATA,
- (base::win::GetVersion() >= base::win::VERSION_WIN7) ?
- L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar" :
- L"Microsoft\\Internet Explorer\\Quick Launch"
+ L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"
}
};
diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc
index a71ee45..ef26f88 100644
--- a/chrome/browser/web_applications/web_app_win.cc
+++ b/chrome/browser/web_applications/web_app_win.cc
@@ -22,7 +22,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/win/shortcut.h"
-#include "base/win/windows_version.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/shell_integration_win.h"
#include "chrome/browser/web_applications/update_shortcut_worker_win.h"
@@ -300,10 +299,8 @@
web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
std::vector<base::FilePath> all_paths = web_app::internals::GetShortcutPaths(
all_shortcut_locations);
- if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
- !web_app_path.empty()) {
+ if (!web_app_path.empty())
all_paths.push_back(web_app_path);
- }
if (was_pinned_to_taskbar) {
// Determine if there is a link to this app in the TaskBar pin directory.
diff --git a/chrome/utility/importer/edge_database_reader_unittest_win.cc b/chrome/utility/importer/edge_database_reader_unittest_win.cc
index 630f439e..80e194c 100644
--- a/chrome/utility/importer/edge_database_reader_unittest_win.cc
+++ b/chrome/utility/importer/edge_database_reader_unittest_win.cc
@@ -16,7 +16,6 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/win/windows_version.h"
#include "chrome/common/chrome_paths.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/zlib/google/compression_utils.h"
@@ -72,10 +71,6 @@
} // namespace
TEST_F(EdgeDatabaseReaderTest, OpenFileTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -83,19 +78,11 @@
}
TEST_F(EdgeDatabaseReaderTest, NoFileTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
EdgeDatabaseReader reader;
EXPECT_FALSE(reader.OpenDatabase(L"ThisIsntARealFileName.edb"));
}
TEST_F(EdgeDatabaseReaderTest, RandomGarbageDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"random.edb", &database_path));
EdgeDatabaseReader reader;
@@ -103,10 +90,6 @@
}
TEST_F(EdgeDatabaseReaderTest, ZerosDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
std::string zeros(0x10000, '\0');
ASSERT_TRUE(WriteFile(L"zeros.edb", zeros, &database_path));
@@ -115,10 +98,6 @@
}
TEST_F(EdgeDatabaseReaderTest, EmptyDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(WriteFile(L"empty.edb", "", &database_path));
EdgeDatabaseReader reader;
@@ -126,10 +105,6 @@
}
TEST_F(EdgeDatabaseReaderTest, OpenTableDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -140,10 +115,6 @@
}
TEST_F(EdgeDatabaseReaderTest, InvalidTableDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -154,10 +125,6 @@
}
TEST_F(EdgeDatabaseReaderTest, NotOpenDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
EdgeDatabaseReader reader;
std::unique_ptr<EdgeDatabaseTableEnumerator> table_enum =
reader.OpenTableEnumerator(L"TestTable");
@@ -166,10 +133,6 @@
}
TEST_F(EdgeDatabaseReaderTest, AlreadyOpenDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -179,10 +142,6 @@
}
TEST_F(EdgeDatabaseReaderTest, OpenTableAndReadDataDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -242,10 +201,6 @@
}
TEST_F(EdgeDatabaseReaderTest, CheckEnumResetDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -266,10 +221,6 @@
}
TEST_F(EdgeDatabaseReaderTest, InvalidColumnDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -283,10 +234,6 @@
}
TEST_F(EdgeDatabaseReaderTest, NoColumnDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -300,10 +247,6 @@
}
TEST_F(EdgeDatabaseReaderTest, EmptyTableDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -327,9 +270,6 @@
"\x48\x65\x6C\x6C\x6F",
"\xEC\x95\x88\xEB\x85\x95\xED\x95\x98\xEC\x84\xB8\xEC\x9A\x94",
};
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
@@ -352,10 +292,6 @@
}
TEST_F(EdgeDatabaseReaderTest, NonUnicodeStringsDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -369,10 +305,6 @@
}
TEST_F(EdgeDatabaseReaderTest, CheckNullColumnDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
@@ -420,10 +352,6 @@
}
TEST_F(EdgeDatabaseReaderTest, CheckInvalidColumnTypeDatabaseTest) {
- // Only verified to work with ESE library on Windows 7 and above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::FilePath database_path;
ASSERT_TRUE(CopyTestDatabase(L"testdata.edb", &database_path));
EdgeDatabaseReader reader;
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 70ae0dd..fc353a1 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -257,8 +257,7 @@
bool IsOSSupported() {
// We don't support Vista or older.
- base::win::Version version = base::win::GetVersion();
- return (version >= base::win::VERSION_WIN7);
+ return base::win::GetVersion() >= base::win::VERSION_WIN7;
}
HRESULT RegisterVirtualDriver(const base::FilePath& install_path) {
diff --git a/components/metrics/drive_metrics_provider_win.cc b/components/metrics/drive_metrics_provider_win.cc
index 360b80e..04647a9 100644
--- a/components/metrics/drive_metrics_provider_win.cc
+++ b/components/metrics/drive_metrics_provider_win.cc
@@ -11,18 +11,12 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/strings/stringprintf.h"
-#include "base/win/windows_version.h"
namespace metrics {
// static
bool DriveMetricsProvider::HasSeekPenalty(const base::FilePath& path,
bool* has_seek_penalty) {
- if (base::win::GetVersion() < base::win::VERSION_WIN7) {
- // TODO(dbeam): re-enable XP and Vista detection in a utility process.
- return false;
- }
-
std::vector<base::FilePath::StringType> components;
path.GetComponents(&components);
diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc
index b1fb4d6..770362c 100644
--- a/content/browser/renderer_host/legacy_render_widget_host_win.cc
+++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc
@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/win/win_util.h"
-#include "base/win/windows_version.h"
#include "content/browser/accessibility/browser_accessibility_manager_win.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/accessibility/browser_accessibility_win.h"
@@ -123,8 +122,7 @@
}
bool LegacyRenderWidgetHostHWND::Init() {
- if (base::win::GetVersion() >= base::win::VERSION_WIN7)
- RegisterTouchWindow(hwnd(), TWF_WANTPALM);
+ RegisterTouchWindow(hwnd(), TWF_WANTPALM);
HRESULT hr = ::CreateStdAccessibleObject(hwnd(), OBJID_WINDOW,
IID_PPV_ARGS(&window_accessible_));
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index 3d6f9b80..3963c6e 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -403,7 +403,7 @@
sandbox::ResultCode result = sandbox::SBOX_ALL_OK;
// Win8+ adds a device DeviceApi that we don't need.
- if (base::win::GetVersion() > base::win::VERSION_WIN7)
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8)
result = policy->AddKernelObjectToClose(L"File", L"\\Device\\DeviceApi");
if (result != sandbox::SBOX_ALL_OK)
return result;
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index ebd62ac..39c079d 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -58,7 +58,6 @@
#if defined(OS_WIN)
#include "base/win/win_util.h"
-#include "base/win/windows_version.h"
#include "content/child/font_warmup_win.h"
#include "sandbox/win/src/sandbox.h"
#elif defined(OS_MACOSX)
@@ -75,10 +74,6 @@
extern sandbox::TargetServices* g_target_services;
// Used by EnumSystemLocales for warming up.
-static BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) {
- return TRUE;
-}
-
static BOOL CALLBACK EnumLocalesProcEx(
LPWSTR lpLocaleString,
DWORD dwFlags,
@@ -91,21 +86,8 @@
::GetUserDefaultLangID();
::GetUserDefaultLCID();
- if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) {
- if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
- typedef BOOL (WINAPI *PfnEnumSystemLocalesEx)
- (LOCALE_ENUMPROCEX, DWORD, LPARAM, LPVOID);
-
- HMODULE handle_kern32 = GetModuleHandleW(L"Kernel32.dll");
- PfnEnumSystemLocalesEx enum_sys_locales_ex =
- reinterpret_cast<PfnEnumSystemLocalesEx>
- (GetProcAddress(handle_kern32, "EnumSystemLocalesEx"));
-
- enum_sys_locales_ex(EnumLocalesProcEx, LOCALE_WINDOWS, 0, 0);
- } else {
- EnumSystemLocalesW(EnumLocalesProc, LCID_INSTALLED);
- }
- }
+ if (permissions.HasPermission(ppapi::PERMISSION_FLASH))
+ ::EnumSystemLocalesEx(EnumLocalesProcEx, LOCALE_WINDOWS, 0, 0);
}
#endif
@@ -415,28 +397,22 @@
// can be loaded. TODO(cpu): consider changing to the loading style of
// regular plugins.
if (g_target_services) {
- // Let Flash and Widevine CDM adapter load DXVA before lockdown on Vista+.
+ // Let Flash and Widevine CDM adapter load DXVA before lockdown.
if (permissions.HasPermission(ppapi::PERMISSION_FLASH) ||
path.BaseName().MaybeAsASCII() == kWidevineCdmAdapterFileName) {
- if (base::win::OSInfo::GetInstance()->version() >=
- base::win::VERSION_VISTA) {
- LoadLibraryA("dxva2.dll");
- }
+ LoadLibraryA("dxva2.dll");
}
if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) {
- if (base::win::OSInfo::GetInstance()->version() >=
- base::win::VERSION_WIN7) {
- base::CPU cpu;
- if (cpu.vendor_name() == "AuthenticAMD") {
- // The AMD crypto acceleration is only AMD Bulldozer and above.
+ base::CPU cpu;
+ if (cpu.vendor_name() == "AuthenticAMD") {
+ // The AMD crypto acceleration is only AMD Bulldozer and above.
#if defined(_WIN64)
- LoadLibraryA("amdhcp64.dll");
+ LoadLibraryA("amdhcp64.dll");
#else
- LoadLibraryA("amdhcp32.dll");
+ LoadLibraryA("amdhcp32.dll");
#endif
}
- }
}
// Cause advapi32 to load before the sandbox is turned on.
diff --git a/device/gamepad/gamepad_platform_data_fetcher_win.cc b/device/gamepad/gamepad_platform_data_fetcher_win.cc
index 42404e0..2f2f7ac 100644
--- a/device/gamepad/gamepad_platform_data_fetcher_win.cc
+++ b/device/gamepad/gamepad_platform_data_fetcher_win.cc
@@ -68,14 +68,10 @@
// Xinput.h specifies it in build time. Approach here uses the same values
// and it is resolving dll filename based on Windows version it is running on.
if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
- // For Windows 8 and 10, XINPUT_DLL is xinput1_4.dll.
+ // For Windows 8+, XINPUT_DLL is xinput1_4.dll.
return FILE_PATH_LITERAL("xinput1_4.dll");
- } else if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
- return FILE_PATH_LITERAL("xinput9_1_0.dll");
- } else {
- NOTREACHED();
- return nullptr;
}
+ return FILE_PATH_LITERAL("xinput9_1_0.dll");
}
} // namespace
diff --git a/device/power_save_blocker/power_save_blocker_win.cc b/device/power_save_blocker/power_save_blocker_win.cc
index 2d257224..83830a7 100644
--- a/device/power_save_blocker/power_save_blocker_win.cc
+++ b/device/power_save_blocker/power_save_blocker_win.cc
@@ -17,12 +17,10 @@
namespace device {
namespace {
-int g_blocker_count[2];
-
HANDLE CreatePowerRequest(POWER_REQUEST_TYPE type,
const std::string& description) {
if (type == PowerRequestExecutionRequired &&
- base::win::GetVersion() < base::win::VERSION_WIN8) {
+ base::win::GetVersion() == base::win::VERSION_WIN7) {
return INVALID_HANDLE_VALUE;
}
@@ -51,7 +49,7 @@
return;
if (type == PowerRequestExecutionRequired &&
- base::win::GetVersion() < base::win::VERSION_WIN8) {
+ base::win::GetVersion() == base::win::VERSION_WIN7) {
return;
}
@@ -59,30 +57,6 @@
DCHECK(success);
}
-void ApplySimpleBlock(PowerSaveBlocker::PowerSaveBlockerType type, int delta) {
- g_blocker_count[type] += delta;
- DCHECK_GE(g_blocker_count[type], 0);
-
- if (g_blocker_count[type] > 1)
- return;
-
- DWORD this_flag = 0;
- if (type == PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension)
- this_flag |= ES_SYSTEM_REQUIRED;
- else
- this_flag |= ES_DISPLAY_REQUIRED;
-
- DCHECK(this_flag);
-
- static DWORD flags = ES_CONTINUOUS;
- if (!g_blocker_count[type])
- flags &= ~this_flag;
- else
- flags |= this_flag;
-
- SetThreadExecutionState(flags);
-}
-
} // namespace
class PowerSaveBlocker::Delegate
@@ -116,17 +90,11 @@
void PowerSaveBlocker::Delegate::ApplyBlock() {
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return ApplySimpleBlock(type_, 1);
-
handle_.Set(CreatePowerRequest(RequestType(), description_));
}
void PowerSaveBlocker::Delegate::RemoveBlock() {
DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return ApplySimpleBlock(type_, -1);
-
DeletePowerRequest(RequestType(), handle_.Take());
}
@@ -134,7 +102,7 @@
if (type_ == kPowerSaveBlockPreventDisplaySleep)
return PowerRequestDisplayRequired;
- if (base::win::GetVersion() < base::win::VERSION_WIN8)
+ if (base::win::GetVersion() == base::win::VERSION_WIN7)
return PowerRequestSystemRequired;
return PowerRequestExecutionRequired;
diff --git a/device/sensors/data_fetcher_shared_memory_win.cc b/device/sensors/data_fetcher_shared_memory_win.cc
index 4ec59fa..e7345c2 100644
--- a/device/sensors/data_fetcher_shared_memory_win.cc
+++ b/device/sensors/data_fetcher_shared_memory_win.cc
@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/win/iunknown_impl.h"
-#include "base/win/windows_version.h"
namespace {
@@ -313,9 +312,6 @@
REFSENSOR_TYPE_ID sensor_type,
ISensor** sensor,
scoped_refptr<SensorEventSink> event_sink) {
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return false;
-
base::win::ScopedComPtr<ISensorManager> sensor_manager;
HRESULT hr = ::CoCreateInstance(CLSID_SensorManager, nullptr, CLSCTX_ALL,
IID_PPV_ARGS(&sensor_manager));
diff --git a/media/capture/video/win/video_capture_device_factory_win.cc b/media/capture/video/win/video_capture_device_factory_win.cc
index 9b071270..c044c52 100644
--- a/media/capture/video/win/video_capture_device_factory_win.cc
+++ b/media/capture/video/win/video_capture_device_factory_win.cc
@@ -17,7 +17,6 @@
#include "base/strings/sys_string_conversions.h"
#include "base/win/scoped_co_mem.h"
#include "base/win/scoped_variant.h"
-#include "base/win/windows_version.h"
#include "media/base/media_switches.h"
#include "media/base/win/mf_initializer.h"
#include "media/capture/video/win/video_capture_device_mf_win.h"
@@ -402,19 +401,12 @@
// distributions such as Windows 7 N and Windows 7 KN.
// static
bool VideoCaptureDeviceFactoryWin::PlatformSupportsMediaFoundation() {
- // Even though the DLLs might be available on Vista, we get crashes
- // when running our tests on the build bots.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return false;
-
static bool g_dlls_available = LoadMediaFoundationDlls();
return g_dlls_available;
}
VideoCaptureDeviceFactoryWin::VideoCaptureDeviceFactoryWin()
- : use_media_foundation_(base::win::GetVersion() >=
- base::win::VERSION_WIN7 &&
- base::CommandLine::ForCurrentProcess()->HasSwitch(
+ : use_media_foundation_(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kForceMediaFoundationVideoCapture)) {}
std::unique_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryWin::CreateDevice(
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc
index 5b863cc..c1f525db 100644
--- a/media/gpu/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -1254,7 +1254,7 @@
::LoadLibrary(mfdll);
::LoadLibrary(L"dxva2.dll");
- if (base::win::GetVersion() > base::win::VERSION_WIN7) {
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
LoadLibrary(L"msvproc.dll");
} else {
#if defined(ENABLE_DX11_FOR_WIN7)
diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc
index 6b809fd..e926ad640f 100644
--- a/media/gpu/gpu_video_decode_accelerator_factory.cc
+++ b/media/gpu/gpu_video_decode_accelerator_factory.cc
@@ -182,12 +182,10 @@
const gpu::GpuDriverBugWorkarounds& workarounds,
const gpu::GpuPreferences& gpu_preferences) const {
std::unique_ptr<VideoDecodeAccelerator> decoder;
- if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
- DVLOG(0) << "Initializing DXVA HW decoder for windows.";
- decoder.reset(new DXVAVideoDecodeAccelerator(
- get_gl_context_cb_, make_context_current_cb_, bind_image_cb_,
- workarounds, gpu_preferences));
- }
+ DVLOG(0) << "Initializing DXVA HW decoder for windows.";
+ decoder.reset(new DXVAVideoDecodeAccelerator(
+ get_gl_context_cb_, make_context_current_cb_, bind_image_cb_,
+ workarounds, gpu_preferences));
return decoder;
}
#endif
diff --git a/remoting/base/auto_thread_unittest.cc b/remoting/base/auto_thread_unittest.cc
index a825753..224b505 100644
--- a/remoting/base/auto_thread_unittest.cc
+++ b/remoting/base/auto_thread_unittest.cc
@@ -15,7 +15,6 @@
#if defined(OS_WIN)
#include <objbase.h>
-#include "base/win/windows_version.h"
#endif
namespace {
@@ -37,12 +36,6 @@
typedef HRESULT (WINAPI * CoGetApartmentTypeFunc)
(APTTYPE*, APTTYPEQUALIFIER*);
- // CoGetApartmentType requires Windows 7 or above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7) {
- *hresult = E_NOTIMPL;
- return;
- }
-
// Dynamic link to the API so the same test binary can run on older systems.
base::ScopedNativeLibrary com_library(base::FilePath(L"ole32.dll"));
ASSERT_TRUE(com_library.is_valid());
@@ -165,13 +158,8 @@
task_runner = NULL;
RunMessageLoop();
- // CoGetApartmentType requires Windows 7 or above.
- if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
- EXPECT_EQ(S_OK, hresult);
- EXPECT_EQ(APTTYPE_MTA, apt_type);
- } else {
- EXPECT_EQ(E_NOTIMPL, hresult);
- }
+ EXPECT_EQ(S_OK, hresult);
+ EXPECT_EQ(APTTYPE_MTA, apt_type);
}
TEST_F(AutoThreadTest, ThreadWithComSta) {
@@ -191,15 +179,10 @@
task_runner = NULL;
RunMessageLoop();
- // CoGetApartmentType requires Windows 7 or above.
- if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
- EXPECT_EQ(S_OK, hresult);
- // Whether the thread is the "main" STA apartment depends upon previous
- // COM activity in this test process, so allow both types here.
- EXPECT_TRUE(apt_type == APTTYPE_MAINSTA || apt_type == APTTYPE_STA);
- } else {
- EXPECT_EQ(E_NOTIMPL, hresult);
- }
+ EXPECT_EQ(S_OK, hresult);
+ // Whether the thread is the "main" STA apartment depends upon previous
+ // COM activity in this test process, so allow both types here.
+ EXPECT_TRUE(apt_type == APTTYPE_MAINSTA || apt_type == APTTYPE_STA);
}
#endif // defined(OS_WIN)
diff --git a/rlz/test/rlz_test_helpers.cc b/rlz/test/rlz_test_helpers.cc
index 2d4b6dd..c8d5000a 100644
--- a/rlz/test/rlz_test_helpers.cc
+++ b/rlz/test/rlz_test_helpers.cc
@@ -20,7 +20,6 @@
#if defined(OS_WIN)
#include <shlwapi.h>
#include "base/win/registry.h"
-#include "base/win/windows_version.h"
#elif defined(OS_POSIX)
#include "base/files/file_path.h"
#include "rlz/lib/rlz_value_store.h"
@@ -100,31 +99,26 @@
void InitializeRegistryOverridesForTesting(
registry_util::RegistryOverrideManager* override_manager) {
// For the moment, the HKCU hive requires no initialization.
- const bool do_copy = (base::win::GetVersion() >= base::win::VERSION_WIN7);
RegistryKeyData data;
- if (do_copy) {
- // Copy the following HKLM subtrees to the temporary location so that the
- // win32 APIs used by the tests continue to work:
- //
- // HKLM\System\CurrentControlSet\Control\Lsa\AccessProviders
- //
- // This seems to be required since Win7.
- ReadRegistryTree(base::win::RegKey(HKEY_LOCAL_MACHINE,
- kHKLMAccessProviders,
- KEY_READ), &data);
- }
+ // Copy the following HKLM subtrees to the temporary location so that the
+ // win32 APIs used by the tests continue to work:
+ //
+ // HKLM\System\CurrentControlSet\Control\Lsa\AccessProviders
+ //
+ // This seems to be required since Win7.
+ ReadRegistryTree(base::win::RegKey(HKEY_LOCAL_MACHINE,
+ kHKLMAccessProviders,
+ KEY_READ), &data);
ASSERT_NO_FATAL_FAILURE(
override_manager->OverrideRegistry(HKEY_LOCAL_MACHINE));
ASSERT_NO_FATAL_FAILURE(
override_manager->OverrideRegistry(HKEY_CURRENT_USER));
- if (do_copy) {
- base::win::RegKey key(
- HKEY_LOCAL_MACHINE, kHKLMAccessProviders, KEY_ALL_ACCESS);
- WriteRegistryTree(data, &key);
- }
+ base::win::RegKey key(
+ HKEY_LOCAL_MACHINE, kHKLMAccessProviders, KEY_ALL_ACCESS);
+ WriteRegistryTree(data, &key);
}
} // namespace
diff --git a/sandbox/win/src/process_mitigations_test.cc b/sandbox/win/src/process_mitigations_test.cc
index 53b0442..1e6b3420 100644
--- a/sandbox/win/src/process_mitigations_test.cc
+++ b/sandbox/win/src/process_mitigations_test.cc
@@ -948,7 +948,7 @@
#if !defined(_WIN64) // DEP is always enabled on 64-bit.
TEST(ProcessMitigationsTest, CheckDep) {
- if (base::win::GetVersion() > base::win::VERSION_WIN7)
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8)
return;
TestRunner runner;
diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc
index 0cace9b..dd8459e 100644
--- a/ui/base/win/shell.cc
+++ b/ui/base/win/shell.cc
@@ -19,7 +19,6 @@
#include "base/threading/thread_restrictions.h"
#include "base/win/scoped_comptr.h"
#include "base/win/win_util.h"
-#include "base/win/windows_version.h"
#include "ui/base/ui_base_switches.h"
namespace ui {
@@ -99,10 +98,6 @@
bool PreventWindowFromPinning(HWND hwnd) {
DCHECK(hwnd);
- // This functionality is only available on Win7+.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return false;
-
base::win::ScopedComPtr<IPropertyStore> pps;
if (FAILED(
SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(pps.GetAddressOf()))))
@@ -122,10 +117,6 @@
HWND hwnd) {
DCHECK(hwnd);
- // This functionality is only available on Win7+.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::win::ScopedComPtr<IPropertyStore> pps;
if (FAILED(
SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(pps.GetAddressOf()))))
@@ -176,10 +167,6 @@
void ClearWindowPropertyStore(HWND hwnd) {
DCHECK(hwnd);
- // This functionality is only available on Win7+.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
base::win::ScopedComPtr<IPropertyStore> pps;
if (FAILED(
SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(pps.GetAddressOf()))))
@@ -208,10 +195,6 @@
switches::kDisableDwmComposition))
return false;
- // Technically Aero glass works in Vista but we want to put XP and Vista
- // at the same feature level. See bug 426573.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return false;
// If composition is not enabled, we behave like on XP.
BOOL enabled = FALSE;
return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled;
diff --git a/ui/events/blink/web_input_event_builders_win_unittest.cc b/ui/events/blink/web_input_event_builders_win_unittest.cc
index f0a69e6..61837d0 100644
--- a/ui/events/blink/web_input_event_builders_win_unittest.cc
+++ b/ui/events/blink/web_input_event_builders_win_unittest.cc
@@ -20,9 +20,6 @@
// This test validates that Pixel to DIP conversion occurs as needed in the
// WebMouseEventBuilder::Build function.
TEST(WebInputEventBuilderTest, TestMouseEventScale) {
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
display::Display::ResetForceDeviceScaleFactorForTesting();
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
diff --git a/ui/gl/vsync_provider_win.cc b/ui/gl/vsync_provider_win.cc
index 7a400e2..8025ca9 100644
--- a/ui/gl/vsync_provider_win.cc
+++ b/ui/gl/vsync_provider_win.cc
@@ -8,15 +8,10 @@
#include "base/logging.h"
#include "base/trace_event/trace_event.h"
-#include "base/win/windows_version.h"
#include "ui/gfx/native_widget_types.h"
namespace gl {
-namespace {
-bool g_use_dwm_vsync;
-} // namespace
-
VSyncProviderWin::VSyncProviderWin(gfx::AcceleratedWidget window)
: window_(window) {
}
@@ -29,12 +24,9 @@
if (initialized)
return;
initialized = true;
- g_use_dwm_vsync = (base::win::GetVersion() >= base::win::VERSION_WIN7);
- if (g_use_dwm_vsync) {
- // Prewarm sandbox
- ::LoadLibrary(L"dwmapi.dll");
- }
+ // Prewarm sandbox
+ ::LoadLibrary(L"dwmapi.dll");
}
void VSyncProviderWin::GetVSyncParameters(const UpdateVSyncCallback& callback) {
@@ -42,61 +34,54 @@
base::TimeTicks timebase;
base::TimeDelta interval;
- bool dwm_active = false;
// Query the DWM timing info first if available. This will provide the most
// precise values.
- if (g_use_dwm_vsync) {
- DWM_TIMING_INFO timing_info;
- timing_info.cbSize = sizeof(timing_info);
- HRESULT result = DwmGetCompositionTimingInfo(NULL, &timing_info);
- if (result == S_OK) {
- dwm_active = true;
+ DWM_TIMING_INFO timing_info;
+ timing_info.cbSize = sizeof(timing_info);
+ HRESULT result = DwmGetCompositionTimingInfo(NULL, &timing_info);
+ if (result == S_OK) {
+ // Calculate an interval value using the rateRefresh numerator and
+ // denominator.
+ base::TimeDelta rate_interval;
+ if (timing_info.rateRefresh.uiDenominator > 0 &&
+ timing_info.rateRefresh.uiNumerator > 0) {
+ // Swap the numerator/denominator to convert frequency to period.
+ rate_interval = base::TimeDelta::FromMicroseconds(
+ timing_info.rateRefresh.uiDenominator *
+ base::Time::kMicrosecondsPerSecond /
+ timing_info.rateRefresh.uiNumerator);
+ }
- // Calculate an interval value using the rateRefresh numerator and
- // denominator.
- base::TimeDelta rate_interval;
- if (timing_info.rateRefresh.uiDenominator > 0 &&
- timing_info.rateRefresh.uiNumerator > 0) {
- // Swap the numerator/denominator to convert frequency to period.
- rate_interval = base::TimeDelta::FromMicroseconds(
- timing_info.rateRefresh.uiDenominator *
- base::Time::kMicrosecondsPerSecond /
- timing_info.rateRefresh.uiNumerator);
- }
-
- if (base::TimeTicks::IsHighResolution()) {
- // qpcRefreshPeriod is very accurate but noisy, and must be used with
- // a high resolution timebase to avoid frequently missing Vsync.
- timebase = base::TimeTicks::FromQPCValue(
- static_cast<LONGLONG>(timing_info.qpcVBlank));
- interval = base::TimeDelta::FromQPCValue(
- static_cast<LONGLONG>(timing_info.qpcRefreshPeriod));
- // Check for interval values that are impossibly low. A 29 microsecond
- // interval was seen (from a qpcRefreshPeriod of 60).
- if (interval < base::TimeDelta::FromMilliseconds(1)) {
- interval = rate_interval;
- }
- // Check for the qpcRefreshPeriod interval being improbably small
- // compared to the rateRefresh calculated interval, as another
- // attempt at detecting driver bugs.
- if (!rate_interval.is_zero() && interval < rate_interval / 2) {
- interval = rate_interval;
- }
- } else {
- // If FrameTime is not high resolution, we do not want to translate
- // the QPC value provided by DWM into the low-resolution timebase,
- // which would be error prone and jittery. As a fallback, we assume
- // the timebase is zero and use rateRefresh, which may be rounded but
- // isn't noisy like qpcRefreshPeriod, instead. The fact that we don't
- // have a timebase here may lead to brief periods of jank when our
- // scheduling becomes offset from the hardware vsync.
+ if (base::TimeTicks::IsHighResolution()) {
+ // qpcRefreshPeriod is very accurate but noisy, and must be used with
+ // a high resolution timebase to avoid frequently missing Vsync.
+ timebase = base::TimeTicks::FromQPCValue(
+ static_cast<LONGLONG>(timing_info.qpcVBlank));
+ interval = base::TimeDelta::FromQPCValue(
+ static_cast<LONGLONG>(timing_info.qpcRefreshPeriod));
+ // Check for interval values that are impossibly low. A 29 microsecond
+ // interval was seen (from a qpcRefreshPeriod of 60).
+ if (interval < base::TimeDelta::FromMilliseconds(1)) {
interval = rate_interval;
}
+ // Check for the qpcRefreshPeriod interval being improbably small
+ // compared to the rateRefresh calculated interval, as another
+ // attempt at detecting driver bugs.
+ if (!rate_interval.is_zero() && interval < rate_interval / 2) {
+ interval = rate_interval;
+ }
+ } else {
+ // If FrameTime is not high resolution, we do not want to translate
+ // the QPC value provided by DWM into the low-resolution timebase,
+ // which would be error prone and jittery. As a fallback, we assume
+ // the timebase is zero and use rateRefresh, which may be rounded but
+ // isn't noisy like qpcRefreshPeriod, instead. The fact that we don't
+ // have a timebase here may lead to brief periods of jank when our
+ // scheduling becomes offset from the hardware vsync.
+ interval = rate_interval;
}
- }
-
- if (!dwm_active) {
+ } else {
// When DWM compositing is active all displays are normalized to the
// refresh rate of the primary display, and won't composite any faster.
// If DWM compositing is disabled, though, we can use the refresh rates
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 3c67457..4f9ad05 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -1658,8 +1658,8 @@
LRESULT HWNDMessageHandler::OnPointerEvent(UINT message,
WPARAM w_param,
LPARAM l_param) {
- // WM_POINTER is not supported on Windows 7 or lower.
- if (base::win::GetVersion() <= base::win::VERSION_WIN7) {
+ // WM_POINTER is not supported on Windows 7.
+ if (base::win::GetVersion() == base::win::VERSION_WIN7) {
SetMsgHandled(FALSE);
return -1;
}