account_manager.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2020 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_IOS_APP_ACCOUNT_MANAGER_H_
  5. #define REMOTING_IOS_APP_ACCOUNT_MANAGER_H_
  6. #include <memory>
  7. #import <UIKit/UIKit.h>
  8. namespace remoting {
  9. namespace ios {
  10. // An interface that provides UI components to manage the user's account. The
  11. // implementation may come from some internal libraries.
  12. //
  13. // This interface does not deal with callbacks of user sign-in, sign-out, or
  14. // account switching. For these events you can listen to the kUserDidUpdate
  15. // event defined in remoting_service.h.
  16. class AccountManager {
  17. public:
  18. AccountManager();
  19. virtual ~AccountManager();
  20. // Sets the AccountManager singleton. Can only be called once.
  21. static void SetInstance(std::unique_ptr<AccountManager> account_manager);
  22. // Gets the AccountManager instance.
  23. static AccountManager* GetInstance();
  24. // Creates a view controller that renders an account particle disc, a little
  25. // circular button that shows the user's avatar image and pops up the account
  26. // management menu.
  27. virtual UIViewController* CreateAccountParticleDiscViewController() = 0;
  28. // Presents a menu that allows the user to choose an account to sign in or add
  29. // a new account. This is usually used when the app is first launched or the
  30. // user has previously signed out.
  31. virtual void PresentSignInMenu() = 0;
  32. };
  33. } // namespace ios
  34. } // namespace remoting
  35. #endif // REMOTING_IOS_APP_ACCOUNT_MANAGER_H_