OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // The created request does NOT directly invoke the callback, rather the | 177 // The created request does NOT directly invoke the callback, rather the |
178 // callback invokes OnGotSessionCommands from which we map the | 178 // callback invokes OnGotSessionCommands from which we map the |
179 // SessionCommands to browser state, then notify the callback. | 179 // SessionCommands to browser state, then notify the callback. |
180 Handle GetCurrentSession(CancelableRequestConsumerBase* consumer, | 180 Handle GetCurrentSession(CancelableRequestConsumerBase* consumer, |
181 SessionCallback* callback); | 181 SessionCallback* callback); |
182 | 182 |
183 // Overridden from BaseSessionService because we want some UMA reporting on | 183 // Overridden from BaseSessionService because we want some UMA reporting on |
184 // session update activities. | 184 // session update activities. |
185 virtual void Save() OVERRIDE; | 185 virtual void Save() OVERRIDE; |
186 | 186 |
| 187 // Restores or resets the session state, such as session cookies. |
| 188 void RestoreOrResetSessionState(bool restore); |
| 189 |
187 private: | 190 private: |
| 191 class SessionCookieStore; |
| 192 |
188 typedef std::map<SessionID::id_type, std::pair<int, int> > IdToRange; | 193 typedef std::map<SessionID::id_type, std::pair<int, int> > IdToRange; |
189 typedef std::map<SessionID::id_type, SessionTab*> IdToSessionTab; | 194 typedef std::map<SessionID::id_type, SessionTab*> IdToSessionTab; |
190 typedef std::map<SessionID::id_type, SessionWindow*> IdToSessionWindow; | 195 typedef std::map<SessionID::id_type, SessionWindow*> IdToSessionWindow; |
191 | 196 |
192 | 197 |
193 // These types mirror Browser::Type, but are re-defined here because these | 198 // These types mirror Browser::Type, but are re-defined here because these |
194 // specific enumeration _values_ are written into the session database and | 199 // specific enumeration _values_ are written into the session database and |
195 // are needed to maintain forward compatibility. | 200 // are needed to maintain forward compatibility. |
196 // Note that we only store browsers of type TYPE_TABBED and TYPE_POPUP. | 201 // Note that we only store browsers of type TYPE_TABBED and TYPE_POPUP. |
197 enum WindowType { | 202 enum WindowType { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 base::TimeTicks last_updated_tab_closed_time_; | 453 base::TimeTicks last_updated_tab_closed_time_; |
449 base::TimeTicks last_updated_nav_list_pruned_time_; | 454 base::TimeTicks last_updated_nav_list_pruned_time_; |
450 base::TimeTicks last_updated_nav_entry_commit_time_; | 455 base::TimeTicks last_updated_nav_entry_commit_time_; |
451 base::TimeTicks last_updated_save_time_; | 456 base::TimeTicks last_updated_save_time_; |
452 | 457 |
453 // Constants used in calculating histogram data. | 458 // Constants used in calculating histogram data. |
454 const base::TimeDelta save_delay_in_millis_; | 459 const base::TimeDelta save_delay_in_millis_; |
455 const base::TimeDelta save_delay_in_mins_; | 460 const base::TimeDelta save_delay_in_mins_; |
456 const base::TimeDelta save_delay_in_hrs_; | 461 const base::TimeDelta save_delay_in_hrs_; |
457 | 462 |
| 463 // Stores the value of the command line switch enable-restore-session-data. If |
| 464 // the flag is on, session data (such as cookies) are saved, and restored |
| 465 // after a restart or a crash. |
| 466 bool enable_restore_session_data_; |
| 467 |
| 468 scoped_refptr<SessionCookieStore> session_cookie_store_; |
| 469 |
458 DISALLOW_COPY_AND_ASSIGN(SessionService); | 470 DISALLOW_COPY_AND_ASSIGN(SessionService); |
459 }; | 471 }; |
460 | 472 |
461 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 473 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
OLD | NEW |