| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/callback_list.h" | 13 #include "base/callback_list.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "components/history/core/browser/history_service.h" | 15 #include "components/history/core/browser/history_service.h" |
| 15 #include "components/sessions/core/session_types.h" | 16 #include "components/sessions/core/session_types.h" |
| 16 #include "ui/base/window_open_disposition.h" | 17 #include "ui/base/window_open_disposition.h" |
| 17 | 18 |
| 18 class Browser; | 19 class Browser; |
| 19 class Profile; | 20 class Profile; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // If |urls_to_open| is non-empty, a tab is added for each of the URLs. | 56 // If |urls_to_open| is non-empty, a tab is added for each of the URLs. |
| 56 static Browser* RestoreSession(Profile* profile, | 57 static Browser* RestoreSession(Profile* profile, |
| 57 Browser* browser, | 58 Browser* browser, |
| 58 uint32_t behavior, | 59 uint32_t behavior, |
| 59 const std::vector<GURL>& urls_to_open); | 60 const std::vector<GURL>& urls_to_open); |
| 60 | 61 |
| 61 // Restores the last session when the last session crashed. It's a wrapper | 62 // Restores the last session when the last session crashed. It's a wrapper |
| 62 // of function RestoreSession. | 63 // of function RestoreSession. |
| 63 static void RestoreSessionAfterCrash(Browser* browser); | 64 static void RestoreSessionAfterCrash(Browser* browser); |
| 64 | 65 |
| 66 // Opens the startup pages when the last session crashed. |
| 67 static void OpenStartupPagesAfterCrash(Browser* browser); |
| 68 |
| 65 // Specifically used in the restoration of a foreign session. This function | 69 // Specifically used in the restoration of a foreign session. This function |
| 66 // restores the given session windows to multiple browsers. Returns the | 70 // restores the given session windows to multiple browsers. Returns the |
| 67 // created Browsers. | 71 // created Browsers. |
| 68 static std::vector<Browser*> RestoreForeignSessionWindows( | 72 static std::vector<Browser*> RestoreForeignSessionWindows( |
| 69 Profile* profile, | 73 Profile* profile, |
| 70 std::vector<const sessions::SessionWindow*>::const_iterator begin, | 74 std::vector<const sessions::SessionWindow*>::const_iterator begin, |
| 71 std::vector<const sessions::SessionWindow*>::const_iterator end); | 75 std::vector<const sessions::SessionWindow*>::const_iterator end); |
| 72 | 76 |
| 73 // Specifically used in the restoration of a foreign session. This method | 77 // Specifically used in the restoration of a foreign session. This method |
| 74 // restores the given session tab to the browser of |source_web_contents| if | 78 // restores the given session tab to the browser of |source_web_contents| if |
| (...skipping 29 matching lines...) Expand all Loading... |
| 104 return on_session_restored_callbacks_; | 108 return on_session_restored_callbacks_; |
| 105 } | 109 } |
| 106 | 110 |
| 107 // Contains all registered callbacks for session restore notifications. | 111 // Contains all registered callbacks for session restore notifications. |
| 108 static CallbackList* on_session_restored_callbacks_; | 112 static CallbackList* on_session_restored_callbacks_; |
| 109 | 113 |
| 110 DISALLOW_COPY_AND_ASSIGN(SessionRestore); | 114 DISALLOW_COPY_AND_ASSIGN(SessionRestore); |
| 111 }; | 115 }; |
| 112 | 116 |
| 113 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 117 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
| OLD | NEW |