| 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_BASE_SESSION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ | 6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chrome/browser/cancelable_request.h" | 15 #include "chrome/browser/cancelable_request.h" |
| 16 #include "chrome/browser/profiles/profile_keyed_service.h" | 16 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 17 #include "chrome/browser/sessions/session_id.h" | 17 #include "chrome/browser/sessions/session_id.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 | 19 |
| 20 class Profile; | 20 class Profile; |
| 21 class SessionBackend; | 21 class SessionBackend; |
| 22 class SessionCommand; | 22 class SessionCommand; |
| 23 class TabNavigation; | 23 class TabNavigation; |
| 24 | 24 |
| 25 namespace content { | |
| 26 class NavigationEntry; | |
| 27 } | |
| 28 | |
| 29 // BaseSessionService is the super class of both tab restore service and | 25 // BaseSessionService is the super class of both tab restore service and |
| 30 // session service. It contains commonality needed by both, in particular | 26 // session service. It contains commonality needed by both, in particular |
| 31 // it manages a set of SessionCommands that are periodically sent to a | 27 // it manages a set of SessionCommands that are periodically sent to a |
| 32 // SessionBackend. | 28 // SessionBackend. |
| 33 class BaseSessionService : public CancelableRequestProvider, | 29 class BaseSessionService : public CancelableRequestProvider, |
| 34 public ProfileKeyedService { | 30 public ProfileKeyedService { |
| 35 public: | 31 public: |
| 36 // Identifies the type of session service this is. This is used by the | 32 // Identifies the type of session service this is. This is used by the |
| 37 // backend to determine the name of the files. | 33 // backend to determine the name of the files. |
| 38 enum SessionType { | 34 enum SessionType { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void StartSaveTimer(); | 102 void StartSaveTimer(); |
| 107 | 103 |
| 108 // Saves pending commands to the backend. This is invoked from the timer | 104 // Saves pending commands to the backend. This is invoked from the timer |
| 109 // scheduled by StartSaveTimer. | 105 // scheduled by StartSaveTimer. |
| 110 virtual void Save(); | 106 virtual void Save(); |
| 111 | 107 |
| 112 // Creates a SessionCommand that represents a navigation. | 108 // Creates a SessionCommand that represents a navigation. |
| 113 SessionCommand* CreateUpdateTabNavigationCommand( | 109 SessionCommand* CreateUpdateTabNavigationCommand( |
| 114 SessionID::id_type command_id, | 110 SessionID::id_type command_id, |
| 115 SessionID::id_type tab_id, | 111 SessionID::id_type tab_id, |
| 116 int index, | 112 const TabNavigation& navigation); |
| 117 const content::NavigationEntry& entry); | |
| 118 | 113 |
| 119 // Creates a SessionCommand that represents marking a tab as an application. | 114 // Creates a SessionCommand that represents marking a tab as an application. |
| 120 SessionCommand* CreateSetTabExtensionAppIDCommand( | 115 SessionCommand* CreateSetTabExtensionAppIDCommand( |
| 121 SessionID::id_type command_id, | 116 SessionID::id_type command_id, |
| 122 SessionID::id_type tab_id, | 117 SessionID::id_type tab_id, |
| 123 const std::string& extension_id); | 118 const std::string& extension_id); |
| 124 | 119 |
| 125 // Creates a SessionCommand that containing user agent override used by a | 120 // Creates a SessionCommand that containing user agent override used by a |
| 126 // tab's navigations. | 121 // tab's navigations. |
| 127 SessionCommand* CreateSetTabUserAgentOverrideCommand( | 122 SessionCommand* CreateSetTabUserAgentOverrideCommand( |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // over the commands. | 198 // over the commands. |
| 204 bool pending_reset_; | 199 bool pending_reset_; |
| 205 | 200 |
| 206 // The number of commands sent to the backend before doing a reset. | 201 // The number of commands sent to the backend before doing a reset. |
| 207 int commands_since_reset_; | 202 int commands_since_reset_; |
| 208 | 203 |
| 209 DISALLOW_COPY_AND_ASSIGN(BaseSessionService); | 204 DISALLOW_COPY_AND_ASSIGN(BaseSessionService); |
| 210 }; | 205 }; |
| 211 | 206 |
| 212 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ | 207 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ |
| OLD | NEW |