OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Helper methods used to implement TabRestoreService. | 80 // Helper methods used to implement TabRestoreService. |
81 void AddObserver(TabRestoreServiceObserver* observer); | 81 void AddObserver(TabRestoreServiceObserver* observer); |
82 void RemoveObserver(TabRestoreServiceObserver* observer); | 82 void RemoveObserver(TabRestoreServiceObserver* observer); |
83 void CreateHistoricalTab(content::WebContents* contents, int index); | 83 void CreateHistoricalTab(content::WebContents* contents, int index); |
84 void BrowserClosing(TabRestoreServiceDelegate* delegate); | 84 void BrowserClosing(TabRestoreServiceDelegate* delegate); |
85 void BrowserClosed(TabRestoreServiceDelegate* delegate); | 85 void BrowserClosed(TabRestoreServiceDelegate* delegate); |
86 void ClearEntries(); | 86 void ClearEntries(); |
87 const Entries& entries() const; | 87 const Entries& entries() const; |
88 std::vector<content::WebContents*> RestoreMostRecentEntry( | 88 std::vector<content::WebContents*> RestoreMostRecentEntry( |
89 TabRestoreServiceDelegate* delegate, | 89 TabRestoreServiceDelegate* delegate, |
90 chrome::HostDesktopType host_desktop_type); | 90 ui::HostDesktopType host_desktop_type); |
91 Tab* RemoveTabEntryById(SessionID::id_type id); | 91 Tab* RemoveTabEntryById(SessionID::id_type id); |
92 std::vector<content::WebContents*> RestoreEntryById( | 92 std::vector<content::WebContents*> RestoreEntryById( |
93 TabRestoreServiceDelegate* delegate, | 93 TabRestoreServiceDelegate* delegate, |
94 SessionID::id_type id, | 94 SessionID::id_type id, |
95 chrome::HostDesktopType host_desktop_type, | 95 ui::HostDesktopType host_desktop_type, |
96 WindowOpenDisposition disposition); | 96 WindowOpenDisposition disposition); |
97 | 97 |
98 // Notifies observers the tabs have changed. | 98 // Notifies observers the tabs have changed. |
99 void NotifyTabsChanged(); | 99 void NotifyTabsChanged(); |
100 | 100 |
101 // Notifies observers the service has loaded. | 101 // Notifies observers the service has loaded. |
102 void NotifyLoaded(); | 102 void NotifyLoaded(); |
103 | 103 |
104 // Adds |entry| to the list of entries and takes ownership. If |prune| is true | 104 // Adds |entry| to the list of entries and takes ownership. If |prune| is true |
105 // |PruneAndNotify| is invoked. If |to_front| is true the entry is added to | 105 // |PruneAndNotify| is invoked. If |to_front| is true the entry is added to |
(...skipping 25 matching lines...) Expand all Loading... |
131 content::NavigationController* controller); | 131 content::NavigationController* controller); |
132 | 132 |
133 // This is a helper function for RestoreEntryById() for restoring a single | 133 // This is a helper function for RestoreEntryById() for restoring a single |
134 // tab. If |delegate| is NULL, this creates a new window for the entry. This | 134 // tab. If |delegate| is NULL, this creates a new window for the entry. This |
135 // returns the TabRestoreServiceDelegate into which the tab was restored. | 135 // returns the TabRestoreServiceDelegate into which the tab was restored. |
136 // |disposition| will be respected, but if it is UNKNOWN then the tab's | 136 // |disposition| will be respected, but if it is UNKNOWN then the tab's |
137 // original attributes will be respected instead. If a new browser needs to be | 137 // original attributes will be respected instead. If a new browser needs to be |
138 // created for this tab, it will be created on the desktop specified by | 138 // created for this tab, it will be created on the desktop specified by |
139 // |host_desktop_type|. If present, |contents| will be populated with the | 139 // |host_desktop_type|. If present, |contents| will be populated with the |
140 // WebContents of the restored tab. | 140 // WebContents of the restored tab. |
141 TabRestoreServiceDelegate* RestoreTab( | 141 TabRestoreServiceDelegate* RestoreTab(const Tab& tab, |
142 const Tab& tab, | 142 TabRestoreServiceDelegate* delegate, |
143 TabRestoreServiceDelegate* delegate, | 143 ui::HostDesktopType host_desktop_type, |
144 chrome::HostDesktopType host_desktop_type, | 144 WindowOpenDisposition disposition, |
145 WindowOpenDisposition disposition, | 145 content::WebContents** contents); |
146 content::WebContents** contents); | |
147 | 146 |
148 // Returns true if |tab| has more than one navigation. If |tab| has more | 147 // Returns true if |tab| has more than one navigation. If |tab| has more |
149 // than one navigation |tab->current_navigation_index| is constrained based | 148 // than one navigation |tab->current_navigation_index| is constrained based |
150 // on the number of navigations. | 149 // on the number of navigations. |
151 static bool ValidateTab(Tab* tab); | 150 static bool ValidateTab(Tab* tab); |
152 | 151 |
153 // Validates all the tabs in a window, plus the window's active tab index. | 152 // Validates all the tabs in a window, plus the window's active tab index. |
154 static bool ValidateWindow(Window* window); | 153 static bool ValidateWindow(Window* window); |
155 | 154 |
156 // Returns true if |tab| is one we care about restoring. | 155 // Returns true if |tab| is one we care about restoring. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // corresponding BrowserClosed. We cache the set of delegates closing to | 190 // corresponding BrowserClosed. We cache the set of delegates closing to |
192 // avoid creating historical tabs for them. | 191 // avoid creating historical tabs for them. |
193 std::set<TabRestoreServiceDelegate*> closing_delegates_; | 192 std::set<TabRestoreServiceDelegate*> closing_delegates_; |
194 | 193 |
195 TimeFactory* const time_factory_; | 194 TimeFactory* const time_factory_; |
196 | 195 |
197 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); | 196 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); |
198 }; | 197 }; |
199 | 198 |
200 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ | 199 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ |
OLD | NEW |