// Copyright 2024 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef REMOTING_HOST_SETUP_HOST_STARTER_BASE_H_ #define REMOTING_HOST_SETUP_HOST_STARTER_BASE_H_ #include <memory> #include <optional> #include <string> #include <utility> #include "base/functional/callback.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "base/values.h" #include "remoting/base/protobuf_http_status.h" #include "remoting/host/setup/daemon_controller.h" #include "remoting/host/setup/host_starter.h" #include "remoting/host/setup/host_starter_oauth_helper.h" #include "services/network/public/cpp/shared_url_loader_factory.h" namespace network { class SharedURLLoaderFactory; } namespace remoting { class HostStarterOAuthHelper; class RsaKeyPair; // Base class used to provide common functionality needed when registering a // new remote access host instance in the CRD backend. Subclasses should // override the methods which handle the steps which differ however the flow // is generally the same for all workflows. // // Overview of the steps in the registration flow once StartHost() is called: // 1.) Check for an existing host instance // 2.) <optional> Exchange authorization_code for an access token // 3.) Register the new host instance in the CRD backend // 4.) Exchange the service account authorization_code for a refresh token // 5.) Remove the existing host from the CRD backend // 6.) Stop the existing host (if one is running) // 7.) Write the host configuration file to disk // 8.) Start the host service using the new configuration file // class HostStarterBase : public HostStarter { … }; } // namespace remoting #endif // REMOTING_HOST_SETUP_HOST_STARTER_BASE_H_