blob: dc9335f504f6553f8ca3c4809470e647b7881b71 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2022 The Chromium Authors
Thomas Lukaszewicz8fe9687d2022-08-29 17:56:222// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_LACROS_BROWSER_LAUNCHER_H_
6#define CHROME_BROWSER_LACROS_BROWSER_LAUNCHER_H_
7
8#include "base/memory/raw_ptr.h"
9#include "base/supports_user_data.h"
10
11class Profile;
12
13// Responsible for creating and launching new instances of lacros-chrome.
14class BrowserLauncher : public base::SupportsUserData::Data {
15 public:
16 explicit BrowserLauncher(Profile* profile);
17 BrowserLauncher(const BrowserLauncher&) = delete;
18 BrowserLauncher& operator=(const BrowserLauncher&) = delete;
19 ~BrowserLauncher() override = default;
20
21 // Creates the BrowserLauncher instance if it does not already exist.
22 static BrowserLauncher* GetForProfile(Profile* profile);
23
24 // Launches lacros-chrome for full restore. This method should be called
25 // before any lacros browser windows have been created while the process is in
26 // the background / windowless state.
27 void LaunchForFullRestore(bool skip_crash_restore);
28
29 bool is_launching_for_full_restore() const {
30 return is_launching_for_full_restore_;
31 }
32
33 private:
34 // Tracks whether the BrowserLauncher is in the process of performing a Full
35 // Restore launch of lacros-chrome.
36 bool is_launching_for_full_restore_ = false;
37
38 const raw_ptr<Profile> profile_;
39};
40
41#endif // CHROME_BROWSER_LACROS_BROWSER_LAUNCHER_H_