| 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/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "chrome/browser/defaults.h" | 14 #include "chrome/browser/defaults.h" |
| 15 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 15 #include "chrome/browser/sessions/base_session_service.h" | 16 #include "chrome/browser/sessions/base_session_service.h" |
| 16 #include "chrome/browser/sessions/session_id.h" | 17 #include "chrome/browser/sessions/session_id.h" |
| 17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/browser_list_observer.h" | 20 #include "chrome/browser/ui/browser_list_observer.h" |
| 20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 22 #include "ui/base/ui_base_types.h" | 23 #include "ui/base/ui_base_types.h" |
| 23 | 24 |
| 24 class Profile; | 25 class Profile; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 46 // illusion that app windows run in separate processes. Similar behavior occurs | 47 // illusion that app windows run in separate processes. Similar behavior occurs |
| 47 // with incognito windows. | 48 // with incognito windows. |
| 48 // | 49 // |
| 49 // SessionService itself maintains a set of SessionCommands that allow | 50 // SessionService itself maintains a set of SessionCommands that allow |
| 50 // SessionService to rebuild the open state of the browser (as | 51 // SessionService to rebuild the open state of the browser (as |
| 51 // SessionWindow, SessionTab and TabNavigation). The commands are periodically | 52 // SessionWindow, SessionTab and TabNavigation). The commands are periodically |
| 52 // flushed to SessionBackend and written to a file. Every so often | 53 // flushed to SessionBackend and written to a file. Every so often |
| 53 // SessionService rebuilds the contents of the file from the open state | 54 // SessionService rebuilds the contents of the file from the open state |
| 54 // of the browser. | 55 // of the browser. |
| 55 class SessionService : public BaseSessionService, | 56 class SessionService : public BaseSessionService, |
| 57 public ProfileKeyedService, |
| 56 public content::NotificationObserver, | 58 public content::NotificationObserver, |
| 57 public chrome::BrowserListObserver { | 59 public chrome::BrowserListObserver { |
| 58 friend class SessionServiceTestHelper; | 60 friend class SessionServiceTestHelper; |
| 59 public: | 61 public: |
| 60 // Used to distinguish an application window from a normal one. | 62 // Used to distinguish an application window from a normal one. |
| 61 enum AppType { | 63 enum AppType { |
| 62 TYPE_APP, | 64 TYPE_APP, |
| 63 TYPE_NORMAL | 65 TYPE_NORMAL |
| 64 }; | 66 }; |
| 65 | 67 |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 const base::TimeDelta save_delay_in_hrs_; | 499 const base::TimeDelta save_delay_in_hrs_; |
| 498 | 500 |
| 499 // For browser_tests, since we want to simulate the browser shutting down | 501 // For browser_tests, since we want to simulate the browser shutting down |
| 500 // without quitting. | 502 // without quitting. |
| 501 bool force_browser_not_alive_with_no_windows_; | 503 bool force_browser_not_alive_with_no_windows_; |
| 502 | 504 |
| 503 DISALLOW_COPY_AND_ASSIGN(SessionService); | 505 DISALLOW_COPY_AND_ASSIGN(SessionService); |
| 504 }; | 506 }; |
| 505 | 507 |
| 506 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 508 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
| OLD | NEW |