win7dep: Remove Win7/8 code from remoting/*

Chrome no longer supports Win7/8.

Also fixes some lint warnings.

Bug: 1385856
Change-Id: Ie2c71aa95bd72a7fe9e2969e562e8544262fcf5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4149608
Commit-Queue: David Bienvenu <[email protected]>
Reviewed-by: Joe Downing <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1090863}
diff --git a/remoting/host/desktop_session_win.cc b/remoting/host/desktop_session_win.cc
index b47f2a0..b11be27 100644
--- a/remoting/host/desktop_session_win.cc
+++ b/remoting/host/desktop_session_win.cc
@@ -10,6 +10,7 @@
 
 #include <limits>
 #include <memory>
+#include <string>
 #include <utility>
 
 #include "base/base_switches.h"
@@ -27,7 +28,6 @@
 #include "base/win/registry.h"
 #include "base/win/scoped_bstr.h"
 #include "base/win/scoped_handle.h"
-#include "base/win/windows_version.h"
 #include "remoting/base/auto_thread_task_runner.h"
 #include "remoting/host/base/screen_resolution.h"
 #include "remoting/host/base/switches.h"
@@ -73,29 +73,9 @@
 const int kMinRdpScreenWidth = 800;
 const int kMinRdpScreenHeight = 600;
 
-// Win7 SP1 (and Vista) supports dimensions up to 4096x2048.
-const int kMaxRdpScreenWidthForWin7 = 4096;
-const int kMaxRdpScreenHeightForWin7 = 2048;
-
-// Win8+ supports dimensions up to 8192x8192.
-const int kMaxRdpScreenWidthForWin8AndLater = 8192;
-const int kMaxRdpScreenHeightForWin8AndLater = 8192;
-
-int GetMaxRdpScreenWidth() {
-  static int max_rdp_screen_width =
-      base::win::GetVersion() >= base::win::Version::WIN8
-          ? kMaxRdpScreenWidthForWin8AndLater
-          : kMaxRdpScreenWidthForWin7;
-  return max_rdp_screen_width;
-}
-
-int GetMaxRdpScreenHeight() {
-  static int max_rdp_screen_height =
-      base::win::GetVersion() >= base::win::Version::WIN8
-          ? kMaxRdpScreenHeightForWin8AndLater
-          : kMaxRdpScreenHeightForWin7;
-  return max_rdp_screen_height;
-}
+// Windows supports dimensions up to 8192x8192.
+const int kMaxRdpScreenWidth = 8192;
+const int kMaxRdpScreenHeight = 8192;
 
 // Default dots per inch used by RDP is 96 DPI.
 const int kDefaultRdpDpi = 96;
@@ -123,8 +103,8 @@
 
 webrtc::DesktopSize GetBoundedRdpDesktopSize(int width, int height) {
   return webrtc::DesktopSize(
-      base::clamp(width, kMinRdpScreenWidth, GetMaxRdpScreenWidth()),
-      base::clamp(height, kMinRdpScreenHeight, GetMaxRdpScreenHeight()));
+      base::clamp(width, kMinRdpScreenWidth, kMaxRdpScreenWidth),
+      base::clamp(height, kMinRdpScreenHeight, kMaxRdpScreenHeight));
 }
 
 // DesktopSession implementation which attaches to the host's physical console.
@@ -497,7 +477,7 @@
   return S_OK;
 }
 
-} // namespace
+}  // namespace
 
 // static
 std::unique_ptr<DesktopSession> DesktopSessionWin::CreateForConsole(
@@ -642,17 +622,12 @@
 
   ReportElapsedTime("attached");
 
-  // Launch elevated on Win8+ to enable injection of Alt+Tab and Ctrl+Alt+Del.
-  bool launch_elevated = base::win::GetVersion() >= base::win::Version::WIN8;
-
-  // Get the name of the executable to run. |kDesktopBinaryName| specifies
-  // uiAccess="true" in its manifest.  Prefer kDesktopBinaryName for Win8+ but
-  // fall back to kHostBinaryName if there is a problem loading it.
+  // Get the name of the executable to run. `kDesktopBinaryName` specifies
+  // uiAccess="true" in its manifest.  Prefer kDesktopBinaryName but fall back
+  // to kHostBinaryName if there is a problem loading it.
   base::FilePath desktop_binary;
-  bool result = false;
-  if (launch_elevated) {
-    result = GetInstalledBinaryPath(kDesktopBinaryName, &desktop_binary);
-  }
+  bool result = GetInstalledBinaryPath(kDesktopBinaryName, &desktop_binary);
+
   if (!result || !IsBinaryTrusted(desktop_binary)) {
     result = GetInstalledBinaryPath(kHostBinaryName, &desktop_binary);
   }
@@ -672,9 +647,10 @@
                            kCopiedSwitchNames, std::size(kCopiedSwitchNames));
 
   // Create a delegate capable of launching a process in a different session.
+  // Launch elevated to enable injection of Alt+Tab and Ctrl+Alt+Del.
   std::unique_ptr<WtsSessionProcessDelegate> delegate(
       new WtsSessionProcessDelegate(
-          io_task_runner_, std::move(target), launch_elevated,
+          io_task_runner_, std::move(target), /*launch_elevated=*/true,
           base::WideToUTF8(kDaemonIpcSecurityDescriptor)));
   if (!delegate->Initialize(session_id)) {
     TerminateSession();