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

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

Issue 21656002: Return webcontents and add in test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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_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
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 22 matching lines...) Expand all
121 int index, 124 int index,
122 TabRestoreServiceDelegate* delegate, 125 TabRestoreServiceDelegate* delegate,
123 content::NavigationController* controller); 126 content::NavigationController* controller);
124 127
125 // This is a helper function for RestoreEntryById() for restoring a single 128 // This is a helper function for RestoreEntryById() for restoring a single
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|. If present, |contents| will be populated with the
135 // WebContents of the restored tab.
132 TabRestoreServiceDelegate* RestoreTab( 136 TabRestoreServiceDelegate* RestoreTab(
133 const Tab& tab, 137 const Tab& tab,
134 TabRestoreServiceDelegate* delegate, 138 TabRestoreServiceDelegate* delegate,
135 chrome::HostDesktopType host_desktop_type, 139 chrome::HostDesktopType host_desktop_type,
136 WindowOpenDisposition disposition); 140 WindowOpenDisposition disposition,
141 content::WebContents** contents);
137 142
138 // Returns true if |tab| has more than one navigation. If |tab| has more 143 // Returns true if |tab| has more than one navigation. If |tab| has more
139 // than one navigation |tab->current_navigation_index| is constrained based 144 // than one navigation |tab->current_navigation_index| is constrained based
140 // on the number of navigations. 145 // on the number of navigations.
141 static bool ValidateTab(Tab* tab); 146 static bool ValidateTab(Tab* tab);
142 147
143 // Validates all the tabs in a window, plus the window's active tab index. 148 // Validates all the tabs in a window, plus the window's active tab index.
144 static bool ValidateWindow(Window* window); 149 static bool ValidateWindow(Window* window);
145 150
146 // Returns true if |tab| is one we care about restoring. 151 // Returns true if |tab| is one we care about restoring.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // corresponding BrowserClosed. We cache the set of delegates closing to 184 // corresponding BrowserClosed. We cache the set of delegates closing to
180 // avoid creating historical tabs for them. 185 // avoid creating historical tabs for them.
181 std::set<TabRestoreServiceDelegate*> closing_delegates_; 186 std::set<TabRestoreServiceDelegate*> closing_delegates_;
182 187
183 TimeFactory* const time_factory_; 188 TimeFactory* const time_factory_;
184 189
185 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); 190 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper);
186 }; 191 };
187 192
188 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_ 193 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sessions/tab_restore_service_delegate.h ('k') | chrome/browser/sessions/tab_restore_service_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698