| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // of the browser. | 46 // of the browser. |
| 47 class SessionService : public BaseSessionService, | 47 class SessionService : public BaseSessionService, |
| 48 public NotificationObserver { | 48 public NotificationObserver { |
| 49 friend class SessionServiceTestHelper; | 49 friend class SessionServiceTestHelper; |
| 50 public: | 50 public: |
| 51 // Creates a SessionService for the specified profile. | 51 // Creates a SessionService for the specified profile. |
| 52 explicit SessionService(Profile* profile); | 52 explicit SessionService(Profile* profile); |
| 53 // For testing. | 53 // For testing. |
| 54 explicit SessionService(const FilePath& save_path); | 54 explicit SessionService(const FilePath& save_path); |
| 55 | 55 |
| 56 // Invoke at a point when you think session restore might occur. For example, |
| 57 // during startup and window creation this is invoked to see if a session |
| 58 // needs to be restored. If a session needs to be restored it is done so |
| 59 // asynchronously and true is returned. If false is returned the session was |
| 60 // not restored and the caller needs to create a new window. |
| 61 bool RestoreIfNecessary(const std::vector<GURL>& urls_to_open); |
| 62 |
| 56 // Resets the contents of the file from the current state of all open | 63 // Resets the contents of the file from the current state of all open |
| 57 // browsers whose profile matches our profile. | 64 // browsers whose profile matches our profile. |
| 58 void ResetFromCurrentBrowsers(); | 65 void ResetFromCurrentBrowsers(); |
| 59 | 66 |
| 60 // Moves the current session to the last session. This is useful when a | 67 // Moves the current session to the last session. This is useful when a |
| 61 // checkpoint occurs, such as when the user launches the app and no tabbed | 68 // checkpoint occurs, such as when the user launches the app and no tabbed |
| 62 // browsers are running. | 69 // browsers are running. |
| 63 void MoveCurrentSessionToLastSession(); | 70 void MoveCurrentSessionToLastSession(); |
| 64 | 71 |
| 65 // Associates a tab with a window. | 72 // Associates a tab with a window. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 TYPE_NORMAL = 0, | 180 TYPE_NORMAL = 0, |
| 174 TYPE_POPUP = 1, | 181 TYPE_POPUP = 1, |
| 175 TYPE_APP = 2, | 182 TYPE_APP = 2, |
| 176 TYPE_APP_POPUP = TYPE_APP + TYPE_POPUP, | 183 TYPE_APP_POPUP = TYPE_APP + TYPE_POPUP, |
| 177 TYPE_DEVTOOLS = TYPE_APP + 4, | 184 TYPE_DEVTOOLS = TYPE_APP + 4, |
| 178 TYPE_APP_PANEL = TYPE_APP + 8 | 185 TYPE_APP_PANEL = TYPE_APP + 8 |
| 179 }; | 186 }; |
| 180 | 187 |
| 181 void Init(); | 188 void Init(); |
| 182 | 189 |
| 190 // Implementation of RestoreIfNecessary. If |browser| is non-null and we need |
| 191 // to restore, the tabs are added to it, otherwise a new browser is created. |
| 192 bool RestoreIfNecessary(const std::vector<GURL>& urls_to_open, |
| 193 Browser* browser); |
| 194 |
| 183 virtual void Observe(NotificationType type, | 195 virtual void Observe(NotificationType type, |
| 184 const NotificationSource& source, | 196 const NotificationSource& source, |
| 185 const NotificationDetails& details); | 197 const NotificationDetails& details); |
| 186 | 198 |
| 187 // Sets the application extension id of the specified tab. | 199 // Sets the application extension id of the specified tab. |
| 188 void SetTabAppExtensionID(const SessionID& window_id, | 200 void SetTabAppExtensionID(const SessionID& window_id, |
| 189 const SessionID& tab_id, | 201 const SessionID& tab_id, |
| 190 const std::string& app_extension_id); | 202 const std::string& app_extension_id); |
| 191 | 203 |
| 192 // Methods to create the various commands. It is up to the caller to delete | 204 // Methods to create the various commands. It is up to the caller to delete |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // If true and a new tabbed browser is created and there are no opened tabbed | 415 // If true and a new tabbed browser is created and there are no opened tabbed |
| 404 // browser (has_open_trackable_browsers_ is false), then the current session | 416 // browser (has_open_trackable_browsers_ is false), then the current session |
| 405 // is made the previous session. See description above class for details on | 417 // is made the previous session. See description above class for details on |
| 406 // current/previou session. | 418 // current/previou session. |
| 407 bool move_on_new_browser_; | 419 bool move_on_new_browser_; |
| 408 | 420 |
| 409 DISALLOW_COPY_AND_ASSIGN(SessionService); | 421 DISALLOW_COPY_AND_ASSIGN(SessionService); |
| 410 }; | 422 }; |
| 411 | 423 |
| 412 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 424 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
| OLD | NEW |