Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2017 The Chromium Authors |
ducbui | 1b859735 | 2017-06-27 17:06:38 | [diff] [blame] | 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 | |
Nancy Wang | c76e0a5 | 2021-09-13 19:47:32 | [diff] [blame] | 8 | class Profile; |
| 9 | |
Duc Bui | bf1f569 | 2017-07-19 14:42:07 | [diff] [blame] | 10 | // Observer of events during session restore. This observer does not cover |
| 11 | // SessionRestoreImpl::RestoreForeignTab() which restores a single foreign tab. |
ducbui | 1b859735 | 2017-06-27 17:06:38 | [diff] [blame] | 12 | class SessionRestoreObserver { |
| 13 | public: |
Duc Bui | bf1f569 | 2017-07-19 14:42:07 | [diff] [blame] | 14 | // 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. |
ducbui | 1b859735 | 2017-06-27 17:06:38 | [diff] [blame] | 20 | virtual void OnSessionRestoreStartedLoadingTabs() {} |
| 21 | |
Duc Bui | bf1f569 | 2017-07-19 14:42:07 | [diff] [blame] | 22 | // 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. |
ducbui | 1b859735 | 2017-06-27 17:06:38 | [diff] [blame] | 26 | virtual void OnSessionRestoreFinishedLoadingTabs() {} |
Duc Bui | 16a6e80 | 2017-08-02 16:22:53 | [diff] [blame] | 27 | |
Nancy Wang | c76e0a5 | 2021-09-13 19:47:32 | [diff] [blame] | 28 | // 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) {} |
ducbui | 1b859735 | 2017-06-27 17:06:38 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_OBSERVER_H_ |