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/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "base/task/cancelable_task_tracker.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "chrome/browser/defaults.h" | 16 #include "chrome/browser/defaults.h" |
16 #include "chrome/browser/sessions/base_session_service.h" | 17 #include "chrome/browser/sessions/base_session_service.h" |
17 #include "chrome/browser/sessions/session_id.h" | 18 #include "chrome/browser/sessions/session_id.h" |
18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 20 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/browser_list_observer.h" | 21 #include "chrome/browser/ui/browser_list_observer.h" |
21 #include "chrome/common/cancelable_task_tracker.h" | |
22 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 22 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
23 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
24 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
25 #include "ui/base/ui_base_types.h" | 25 #include "ui/base/ui_base_types.h" |
26 | 26 |
27 class Profile; | 27 class Profile; |
28 class SessionCommand; | 28 class SessionCommand; |
29 struct SessionTab; | 29 struct SessionTab; |
30 struct SessionWindow; | 30 struct SessionWindow; |
31 | 31 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const std::string& user_agent_override); | 186 const std::string& user_agent_override); |
187 | 187 |
188 // Callback from GetLastSession. | 188 // Callback from GetLastSession. |
189 // The second parameter is the id of the window that was last active. | 189 // The second parameter is the id of the window that was last active. |
190 typedef base::Callback<void(ScopedVector<SessionWindow>, SessionID::id_type)> | 190 typedef base::Callback<void(ScopedVector<SessionWindow>, SessionID::id_type)> |
191 SessionCallback; | 191 SessionCallback; |
192 | 192 |
193 // Fetches the contents of the last session, notifying the callback when | 193 // Fetches the contents of the last session, notifying the callback when |
194 // done. If the callback is supplied an empty vector of SessionWindows | 194 // done. If the callback is supplied an empty vector of SessionWindows |
195 // it means the session could not be restored. | 195 // it means the session could not be restored. |
196 CancelableTaskTracker::TaskId GetLastSession(const SessionCallback& callback, | 196 base::CancelableTaskTracker::TaskId GetLastSession( |
197 CancelableTaskTracker* tracker); | 197 const SessionCallback& callback, |
| 198 base::CancelableTaskTracker* tracker); |
198 | 199 |
199 // Overridden from BaseSessionService because we want some UMA reporting on | 200 // Overridden from BaseSessionService because we want some UMA reporting on |
200 // session update activities. | 201 // session update activities. |
201 virtual void Save() OVERRIDE; | 202 virtual void Save() OVERRIDE; |
202 | 203 |
203 private: | 204 private: |
204 // Allow tests to access our innards for testing purposes. | 205 // Allow tests to access our innards for testing purposes. |
205 FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RestoreActivation1); | 206 FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RestoreActivation1); |
206 FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RestoreActivation2); | 207 FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RestoreActivation2); |
207 FRIEND_TEST_ALL_PREFIXES(NoStartupWindowTest, DontInitSessionServiceForApps); | 208 FRIEND_TEST_ALL_PREFIXES(NoStartupWindowTest, DontInitSessionServiceForApps); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 const base::TimeDelta save_delay_in_hrs_; | 503 const base::TimeDelta save_delay_in_hrs_; |
503 | 504 |
504 // For browser_tests, since we want to simulate the browser shutting down | 505 // For browser_tests, since we want to simulate the browser shutting down |
505 // without quitting. | 506 // without quitting. |
506 bool force_browser_not_alive_with_no_windows_; | 507 bool force_browser_not_alive_with_no_windows_; |
507 | 508 |
508 DISALLOW_COPY_AND_ASSIGN(SessionService); | 509 DISALLOW_COPY_AND_ASSIGN(SessionService); |
509 }; | 510 }; |
510 | 511 |
511 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 512 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
OLD | NEW |