blob: cf2d01c6012909f6be2bea16abf00ab5052146db [file] [log] [blame]
ducbui1b8597352017-06-27 17:06:381// Copyright 2017 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
5#ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_OBSERVER_H_
6#define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_OBSERVER_H_
7
Duc Bui16a6e802017-08-02 16:22:538namespace content {
9class WebContents;
10}
11
Nancy Wangc76e0a52021-09-13 19:47:3212class Profile;
13
Duc Buibf1f5692017-07-19 14:42:0714// Observer of events during session restore. This observer does not cover
15// SessionRestoreImpl::RestoreForeignTab() which restores a single foreign tab.
ducbui1b8597352017-06-27 17:06:3816class SessionRestoreObserver {
17 public:
Duc Buibf1f5692017-07-19 14:42:0718 // OnSessionRestoreStartedLoadingTabs() is called from session restore
19 // prior to creating the first tab from session restore. Session restore may
20 // do processing before this, and if no tabs are created (there was no
21 // previous session, or perhaps the data was corrupt) this is not called.
22 // OnSessionRestoreStartedLoadingTabs() is *not* called if another session
23 // restore is triggered while waiting for a load to complete.
ducbui1b8597352017-06-27 17:06:3824 virtual void OnSessionRestoreStartedLoadingTabs() {}
25
Duc Buibf1f5692017-07-19 14:42:0726 // OnSessionRestoreFinishedLoadingTabs() is called once all the tabs created
27 // by session restore have completed loading (or loading is canceled because
28 // of memory pressure). This is called on the last session restore when
29 // multiple concurrent session restores (on all profiles) occur.
ducbui1b8597352017-06-27 17:06:3830 virtual void OnSessionRestoreFinishedLoadingTabs() {}
Duc Bui16a6e802017-08-02 16:22:5331
32 // OnWillRestoreTab() is called right after a tab is created by session
33 // restore.
34 virtual void OnWillRestoreTab(content::WebContents* web_contents) {}
Nancy Wangc76e0a52021-09-13 19:47:3235
36 // OnGotSession() is called right after windows are read from the last session
37 // restore file. If windows are read by AppSessionService for app windows,
38 // `for_app` is true. Otherwise, `for_app` is false. This function is used
39 // for debug only.
40 virtual void OnGotSession(Profile* profile, bool for_app, int window_count) {}
ducbui1b8597352017-06-27 17:06:3841};
42
43#endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_OBSERVER_H_