ftl_services_context.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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_SIGNALING_FTL_SERVICES_CONTEXT_H_
  5. #define REMOTING_SIGNALING_FTL_SERVICES_CONTEXT_H_
  6. #include <string>
  7. #include "base/time/time.h"
  8. #include "net/base/backoff_entry.h"
  9. #include "remoting/proto/ftl/v1/ftl_messages.pb.h"
  10. namespace remoting {
  11. // This is the class for creating context objects to be used when connecting
  12. // to FTL backend.
  13. class FtlServicesContext final {
  14. public:
  15. // Exposed for testing.
  16. static constexpr base::TimeDelta kBackoffInitialDelay = base::Seconds(1);
  17. static constexpr base::TimeDelta kBackoffMaxDelay = base::Minutes(1);
  18. static const net::BackoffEntry::Policy& GetBackoffPolicy();
  19. static std::string GetServerEndpoint();
  20. static std::string GetChromotingAppIdentifier();
  21. static ftl::Id CreateIdFromString(const std::string& ftl_id);
  22. static ftl::RequestHeader CreateRequestHeader(
  23. const std::string& ftl_auth_token = {});
  24. FtlServicesContext() = delete;
  25. FtlServicesContext(const FtlServicesContext&) = delete;
  26. FtlServicesContext& operator=(const FtlServicesContext&) = delete;
  27. };
  28. } // namespace remoting
  29. #endif // REMOTING_SIGNALING_FTL_SERVICES_CONTEXT_H_