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

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

Issue 7931027: Refactoring recently closed tab filtering (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Implementing reviewer feedback Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_H_ 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_
6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <set> 10 #include <set>
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Max number of entries we'll keep around. 166 // Max number of entries we'll keep around.
167 static const size_t kMaxEntries; 167 static const size_t kMaxEntries;
168 168
169 // Creates and add entries to |entries| for each of the windows in |windows|. 169 // Creates and add entries to |entries| for each of the windows in |windows|.
170 void CreateEntriesFromWindows(std::vector<SessionWindow*>* windows, 170 void CreateEntriesFromWindows(std::vector<SessionWindow*>* windows,
171 std::vector<Entry*>* entries); 171 std::vector<Entry*>* entries);
172 172
173 protected: 173 protected:
174 virtual void Save(); 174 virtual void Save();
175 175
176 // Set of entries.
177 Entries entries_;
noyau (Ping after 24h) 2011/09/20 15:46:58 I had to move the entries to be protected in order
sky 2011/09/20 16:24:46 Use entries() instead of making this field protect
noyau (Ping after 24h) 2011/09/20 17:09:35 Reverted as this class is no longer mocked.
178
176 private: 179 private:
177 // Used to indicate what has loaded. 180 // Used to indicate what has loaded.
178 enum LoadState { 181 enum LoadState {
179 // Indicates we haven't loaded anything. 182 // Indicates we haven't loaded anything.
180 NOT_LOADED = 1 << 0, 183 NOT_LOADED = 1 << 0,
181 184
182 // Indicates we've asked for the last sessions and tabs but haven't gotten 185 // Indicates we've asked for the last sessions and tabs but haven't gotten
183 // the result back yet. 186 // the result back yet.
184 LOADING = 1 << 2, 187 LOADING = 1 << 2,
185 188
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 Window* window); 296 Window* window);
294 297
295 // Invoked when previous tabs or session is loaded. If both have finished 298 // Invoked when previous tabs or session is loaded. If both have finished
296 // loading the entries in staging_entries_ are added to entries_ and 299 // loading the entries in staging_entries_ are added to entries_ and
297 // observers are notified. 300 // observers are notified.
298 void LoadStateChanged(); 301 void LoadStateChanged();
299 302
300 // Gets the current time. This uses the time_factory_ if there is one. 303 // Gets the current time. This uses the time_factory_ if there is one.
301 base::Time TimeNow() const; 304 base::Time TimeNow() const;
302 305
303 // Set of entries.
304 Entries entries_;
305
306 // Whether we've loaded the last session. 306 // Whether we've loaded the last session.
307 int load_state_; 307 int load_state_;
308 308
309 // Are we restoring a tab? If this is true we ignore requests to create a 309 // Are we restoring a tab? If this is true we ignore requests to create a
310 // historical tab. 310 // historical tab.
311 bool restoring_; 311 bool restoring_;
312 312
313 // Have the max number of entries ever been created? 313 // Have the max number of entries ever been created?
314 bool reached_max_; 314 bool reached_max_;
315 315
(...skipping 21 matching lines...) Expand all
337 // loading LoadStateChanged is invoked, which adds these entries to 337 // loading LoadStateChanged is invoked, which adds these entries to
338 // entries_. 338 // entries_.
339 std::vector<Entry*> staging_entries_; 339 std::vector<Entry*> staging_entries_;
340 340
341 TimeFactory* time_factory_; 341 TimeFactory* time_factory_;
342 342
343 DISALLOW_COPY_AND_ASSIGN(TabRestoreService); 343 DISALLOW_COPY_AND_ASSIGN(TabRestoreService);
344 }; 344 };
345 345
346 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ 346 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698