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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // | 47 // |
48 // SessionService itself maintains a set of SessionCommands that allow | 48 // SessionService itself maintains a set of SessionCommands that allow |
49 // SessionService to rebuild the open state of the browser (as | 49 // SessionService to rebuild the open state of the browser (as |
50 // SessionWindow, SessionTab and TabNavigation). The commands are periodically | 50 // SessionWindow, SessionTab and TabNavigation). The commands are periodically |
51 // flushed to SessionBackend and written to a file. Every so often | 51 // flushed to SessionBackend and written to a file. Every so often |
52 // SessionService rebuilds the contents of the file from the open state | 52 // SessionService rebuilds the contents of the file from the open state |
53 // of the browser. | 53 // of the browser. |
54 class SessionService : public BaseSessionService, | 54 class SessionService : public BaseSessionService, |
55 public content::NotificationObserver { | 55 public content::NotificationObserver { |
56 friend class SessionRestoreTest; | 56 friend class SessionRestoreTest; |
57 friend class SessionServiceTestHelper; | 57 friend class SessionServiceTestHelper; |
58 public: | 58 public: |
59 // Used to distinguish an application window from a normal one. | 59 // Used to distinguish an application window from a normal one. |
60 enum AppType { | 60 enum AppType { |
61 TYPE_APP, | 61 TYPE_APP, |
62 TYPE_NORMAL | 62 TYPE_NORMAL |
63 }; | 63 }; |
64 | 64 |
65 // Creates a SessionService for the specified profile. | 65 // Creates a SessionService for the specified profile. |
66 explicit SessionService(Profile* profile); | 66 explicit SessionService(Profile* profile); |
67 // For testing. | 67 // For testing. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 virtual void Observe(int type, | 215 virtual void Observe(int type, |
216 const content::NotificationSource& source, | 216 const content::NotificationSource& source, |
217 const content::NotificationDetails& details) OVERRIDE; | 217 const content::NotificationDetails& details) OVERRIDE; |
218 | 218 |
219 // Sets the application extension id of the specified tab. | 219 // Sets the application extension id of the specified tab. |
220 void SetTabExtensionAppID(const SessionID& window_id, | 220 void SetTabExtensionAppID(const SessionID& window_id, |
221 const SessionID& tab_id, | 221 const SessionID& tab_id, |
222 const std::string& extension_app_id); | 222 const std::string& extension_app_id); |
223 | 223 |
| 224 // Sets the user agent override of the specified tab. |
| 225 void SetTabUserAgentOverride(const SessionID& window_id, |
| 226 const SessionID& tab_id, |
| 227 const std::string& user_agent_override); |
| 228 |
224 // Methods to create the various commands. It is up to the caller to delete | 229 // Methods to create the various commands. It is up to the caller to delete |
225 // the returned the SessionCommand* object. | 230 // the returned the SessionCommand* object. |
226 SessionCommand* CreateSetSelectedTabInWindow(const SessionID& window_id, | 231 SessionCommand* CreateSetSelectedTabInWindow(const SessionID& window_id, |
227 int index); | 232 int index); |
228 | 233 |
229 SessionCommand* CreateSetTabWindowCommand(const SessionID& window_id, | 234 SessionCommand* CreateSetTabWindowCommand(const SessionID& window_id, |
230 const SessionID& tab_id); | 235 const SessionID& tab_id); |
231 | 236 |
232 SessionCommand* CreateSetWindowBoundsCommand(const SessionID& window_id, | 237 SessionCommand* CreateSetWindowBoundsCommand(const SessionID& window_id, |
233 const gfx::Rect& bounds, | 238 const gfx::Rect& bounds, |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 const base::TimeDelta save_delay_in_hrs_; | 470 const base::TimeDelta save_delay_in_hrs_; |
466 | 471 |
467 // For browser_tests, since we want to simulate the browser shutting down | 472 // For browser_tests, since we want to simulate the browser shutting down |
468 // without quitting. | 473 // without quitting. |
469 bool force_browser_not_alive_with_no_windows_; | 474 bool force_browser_not_alive_with_no_windows_; |
470 | 475 |
471 DISALLOW_COPY_AND_ASSIGN(SessionService); | 476 DISALLOW_COPY_AND_ASSIGN(SessionService); |
472 }; | 477 }; |
473 | 478 |
474 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 479 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
OLD | NEW |