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

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

Issue 8677030: base::Bind: Convert more of chrome/browser/sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/sessions/tab_restore_service.h" 5 #include "chrome/browser/sessions/tab_restore_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 10
11 #include "base/bind.h"
12 #include "base/bind_helpers.h"
11 #include "base/callback.h" 13 #include "base/callback.h"
12 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
13 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
14 #include "base/stl_util.h" 16 #include "base/stl_util.h"
15 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/extension_tab_helper.h" 18 #include "chrome/browser/extensions/extension_tab_helper.h"
17 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/sessions/session_service.h" 20 #include "chrome/browser/sessions/session_service.h"
19 #include "chrome/browser/sessions/session_service_factory.h" 21 #include "chrome/browser/sessions/session_service_factory.h"
20 #include "chrome/browser/sessions/session_command.h" 22 #include "chrome/browser/sessions/session_command.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 NewCallback(this, &TabRestoreService::OnGotPreviousSession)); 434 NewCallback(this, &TabRestoreService::OnGotPreviousSession));
433 } else { 435 } else {
434 load_state_ |= LOADED_LAST_SESSION; 436 load_state_ |= LOADED_LAST_SESSION;
435 } 437 }
436 438
437 // Request the tabs closed in the last session. If the last session crashed, 439 // Request the tabs closed in the last session. If the last session crashed,
438 // this won't contain the tabs/window that were open at the point of the 440 // this won't contain the tabs/window that were open at the point of the
439 // crash (the call to GetLastSession above requests those). 441 // crash (the call to GetLastSession above requests those).
440 ScheduleGetLastSessionCommands( 442 ScheduleGetLastSessionCommands(
441 new InternalGetCommandsRequest( 443 new InternalGetCommandsRequest(
442 NewCallback(this, &TabRestoreService::OnGotLastSessionCommands)), 444 base::Bind(&TabRestoreService::OnGotLastSessionCommands,
445 base::Unretained(this))),
443 &load_consumer_); 446 &load_consumer_);
444 } 447 }
445 448
446 void TabRestoreService::Save() { 449 void TabRestoreService::Save() {
447 int to_write_count = std::min(entries_to_write_, 450 int to_write_count = std::min(entries_to_write_,
448 static_cast<int>(entries_.size())); 451 static_cast<int>(entries_.size()));
449 entries_to_write_ = 0; 452 entries_to_write_ = 0;
450 if (entries_written_ + to_write_count > kEntriesPerReset) { 453 if (entries_written_ + to_write_count > kEntriesPerReset) {
451 to_write_count = entries_.size(); 454 to_write_count = entries_.size();
452 set_pending_reset(true); 455 set_pending_reset(true);
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 // correctly write out the entries when Save is invoked (Save starts from 1088 // correctly write out the entries when Save is invoked (Save starts from
1086 // the front, not the end and we just added the entries to the end). 1089 // the front, not the end and we just added the entries to the end).
1087 entries_to_write_ = staging_entries_.size(); 1090 entries_to_write_ = staging_entries_.size();
1088 1091
1089 PruneAndNotify(); 1092 PruneAndNotify();
1090 } 1093 }
1091 1094
1092 Time TabRestoreService::TimeNow() const { 1095 Time TabRestoreService::TimeNow() const {
1093 return time_factory_ ? time_factory_->TimeNow() : Time::Now(); 1096 return time_factory_ ? time_factory_->TimeNow() : Time::Now();
1094 } 1097 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698