| 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 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_vector.h" | |
| 15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 16 #include "base/task/cancelable_task_tracker.h" | 15 #include "base/task/cancelable_task_tracker.h" |
| 17 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 18 #include "chrome/browser/defaults.h" | 17 #include "chrome/browser/defaults.h" |
| 19 #include "chrome/browser/sessions/session_common_utils.h" | 18 #include "chrome/browser/sessions/session_common_utils.h" |
| 20 #include "chrome/browser/sessions/session_service_utils.h" | 19 #include "chrome/browser/sessions/session_service_utils.h" |
| 21 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
| 23 #include "chrome/browser/ui/browser_list_observer.h" | 22 #include "chrome/browser/ui/browser_list_observer.h" |
| 24 #include "components/keyed_service/core/keyed_service.h" | 23 #include "components/keyed_service/core/keyed_service.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 void Observe(int type, | 252 void Observe(int type, |
| 254 const content::NotificationSource& source, | 253 const content::NotificationSource& source, |
| 255 const content::NotificationDetails& details) override; | 254 const content::NotificationDetails& details) override; |
| 256 | 255 |
| 257 // chrome::BrowserListObserver | 256 // chrome::BrowserListObserver |
| 258 void OnBrowserAdded(Browser* browser) override {} | 257 void OnBrowserAdded(Browser* browser) override {} |
| 259 void OnBrowserRemoved(Browser* browser) override {} | 258 void OnBrowserRemoved(Browser* browser) override {} |
| 260 void OnBrowserSetLastActive(Browser* browser) override; | 259 void OnBrowserSetLastActive(Browser* browser) override; |
| 261 | 260 |
| 262 // Converts |commands| to SessionWindows and notifies the callback. | 261 // Converts |commands| to SessionWindows and notifies the callback. |
| 263 void OnGotSessionCommands(const sessions::GetLastSessionCallback& callback, | 262 void OnGotSessionCommands( |
| 264 ScopedVector<sessions::SessionCommand> commands); | 263 const sessions::GetLastSessionCallback& callback, |
| 264 std::vector<std::unique_ptr<sessions::SessionCommand>> commands); |
| 265 | 265 |
| 266 // Adds commands to commands that will recreate the state of the specified | 266 // Adds commands to commands that will recreate the state of the specified |
| 267 // tab. This adds at most kMaxNavigationCountToPersist navigations (in each | 267 // tab. This adds at most kMaxNavigationCountToPersist navigations (in each |
| 268 // direction from the current navigation index). | 268 // direction from the current navigation index). |
| 269 // A pair is added to tab_to_available_range indicating the range of | 269 // A pair is added to tab_to_available_range indicating the range of |
| 270 // indices that were written. | 270 // indices that were written. |
| 271 void BuildCommandsForTab( | 271 void BuildCommandsForTab( |
| 272 const SessionID& window_id, | 272 const SessionID& window_id, |
| 273 content::WebContents* tab, | 273 content::WebContents* tab, |
| 274 int index_in_window, | 274 int index_in_window, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // For browser_tests, since we want to simulate the browser shutting down | 401 // For browser_tests, since we want to simulate the browser shutting down |
| 402 // without quitting. | 402 // without quitting. |
| 403 bool force_browser_not_alive_with_no_windows_; | 403 bool force_browser_not_alive_with_no_windows_; |
| 404 | 404 |
| 405 base::WeakPtrFactory<SessionService> weak_factory_; | 405 base::WeakPtrFactory<SessionService> weak_factory_; |
| 406 | 406 |
| 407 DISALLOW_COPY_AND_ASSIGN(SessionService); | 407 DISALLOW_COPY_AND_ASSIGN(SessionService); |
| 408 }; | 408 }; |
| 409 | 409 |
| 410 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 410 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
| OLD | NEW |