Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/sessions/session_service.h

Issue 14497003: Moves TabNavigation into components/sessions and renames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really remove webkit_support Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // 42 //
43 // SessionService supports restoring from the last session. The last session 43 // SessionService supports restoring from the last session. The last session
44 // typically corresponds to the last run of the browser, but not always. For 44 // typically corresponds to the last run of the browser, but not always. For
45 // example, if the user has a tabbed browser and app window running, closes the 45 // example, if the user has a tabbed browser and app window running, closes the
46 // tabbed browser, then creates a new tabbed browser the current session is made 46 // tabbed browser, then creates a new tabbed browser the current session is made
47 // the last session and the current session reset. This is done to provide the 47 // the last session and the current session reset. This is done to provide the
48 // illusion that app windows run in separate processes. Similar behavior occurs 48 // illusion that app windows run in separate processes. Similar behavior occurs
49 // with incognito windows. 49 // with incognito windows.
50 // 50 //
51 // SessionService itself maintains a set of SessionCommands that allow 51 // SessionService itself maintains a set of SessionCommands that allow
52 // SessionService to rebuild the open state of the browser (as 52 // SessionService to rebuild the open state of the browser (as SessionWindow,
53 // SessionWindow, SessionTab and TabNavigation). The commands are periodically 53 // SessionTab and SerializedNavigationEntry). The commands are periodically
54 // flushed to SessionBackend and written to a file. Every so often 54 // flushed to SessionBackend and written to a file. Every so often
55 // SessionService rebuilds the contents of the file from the open state 55 // SessionService rebuilds the contents of the file from the open state of the
56 // of the browser. 56 // browser.
57 class SessionService : public BaseSessionService, 57 class SessionService : public BaseSessionService,
58 public ProfileKeyedService, 58 public ProfileKeyedService,
59 public content::NotificationObserver, 59 public content::NotificationObserver,
60 public chrome::BrowserListObserver { 60 public chrome::BrowserListObserver {
61 friend class SessionServiceTestHelper; 61 friend class SessionServiceTestHelper;
62 public: 62 public:
63 // Used to distinguish an application window from a normal one. 63 // Used to distinguish an application window from a normal one.
64 enum AppType { 64 enum AppType {
65 TYPE_APP, 65 TYPE_APP,
66 TYPE_NORMAL 66 TYPE_NORMAL
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 const SessionID& tab_id, 152 const SessionID& tab_id,
153 int count); 153 int count);
154 154
155 // Invoked when the NavigationController has removed entries from the front of 155 // Invoked when the NavigationController has removed entries from the front of
156 // the list. |count| gives the number of entries that were removed. 156 // the list. |count| gives the number of entries that were removed.
157 void TabNavigationPathPrunedFromFront(const SessionID& window_id, 157 void TabNavigationPathPrunedFromFront(const SessionID& window_id,
158 const SessionID& tab_id, 158 const SessionID& tab_id,
159 int count); 159 int count);
160 160
161 // Updates the navigation entry for the specified tab. 161 // Updates the navigation entry for the specified tab.
162 void UpdateTabNavigation(const SessionID& window_id, 162 void UpdateTabNavigation(
163 const SessionID& tab_id, 163 const SessionID& window_id,
164 const TabNavigation& navigation); 164 const SessionID& tab_id,
165 const sessions::SerializedNavigationEntry& navigation);
165 166
166 // Notification that a tab has restored its entries or a closed tab is being 167 // Notification that a tab has restored its entries or a closed tab is being
167 // reused. 168 // reused.
168 void TabRestored(content::WebContents* tab, bool pinned); 169 void TabRestored(content::WebContents* tab, bool pinned);
169 170
170 // Sets the index of the selected entry in the navigation controller for the 171 // Sets the index of the selected entry in the navigation controller for the
171 // specified tab. 172 // specified tab.
172 void SetSelectedNavigationIndex(const SessionID& window_id, 173 void SetSelectedNavigationIndex(const SessionID& window_id,
173 const SessionID& tab_id, 174 const SessionID& tab_id,
174 int index); 175 int index);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // Returns the tab with the specified id in tabs. If a tab does not exist, 302 // Returns the tab with the specified id in tabs. If a tab does not exist,
302 // it is created. 303 // it is created.
303 SessionTab* GetTab(SessionID::id_type tab_id, 304 SessionTab* GetTab(SessionID::id_type tab_id,
304 IdToSessionTab* tabs); 305 IdToSessionTab* tabs);
305 306
306 // Returns an iterator into navigations pointing to the navigation whose 307 // Returns an iterator into navigations pointing to the navigation whose
307 // index matches |index|. If no navigation index matches |index|, the first 308 // index matches |index|. If no navigation index matches |index|, the first
308 // navigation with an index > |index| is returned. 309 // navigation with an index > |index| is returned.
309 // 310 //
310 // This assumes the navigations are ordered by index in ascending order. 311 // This assumes the navigations are ordered by index in ascending order.
311 std::vector<TabNavigation>::iterator FindClosestNavigationWithIndex( 312 std::vector<sessions::SerializedNavigationEntry>::iterator
312 std::vector<TabNavigation>* navigations, 313 FindClosestNavigationWithIndex(
314 std::vector<sessions::SerializedNavigationEntry>* navigations,
313 int index); 315 int index);
314 316
315 // Does the following: 317 // Does the following:
316 // . Deletes and removes any windows with no tabs or windows with types other 318 // . Deletes and removes any windows with no tabs or windows with types other
317 // than tabbed_browser or browser. NOTE: constrained windows that have 319 // than tabbed_browser or browser. NOTE: constrained windows that have
318 // been dragged out are of type browser. As such, this preserves any dragged 320 // been dragged out are of type browser. As such, this preserves any dragged
319 // out constrained windows (aka popups that have been dragged out). 321 // out constrained windows (aka popups that have been dragged out).
320 // . Sorts the tabs in windows with valid tabs based on the tabs 322 // . Sorts the tabs in windows with valid tabs based on the tabs
321 // visual order, and adds the valid windows to windows. 323 // visual order, and adds the valid windows to windows.
322 void SortTabsBasedOnVisualOrderAndPrune( 324 void SortTabsBasedOnVisualOrderAndPrune(
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 const base::TimeDelta save_delay_in_hrs_; 496 const base::TimeDelta save_delay_in_hrs_;
495 497
496 // For browser_tests, since we want to simulate the browser shutting down 498 // For browser_tests, since we want to simulate the browser shutting down
497 // without quitting. 499 // without quitting.
498 bool force_browser_not_alive_with_no_windows_; 500 bool force_browser_not_alive_with_no_windows_;
499 501
500 DISALLOW_COPY_AND_ASSIGN(SessionService); 502 DISALLOW_COPY_AND_ASSIGN(SessionService);
501 }; 503 };
502 504
503 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ 505 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore_browsertest.cc ('k') | chrome/browser/sessions/session_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698