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 12 matching lines...) Expand all Loading... | |
23 class Profile; | 23 class Profile; |
24 class SessionCommand; | 24 class SessionCommand; |
25 class TabContents; | 25 class TabContents; |
26 struct SessionTab; | 26 struct SessionTab; |
27 struct SessionWindow; | 27 struct SessionWindow; |
28 | 28 |
29 namespace content { | 29 namespace content { |
30 class NavigationEntry; | 30 class NavigationEntry; |
31 } | 31 } |
32 | 32 |
33 namespace performance_monitor { | |
34 class PerformanceMonitorSessionRestoreBrowserTest; | |
35 } | |
36 | |
33 // SessionService ------------------------------------------------------------ | 37 // SessionService ------------------------------------------------------------ |
34 | 38 |
35 // SessionService is responsible for maintaining the state of open windows | 39 // SessionService is responsible for maintaining the state of open windows |
36 // and tabs so that they can be restored at a later date. The state of the | 40 // and tabs so that they can be restored at a later date. The state of the |
37 // currently open browsers is referred to as the current session. | 41 // currently open browsers is referred to as the current session. |
38 // | 42 // |
39 // SessionService supports restoring from the last session. The last session | 43 // SessionService supports restoring from the last session. The last session |
40 // typically corresponds to the last run of the browser, but not always. For | 44 // typically corresponds to the last run of the browser, but not always. For |
41 // example, if the user has a tabbed browser and app window running, closes the | 45 // example, if the user has a tabbed browser and app window running, closes the |
42 // tabbed browser, then creates a new tabbed browser the current session is made | 46 // tabbed browser, then creates a new tabbed browser the current session is made |
43 // the last session and the current session reset. This is done to provide the | 47 // the last session and the current session reset. This is done to provide the |
44 // illusion that app windows run in separate processes. Similar behavior occurs | 48 // illusion that app windows run in separate processes. Similar behavior occurs |
45 // with incognito windows. | 49 // with incognito windows. |
46 // | 50 // |
47 // SessionService itself maintains a set of SessionCommands that allow | 51 // SessionService itself maintains a set of SessionCommands that allow |
48 // SessionService to rebuild the open state of the browser (as | 52 // SessionService to rebuild the open state of the browser (as |
49 // SessionWindow, SessionTab and TabNavigation). The commands are periodically | 53 // SessionWindow, SessionTab and TabNavigation). The commands are periodically |
50 // flushed to SessionBackend and written to a file. Every so often | 54 // flushed to SessionBackend and written to a file. Every so often |
51 // SessionService rebuilds the contents of the file from the open state | 55 // SessionService rebuilds the contents of the file from the open state |
52 // of the browser. | 56 // of the browser. |
53 class SessionService : public BaseSessionService, | 57 class SessionService : public BaseSessionService, |
54 public content::NotificationObserver { | 58 public content::NotificationObserver { |
55 friend class SessionRestoreTest; | 59 friend class SessionRestoreTest; |
56 friend class SessionServiceTestHelper; | 60 friend class SessionServiceTestHelper; |
61 friend class performance_monitor::PerformanceMonitorSessionRestoreBrowserTest; | |
sky
2012/08/07 19:48:04
I don't want another friend class. Can you move wh
Devlin
2012/08/07 22:51:22
Done. Since SessionRestoreTest needed the same thi
| |
57 public: | 62 public: |
58 // Used to distinguish an application window from a normal one. | 63 // Used to distinguish an application window from a normal one. |
59 enum AppType { | 64 enum AppType { |
60 TYPE_APP, | 65 TYPE_APP, |
61 TYPE_NORMAL | 66 TYPE_NORMAL |
62 }; | 67 }; |
63 | 68 |
64 // Creates a SessionService for the specified profile. | 69 // Creates a SessionService for the specified profile. |
65 explicit SessionService(Profile* profile); | 70 explicit SessionService(Profile* profile); |
66 // For testing. | 71 // For testing. |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 const base::TimeDelta save_delay_in_hrs_; | 478 const base::TimeDelta save_delay_in_hrs_; |
474 | 479 |
475 // For browser_tests, since we want to simulate the browser shutting down | 480 // For browser_tests, since we want to simulate the browser shutting down |
476 // without quitting. | 481 // without quitting. |
477 bool force_browser_not_alive_with_no_windows_; | 482 bool force_browser_not_alive_with_no_windows_; |
478 | 483 |
479 DISALLOW_COPY_AND_ASSIGN(SessionService); | 484 DISALLOW_COPY_AND_ASSIGN(SessionService); |
480 }; | 485 }; |
481 | 486 |
482 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 487 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
OLD | NEW |