| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Restores the last session. |behavior| is a bitmask of Behaviors, see it | 56 // Restores the last session. |behavior| is a bitmask of Behaviors, see it |
| 57 // for details. If |browser| is non-null the tabs for the first window are | 57 // for details. If |browser| is non-null the tabs for the first window are |
| 58 // added to it. Returns the last active browser. | 58 // added to it. Returns the last active browser. |
| 59 // Every additional browser created will be created on the desktop specified | 59 // Every additional browser created will be created on the desktop specified |
| 60 // by |host_desktop_type|, if |browser| is non-null it should have the same | 60 // by |host_desktop_type|, if |browser| is non-null it should have the same |
| 61 // desktop type. | 61 // desktop type. |
| 62 // | 62 // |
| 63 // If |urls_to_open| is non-empty, a tab is added for each of the URLs. | 63 // If |urls_to_open| is non-empty, a tab is added for each of the URLs. |
| 64 static Browser* RestoreSession(Profile* profile, | 64 static Browser* RestoreSession(Profile* profile, |
| 65 Browser* browser, | 65 Browser* browser, |
| 66 chrome::HostDesktopType host_desktop_type, | 66 ui::HostDesktopType host_desktop_type, |
| 67 uint32 behavior, | 67 uint32 behavior, |
| 68 const std::vector<GURL>& urls_to_open); | 68 const std::vector<GURL>& urls_to_open); |
| 69 | 69 |
| 70 // Restores the last session when the last session crashed. It's a wrapper | 70 // Restores the last session when the last session crashed. It's a wrapper |
| 71 // of function RestoreSession. | 71 // of function RestoreSession. |
| 72 static void RestoreSessionAfterCrash(Browser* browser); | 72 static void RestoreSessionAfterCrash(Browser* browser); |
| 73 | 73 |
| 74 // Specifically used in the restoration of a foreign session. This function | 74 // Specifically used in the restoration of a foreign session. This function |
| 75 // restores the given session windows to multiple browsers all of which | 75 // restores the given session windows to multiple browsers all of which |
| 76 // will be created on the desktop specified by |host_desktop_type|. Returns | 76 // will be created on the desktop specified by |host_desktop_type|. Returns |
| 77 // the created Browsers. | 77 // the created Browsers. |
| 78 static std::vector<Browser*> RestoreForeignSessionWindows( | 78 static std::vector<Browser*> RestoreForeignSessionWindows( |
| 79 Profile* profile, | 79 Profile* profile, |
| 80 chrome::HostDesktopType host_desktop_type, | 80 ui::HostDesktopType host_desktop_type, |
| 81 std::vector<const sessions::SessionWindow*>::const_iterator begin, | 81 std::vector<const sessions::SessionWindow*>::const_iterator begin, |
| 82 std::vector<const sessions::SessionWindow*>::const_iterator end); | 82 std::vector<const sessions::SessionWindow*>::const_iterator end); |
| 83 | 83 |
| 84 // Specifically used in the restoration of a foreign session. This method | 84 // Specifically used in the restoration of a foreign session. This method |
| 85 // restores the given session tab to the browser of |source_web_contents| if | 85 // restores the given session tab to the browser of |source_web_contents| if |
| 86 // the disposition is not NEW_WINDOW. Returns the WebContents corresponding | 86 // the disposition is not NEW_WINDOW. Returns the WebContents corresponding |
| 87 // to the restored tab. If |disposition| is CURRENT_TAB, |source_web_contents| | 87 // to the restored tab. If |disposition| is CURRENT_TAB, |source_web_contents| |
| 88 // may be destroyed. | 88 // may be destroyed. |
| 89 static content::WebContents* RestoreForeignSessionTab( | 89 static content::WebContents* RestoreForeignSessionTab( |
| 90 content::WebContents* source_web_contents, | 90 content::WebContents* source_web_contents, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 119 return on_session_restored_callbacks_; | 119 return on_session_restored_callbacks_; |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Contains all registered callbacks for session restore notifications. | 122 // Contains all registered callbacks for session restore notifications. |
| 123 static CallbackList* on_session_restored_callbacks_; | 123 static CallbackList* on_session_restored_callbacks_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(SessionRestore); | 125 DISALLOW_COPY_AND_ASSIGN(SessionRestore); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 128 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
| OLD | NEW |