browser_postlogin_params.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2022 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 CHROMEOS_STARTUP_BROWSER_POSTLOGIN_PARAMS_H_
  5. #define CHROMEOS_STARTUP_BROWSER_POSTLOGIN_PARAMS_H_
  6. #include "base/no_destructor.h"
  7. #include "chromeos/crosapi/mojom/crosapi.mojom.h"
  8. namespace chromeos {
  9. // Stores and handles BrowserPostLoginParams.
  10. // This class is not to be used directly - use BrowserParamsProxy instead.
  11. class COMPONENT_EXPORT(CHROMEOS_STARTUP) BrowserPostLoginParams {
  12. public:
  13. BrowserPostLoginParams(const BrowserPostLoginParams&) = delete;
  14. BrowserPostLoginParams& operator=(const BrowserPostLoginParams&) = delete;
  15. // Sets `postlogin_params_` to the provided value.
  16. // Useful for tests that cannot setup a full Lacros test environment with a
  17. // working Mojo connection to Ash.
  18. static void SetPostLoginParamsForTests(
  19. crosapi::mojom::BrowserPostLoginParamsPtr postlogin_params);
  20. private:
  21. friend base::NoDestructor<BrowserPostLoginParams>;
  22. // Returns BrowserPostLoginParams which is passed from ash-chrome. On
  23. // launching lacros-chrome from ash-chrome, ash-chrome creates an anonymous
  24. // pipe and the forked/executed lacros-chrome process inherits the file
  25. // descriptor. The serialized BrowserPostLoginParams is written in the pipe
  26. // after login.
  27. // NOTE: You should use BrowserProxyParams to access parameters instead.
  28. static const crosapi::mojom::BrowserPostLoginParams* Get();
  29. static BrowserPostLoginParams* GetInstance();
  30. BrowserPostLoginParams();
  31. ~BrowserPostLoginParams();
  32. // Parameters passed from ash-chrome.
  33. crosapi::mojom::BrowserPostLoginParamsPtr postlogin_params_;
  34. };
  35. } // namespace chromeos
  36. #endif // CHROMEOS_STARTUP_BROWSER_POSTLOGIN_PARAMS_H_