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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "chrome/browser/defaults.h" | 15 #include "chrome/browser/defaults.h" |
16 #include "chrome/browser/sessions/base_session_service.h" | 16 #include "chrome/browser/sessions/base_session_service.h" |
17 #include "chrome/browser/sessions/session_id.h" | 17 #include "chrome/browser/sessions/session_id.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 22 #include "net/base/cookie_monster.h" |
22 #include "ui/base/ui_base_types.h" | 23 #include "ui/base/ui_base_types.h" |
23 | 24 |
24 class NavigationEntry; | 25 class NavigationEntry; |
25 class Profile; | 26 class Profile; |
26 class SessionCommand; | 27 class SessionCommand; |
27 struct SessionTab; | 28 struct SessionTab; |
28 struct SessionWindow; | 29 struct SessionWindow; |
29 class TabContentsWrapper; | 30 class TabContentsWrapper; |
30 | 31 |
31 // SessionService ------------------------------------------------------------ | 32 // SessionService ------------------------------------------------------------ |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // The created request does NOT directly invoke the callback, rather the | 178 // The created request does NOT directly invoke the callback, rather the |
178 // callback invokes OnGotSessionCommands from which we map the | 179 // callback invokes OnGotSessionCommands from which we map the |
179 // SessionCommands to browser state, then notify the callback. | 180 // SessionCommands to browser state, then notify the callback. |
180 Handle GetCurrentSession(CancelableRequestConsumerBase* consumer, | 181 Handle GetCurrentSession(CancelableRequestConsumerBase* consumer, |
181 SessionCallback* callback); | 182 SessionCallback* callback); |
182 | 183 |
183 // Overridden from BaseSessionService because we want some UMA reporting on | 184 // Overridden from BaseSessionService because we want some UMA reporting on |
184 // session update activities. | 185 // session update activities. |
185 virtual void Save(); | 186 virtual void Save(); |
186 | 187 |
| 188 void StoreSessionCookie(const net::CookieMonster::CanonicalCookie* cookie, |
| 189 bool removed); |
| 190 |
187 private: | 191 private: |
188 typedef std::map<SessionID::id_type, std::pair<int, int> > IdToRange; | 192 typedef std::map<SessionID::id_type, std::pair<int, int> > IdToRange; |
189 typedef std::map<SessionID::id_type, SessionTab*> IdToSessionTab; | 193 typedef std::map<SessionID::id_type, SessionTab*> IdToSessionTab; |
190 typedef std::map<SessionID::id_type, SessionWindow*> IdToSessionWindow; | 194 typedef std::map<SessionID::id_type, SessionWindow*> IdToSessionWindow; |
191 | 195 |
192 | 196 |
193 // These types mirror Browser::Type, but are re-defined here because these | 197 // These types mirror Browser::Type, but are re-defined here because these |
194 // specific enumeration _values_ are written into the session database and | 198 // specific enumeration _values_ are written into the session database and |
195 // are needed to maintain forward compatibility. | 199 // are needed to maintain forward compatibility. |
196 // Note that we only store browsers of type TYPE_TABBED and TYPE_POPUP. | 200 // Note that we only store browsers of type TYPE_TABBED and TYPE_POPUP. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 456 |
453 // Constants used in calculating histogram data. | 457 // Constants used in calculating histogram data. |
454 const base::TimeDelta save_delay_in_millis_; | 458 const base::TimeDelta save_delay_in_millis_; |
455 const base::TimeDelta save_delay_in_mins_; | 459 const base::TimeDelta save_delay_in_mins_; |
456 const base::TimeDelta save_delay_in_hrs_; | 460 const base::TimeDelta save_delay_in_hrs_; |
457 | 461 |
458 DISALLOW_COPY_AND_ASSIGN(SessionService); | 462 DISALLOW_COPY_AND_ASSIGN(SessionService); |
459 }; | 463 }; |
460 | 464 |
461 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 465 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
OLD | NEW |