account_manager.mm 908 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #import "remoting/ios/app/account_manager.h"
  5. #include "base/check.h"
  6. #if !defined(__has_feature) || !__has_feature(objc_arc)
  7. #error "This file requires ARC support."
  8. #endif
  9. namespace remoting {
  10. namespace ios {
  11. namespace {
  12. // Leaky.
  13. static AccountManager* g_account_manager = nullptr;
  14. } // namespace
  15. AccountManager::AccountManager() = default;
  16. AccountManager::~AccountManager() = default;
  17. // static
  18. void AccountManager::SetInstance(
  19. std::unique_ptr<AccountManager> account_manager) {
  20. DCHECK(!g_account_manager);
  21. g_account_manager = account_manager.release();
  22. }
  23. // static
  24. AccountManager* AccountManager::GetInstance() {
  25. DCHECK(g_account_manager);
  26. return g_account_manager;
  27. }
  28. } // namespace ios
  29. } // namespace remoting