Chromium Code Reviews| 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 #include <vector> | |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "chrome/browser/sessions/session_id.h" | 14 #include "chrome/browser/sessions/session_id.h" |
| 14 #include "chrome/browser/sessions/session_types.h" | 15 #include "chrome/browser/sessions/session_types.h" |
| 15 #include "chrome/browser/sessions/tab_restore_service.h" | 16 #include "chrome/browser/sessions/tab_restore_service.h" |
| 16 #include "chrome/browser/ui/host_desktop.h" | 17 #include "chrome/browser/ui/host_desktop.h" |
| 17 | 18 |
| 18 class Profile; | 19 class Profile; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 ~TabRestoreServiceHelper(); | 73 ~TabRestoreServiceHelper(); |
| 73 | 74 |
| 74 // Helper methods used to implement TabRestoreService. | 75 // Helper methods used to implement TabRestoreService. |
| 75 void AddObserver(TabRestoreServiceObserver* observer); | 76 void AddObserver(TabRestoreServiceObserver* observer); |
| 76 void RemoveObserver(TabRestoreServiceObserver* observer); | 77 void RemoveObserver(TabRestoreServiceObserver* observer); |
| 77 void CreateHistoricalTab(content::WebContents* contents, int index); | 78 void CreateHistoricalTab(content::WebContents* contents, int index); |
| 78 void BrowserClosing(TabRestoreServiceDelegate* delegate); | 79 void BrowserClosing(TabRestoreServiceDelegate* delegate); |
| 79 void BrowserClosed(TabRestoreServiceDelegate* delegate); | 80 void BrowserClosed(TabRestoreServiceDelegate* delegate); |
| 80 void ClearEntries(); | 81 void ClearEntries(); |
| 81 const Entries& entries() const; | 82 const Entries& entries() const; |
| 82 void RestoreMostRecentEntry(TabRestoreServiceDelegate* delegate, | 83 std::vector<content::WebContents*> RestoreMostRecentEntry( |
| 83 chrome::HostDesktopType host_desktop_type); | 84 TabRestoreServiceDelegate* delegate, |
| 85 chrome::HostDesktopType host_desktop_type); | |
| 84 Tab* RemoveTabEntryById(SessionID::id_type id); | 86 Tab* RemoveTabEntryById(SessionID::id_type id); |
| 85 void RestoreEntryById(TabRestoreServiceDelegate* delegate, | 87 std::vector<content::WebContents*> RestoreEntryById( |
| 86 SessionID::id_type id, | 88 TabRestoreServiceDelegate* delegate, |
| 87 chrome::HostDesktopType host_desktop_type, | 89 SessionID::id_type id, |
| 88 WindowOpenDisposition disposition); | 90 chrome::HostDesktopType host_desktop_type, |
| 91 WindowOpenDisposition disposition); | |
| 89 | 92 |
| 90 // Notifies observers the tabs have changed. | 93 // Notifies observers the tabs have changed. |
| 91 void NotifyTabsChanged(); | 94 void NotifyTabsChanged(); |
| 92 | 95 |
| 93 // Notifies observers the service has loaded. | 96 // Notifies observers the service has loaded. |
| 94 void NotifyLoaded(); | 97 void NotifyLoaded(); |
| 95 | 98 |
| 96 // Adds |entry| to the list of entries and takes ownership. If |prune| is true | 99 // 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 | 100 // |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 | 101 // 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 | 129 // tab. If |delegate| is NULL, this creates a new window for the entry. This |
| 127 // returns the TabRestoreServiceDelegate into which the tab was restored. | 130 // returns the TabRestoreServiceDelegate into which the tab was restored. |
| 128 // |disposition| will be respected, but if it is UNKNOWN then the tab's | 131 // |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 | 132 // 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 | 133 // created for this tab, it will be created on the desktop specified by |
| 131 // |host_desktop_type|. | 134 // |host_desktop_type|. |
| 132 TabRestoreServiceDelegate* RestoreTab( | 135 TabRestoreServiceDelegate* RestoreTab( |
| 133 const Tab& tab, | 136 const Tab& tab, |
| 134 TabRestoreServiceDelegate* delegate, | 137 TabRestoreServiceDelegate* delegate, |
| 135 chrome::HostDesktopType host_desktop_type, | 138 chrome::HostDesktopType host_desktop_type, |
| 136 WindowOpenDisposition disposition); | 139 WindowOpenDisposition disposition, |
| 140 content::WebContents** contents); | |
|
sky
2013/08/05 16:16:17
Document |contents|.
Kristen Dwan
2013/08/05 18:01:38
Done.
| |
| 137 | 141 |
| 138 // Returns true if |tab| has more than one navigation. If |tab| has more | 142 // Returns true if |tab| has more than one navigation. If |tab| has more |
| 139 // than one navigation |tab->current_navigation_index| is constrained based | 143 // than one navigation |tab->current_navigation_index| is constrained based |
| 140 // on the number of navigations. | 144 // on the number of navigations. |
| 141 static bool ValidateTab(Tab* tab); | 145 static bool ValidateTab(Tab* tab); |
| 142 | 146 |
| 143 // Validates all the tabs in a window, plus the window's active tab index. | 147 // Validates all the tabs in a window, plus the window's active tab index. |
| 144 static bool ValidateWindow(Window* window); | 148 static bool ValidateWindow(Window* window); |
| 145 | 149 |
| 146 // Returns true if |tab| is one we care about restoring. | 150 // 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 | 183 // corresponding BrowserClosed. We cache the set of delegates closing to |
| 180 // avoid creating historical tabs for them. | 184 // avoid creating historical tabs for them. |
| 181 std::set<TabRestoreServiceDelegate*> closing_delegates_; | 185 std::set<TabRestoreServiceDelegate*> closing_delegates_; |
| 182 | 186 |
| 183 TimeFactory* const time_factory_; | 187 TimeFactory* const time_factory_; |
| 184 | 188 |
| 185 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); | 189 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); |
| 186 }; | 190 }; |
| 187 | 191 |
| 188 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ | 192 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ |
| OLD | NEW |