| 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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Notification that a tab has been closed. |closed_by_user_gesture| comes | 135 // Notification that a tab has been closed. |closed_by_user_gesture| comes |
| 136 // from |WebContents::closed_by_user_gesture|; see it for details. | 136 // from |WebContents::closed_by_user_gesture|; see it for details. |
| 137 // | 137 // |
| 138 // Note: this is invoked from the NavigationController's destructor, which is | 138 // Note: this is invoked from the NavigationController's destructor, which is |
| 139 // after the actual tab has been removed. | 139 // after the actual tab has been removed. |
| 140 void TabClosed(const SessionID& window_id, | 140 void TabClosed(const SessionID& window_id, |
| 141 const SessionID& tab_id, | 141 const SessionID& tab_id, |
| 142 bool closed_by_user_gesture); | 142 bool closed_by_user_gesture); |
| 143 | 143 |
| 144 // Notification a window has opened. | 144 // Notification a window has opened. |
| 145 void WindowOpened(Browser* browser); | 145 // Do not perform restoration if |dont_restore| is true. |
| 146 void WindowOpened(Browser* browser, bool dont_restore); |
| 146 | 147 |
| 147 // Notification the window is about to close. | 148 // Notification the window is about to close. |
| 148 void WindowClosing(const SessionID& window_id); | 149 void WindowClosing(const SessionID& window_id); |
| 149 | 150 |
| 150 // Notification a window has finished closing. | 151 // Notification a window has finished closing. |
| 151 void WindowClosed(const SessionID& window_id); | 152 void WindowClosed(const SessionID& window_id); |
| 152 | 153 |
| 153 // Called when a tab is inserted. | 154 // Called when a tab is inserted. |
| 154 void TabInserted(content::WebContents* contents); | 155 void TabInserted(content::WebContents* contents); |
| 155 | 156 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // restored upon session restore. | 242 // restored upon session restore. |
| 242 bool ShouldRestoreWindowOfType(sessions::SessionWindow::WindowType type, | 243 bool ShouldRestoreWindowOfType(sessions::SessionWindow::WindowType type, |
| 243 AppType app_type) const; | 244 AppType app_type) const; |
| 244 | 245 |
| 245 // Removes unrestorable windows from the previous windows list. | 246 // Removes unrestorable windows from the previous windows list. |
| 246 void RemoveUnusedRestoreWindows( | 247 void RemoveUnusedRestoreWindows( |
| 247 std::vector<sessions::SessionWindow*>* window_list); | 248 std::vector<sessions::SessionWindow*>* window_list); |
| 248 | 249 |
| 249 // Implementation of RestoreIfNecessary. If |browser| is non-null and we need | 250 // Implementation of RestoreIfNecessary. If |browser| is non-null and we need |
| 250 // to restore, the tabs are added to it, otherwise a new browser is created. | 251 // to restore, the tabs are added to it, otherwise a new browser is created. |
| 252 // Skip restoration if |dont_restore| is true. |
| 251 bool RestoreIfNecessary(const std::vector<GURL>& urls_to_open, | 253 bool RestoreIfNecessary(const std::vector<GURL>& urls_to_open, |
| 252 Browser* browser); | 254 Browser* browser, bool dont_restore); |
| 253 | 255 |
| 254 void Observe(int type, | 256 void Observe(int type, |
| 255 const content::NotificationSource& source, | 257 const content::NotificationSource& source, |
| 256 const content::NotificationDetails& details) override; | 258 const content::NotificationDetails& details) override; |
| 257 | 259 |
| 258 // chrome::BrowserListObserver | 260 // chrome::BrowserListObserver |
| 259 void OnBrowserAdded(Browser* browser) override {} | 261 void OnBrowserAdded(Browser* browser) override {} |
| 260 void OnBrowserRemoved(Browser* browser) override {} | 262 void OnBrowserRemoved(Browser* browser) override {} |
| 261 void OnBrowserSetLastActive(Browser* browser) override; | 263 void OnBrowserSetLastActive(Browser* browser) override; |
| 262 | 264 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 // For browser_tests, since we want to simulate the browser shutting down | 404 // For browser_tests, since we want to simulate the browser shutting down |
| 403 // without quitting. | 405 // without quitting. |
| 404 bool force_browser_not_alive_with_no_windows_; | 406 bool force_browser_not_alive_with_no_windows_; |
| 405 | 407 |
| 406 base::WeakPtrFactory<SessionService> weak_factory_; | 408 base::WeakPtrFactory<SessionService> weak_factory_; |
| 407 | 409 |
| 408 DISALLOW_COPY_AND_ASSIGN(SessionService); | 410 DISALLOW_COPY_AND_ASSIGN(SessionService); |
| 409 }; | 411 }; |
| 410 | 412 |
| 411 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 413 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
| OLD | NEW |