blob: 33954927ed99f4004575f79a3a6fbb14fe068472 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2017 The Chromium Authors
ducbui1b8597352017-06-27 17:06:382// 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_SESSIONS_SESSION_RESTORE_OBSERVER_H_
6#define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_OBSERVER_H_
7
Nancy Wangc76e0a52021-09-13 19:47:328class Profile;
9
Duc Buibf1f5692017-07-19 14:42:0710// Observer of events during session restore. This observer does not cover
11// SessionRestoreImpl::RestoreForeignTab() which restores a single foreign tab.
ducbui1b8597352017-06-27 17:06:3812class SessionRestoreObserver {
13 public:
Duc Buibf1f5692017-07-19 14:42:0714 // OnSessionRestoreStartedLoadingTabs() is called from session restore
15 // prior to creating the first tab from session restore. Session restore may
16 // do processing before this, and if no tabs are created (there was no
17 // previous session, or perhaps the data was corrupt) this is not called.
18 // OnSessionRestoreStartedLoadingTabs() is *not* called if another session
19 // restore is triggered while waiting for a load to complete.
ducbui1b8597352017-06-27 17:06:3820 virtual void OnSessionRestoreStartedLoadingTabs() {}
21
Duc Buibf1f5692017-07-19 14:42:0722 // OnSessionRestoreFinishedLoadingTabs() is called once all the tabs created
23 // by session restore have completed loading (or loading is canceled because
24 // of memory pressure). This is called on the last session restore when
25 // multiple concurrent session restores (on all profiles) occur.
ducbui1b8597352017-06-27 17:06:3826 virtual void OnSessionRestoreFinishedLoadingTabs() {}
Duc Bui16a6e802017-08-02 16:22:5327
Nancy Wangc76e0a52021-09-13 19:47:3228 // OnGotSession() is called right after windows are read from the last session
29 // restore file. If windows are read by AppSessionService for app windows,
30 // `for_app` is true. Otherwise, `for_app` is false. This function is used
31 // for debug only.
32 virtual void OnGotSession(Profile* profile, bool for_app, int window_count) {}
ducbui1b8597352017-06-27 17:06:3833};
34
35#endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_OBSERVER_H_