chromium/remoting/host/webauthn/remote_webauthn_extension_notifier.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "remoting/host/webauthn/remote_webauthn_extension_notifier.h"

#include <vector>

#include "base/base_paths.h"
#include "base/containers/span.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/path_service.h"
#include "base/sequence_checker.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"

#if BUILDFLAG(IS_LINUX)
#include "base/environment.h"
#include "base/nix/xdg_util.h"
#include "base/strings/string_util.h"
#elif BUILDFLAG(IS_WIN)
#include <windows.h>

#include <knownfolders.h>
#include <shlobj.h>
#include <wtsapi32.h>

#include "base/win/scoped_co_mem.h"
#include "base/win/scoped_handle.h"
#endif

namespace remoting {
namespace {

// Content of file doesn't matter so we just write an empty string.
static constexpr char kExtensionWakeupFileContent[] =;

// Returns a list of directories that different Chrome channels might use to
// watch for file changes for firing the onRemoteSessionStateChange event on the
// extension.
//
// The remote state change directory is located at:
//
//   REMOTE_STATE_CHANGE_DIRECTORY =
//     $DEFAULT_UDD/WebAuthenticationProxyRemoteSessionStateChange
//
// And the file for firing the event on the extension is located at:
//
//   $REMOTE_STATE_CHANGE_DIRECTORY/$EXTENSION_ID
//
// DEFAULT_UDD (default user data directory) is documented here:
//
//   https://chromium.googlesource.com/chromium/src/+/main/docs/user_data_dir.md#default-location
//
// Note that the default UDD is always used, and UDD overrides from browser
// launch args or env vars are ignored so the path is more discoverable by the
// native process.
//
// Caller should check if the directory exists before writing files to it. A
// directory only exists if the corresponding Chrome version is installed.
std::vector<base::FilePath> GetRemoteStateChangeDirPaths() {}

}  // namespace

// Core class for writing wakeup files on the IO sequence. Must be used and
// deleted on the same sequence.
class RemoteWebAuthnExtensionNotifier::Core final {};

RemoteWebAuthnExtensionNotifier::Core::Core(
    std::vector<base::FilePath> remote_state_change_dirs)
    :{}

RemoteWebAuthnExtensionNotifier::Core::~Core() {}

void RemoteWebAuthnExtensionNotifier::Core::WakeUpExtension() {}

// static
const std::vector<base::FilePath::StringType>&
RemoteWebAuthnExtensionNotifier::GetRemoteWebAuthnExtensionIds() {}

RemoteWebAuthnExtensionNotifier::RemoteWebAuthnExtensionNotifier()
    :{}

RemoteWebAuthnExtensionNotifier::RemoteWebAuthnExtensionNotifier(
    std::vector<base::FilePath> remote_state_change_dirs,
    scoped_refptr<base::SequencedTaskRunner> io_task_runner) {}

RemoteWebAuthnExtensionNotifier::~RemoteWebAuthnExtensionNotifier() {}

void RemoteWebAuthnExtensionNotifier::NotifyStateChange() {}

void RemoteWebAuthnExtensionNotifier::WakeUpExtension() {}

}  // namespace remoting