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_TAB_RESTORE_SERVICE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ |
6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ | 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 ~TabRestoreServiceHelper(); | 72 ~TabRestoreServiceHelper(); |
73 | 73 |
74 // Helper methods used to implement TabRestoreService. | 74 // Helper methods used to implement TabRestoreService. |
75 void AddObserver(TabRestoreServiceObserver* observer); | 75 void AddObserver(TabRestoreServiceObserver* observer); |
76 void RemoveObserver(TabRestoreServiceObserver* observer); | 76 void RemoveObserver(TabRestoreServiceObserver* observer); |
77 void CreateHistoricalTab(content::WebContents* contents, int index); | 77 void CreateHistoricalTab(content::WebContents* contents, int index); |
78 void BrowserClosing(TabRestoreServiceDelegate* delegate); | 78 void BrowserClosing(TabRestoreServiceDelegate* delegate); |
79 void BrowserClosed(TabRestoreServiceDelegate* delegate); | 79 void BrowserClosed(TabRestoreServiceDelegate* delegate); |
80 void ClearEntries(); | 80 void ClearEntries(); |
81 const Entries& entries() const; | 81 const Entries& entries() const; |
82 void RestoreMostRecentEntry(TabRestoreServiceDelegate* delegate, | 82 // In the case of restoring a window, the returned WebContents will contain |
sky
2013/08/01 00:05:43
Nuke comments since it's just duplicating what you
Kristen Dwan
2013/08/02 20:54:19
Done.
| |
83 chrome::HostDesktopType host_desktop_type); | 83 // the last successfully restored tab. |
84 content::WebContents* RestoreMostRecentEntry( | |
85 TabRestoreServiceDelegate* delegate, | |
86 chrome::HostDesktopType host_desktop_type); | |
84 Tab* RemoveTabEntryById(SessionID::id_type id); | 87 Tab* RemoveTabEntryById(SessionID::id_type id); |
85 void RestoreEntryById(TabRestoreServiceDelegate* delegate, | 88 // In the case of restoring a window, the returned WebContents will contain |
86 SessionID::id_type id, | 89 // the last successfully restored tab. |
87 chrome::HostDesktopType host_desktop_type, | 90 content::WebContents* RestoreEntryById(TabRestoreServiceDelegate* delegate, |
88 WindowOpenDisposition disposition); | 91 SessionID::id_type id, |
92 chrome::HostDesktopType host_desktop_type, | |
93 WindowOpenDisposition disposition); | |
89 | 94 |
90 // Notifies observers the tabs have changed. | 95 // Notifies observers the tabs have changed. |
91 void NotifyTabsChanged(); | 96 void NotifyTabsChanged(); |
92 | 97 |
93 // Notifies observers the service has loaded. | 98 // Notifies observers the service has loaded. |
94 void NotifyLoaded(); | 99 void NotifyLoaded(); |
95 | 100 |
96 // Adds |entry| to the list of entries and takes ownership. If |prune| is true | 101 // Adds |entry| to the list of entries and takes ownership. If |prune| is true |
97 // |PruneAndNotify| is invoked. If |to_front| is true the entry is added to | 102 // |PruneAndNotify| is invoked. If |to_front| is true the entry is added to |
98 // the front, otherwise the back. Normal closes go to the front, but | 103 // the front, otherwise the back. Normal closes go to the front, but |
(...skipping 27 matching lines...) Expand all Loading... | |
126 // tab. If |delegate| is NULL, this creates a new window for the entry. This | 131 // tab. If |delegate| is NULL, this creates a new window for the entry. This |
127 // returns the TabRestoreServiceDelegate into which the tab was restored. | 132 // returns the TabRestoreServiceDelegate into which the tab was restored. |
128 // |disposition| will be respected, but if it is UNKNOWN then the tab's | 133 // |disposition| will be respected, but if it is UNKNOWN then the tab's |
129 // original attributes will be respected instead. If a new browser needs to be | 134 // original attributes will be respected instead. If a new browser needs to be |
130 // created for this tab, it will be created on the desktop specified by | 135 // created for this tab, it will be created on the desktop specified by |
131 // |host_desktop_type|. | 136 // |host_desktop_type|. |
132 TabRestoreServiceDelegate* RestoreTab( | 137 TabRestoreServiceDelegate* RestoreTab( |
133 const Tab& tab, | 138 const Tab& tab, |
134 TabRestoreServiceDelegate* delegate, | 139 TabRestoreServiceDelegate* delegate, |
135 chrome::HostDesktopType host_desktop_type, | 140 chrome::HostDesktopType host_desktop_type, |
136 WindowOpenDisposition disposition); | 141 WindowOpenDisposition disposition, |
142 content::WebContents** contents); | |
137 | 143 |
138 // Returns true if |tab| has more than one navigation. If |tab| has more | 144 // Returns true if |tab| has more than one navigation. If |tab| has more |
139 // than one navigation |tab->current_navigation_index| is constrained based | 145 // than one navigation |tab->current_navigation_index| is constrained based |
140 // on the number of navigations. | 146 // on the number of navigations. |
141 static bool ValidateTab(Tab* tab); | 147 static bool ValidateTab(Tab* tab); |
142 | 148 |
143 // Validates all the tabs in a window, plus the window's active tab index. | 149 // Validates all the tabs in a window, plus the window's active tab index. |
144 static bool ValidateWindow(Window* window); | 150 static bool ValidateWindow(Window* window); |
145 | 151 |
146 // Returns true if |tab| is one we care about restoring. | 152 // Returns true if |tab| is one we care about restoring. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 // corresponding BrowserClosed. We cache the set of delegates closing to | 185 // corresponding BrowserClosed. We cache the set of delegates closing to |
180 // avoid creating historical tabs for them. | 186 // avoid creating historical tabs for them. |
181 std::set<TabRestoreServiceDelegate*> closing_delegates_; | 187 std::set<TabRestoreServiceDelegate*> closing_delegates_; |
182 | 188 |
183 TimeFactory* const time_factory_; | 189 TimeFactory* const time_factory_; |
184 | 190 |
185 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); | 191 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); |
186 }; | 192 }; |
187 | 193 |
188 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ | 194 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ |
OLD | NEW |