ensure_user.h 1.0 KB

123456789101112131415161718192021222324
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_HOST_FILE_TRANSFER_ENSURE_USER_H_
  5. #define REMOTING_HOST_FILE_TRANSFER_ENSURE_USER_H_
  6. #include "remoting/protocol/file_transfer_helpers.h"
  7. namespace remoting {
  8. // Ensures that the given thread is running as a normal user. On macOS and
  9. // Windows, this ensures a user is logged in. On Windows (where the host runs as
  10. // SYSTEM), it will additionally call ImpersonateLoggedOnUser to drop privileges
  11. // on the current thread. As such, it should only be called on a dedicated
  12. // thread. If success is returned, the thread is running as a normal user. If
  13. // user is on the log-in screen, an error of type NOT_LOGGED_IN will be
  14. // returned. If something else goes wrong, the error type will be
  15. // UNEXPECTED_ERROR.
  16. protocol::FileTransferResult<absl::monostate> EnsureUserContext();
  17. } // namespace remoting
  18. #endif // REMOTING_HOST_FILE_TRANSFER_ENSURE_USER_H_