| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 SessionID::id_type id, | 247 SessionID::id_type id, |
| 248 bool replace_existing_tab) { | 248 bool replace_existing_tab) { |
| 249 Entries::iterator i = GetEntryIteratorById(id); | 249 Entries::iterator i = GetEntryIteratorById(id); |
| 250 if (i == entries_.end()) { | 250 if (i == entries_.end()) { |
| 251 // Don't hoark here, we allow an invalid id. | 251 // Don't hoark here, we allow an invalid id. |
| 252 return; | 252 return; |
| 253 } | 253 } |
| 254 | 254 |
| 255 size_t index = 0; | 255 size_t index = 0; |
| 256 for (Entries::iterator j = entries_.begin(); j != i && j != entries_.end(); | 256 for (Entries::iterator j = entries_.begin(); j != i && j != entries_.end(); |
| 257 ++j, ++index); | 257 ++j, ++index) {} |
| 258 if (static_cast<int>(index) < entries_to_write_) | 258 if (static_cast<int>(index) < entries_to_write_) |
| 259 entries_to_write_--; | 259 entries_to_write_--; |
| 260 | 260 |
| 261 ScheduleCommand(CreateRestoredEntryCommand(id)); | 261 ScheduleCommand(CreateRestoredEntryCommand(id)); |
| 262 | 262 |
| 263 restoring_ = true; | 263 restoring_ = true; |
| 264 Entry* entry = *i; | 264 Entry* entry = *i; |
| 265 entries_.erase(i); | 265 entries_.erase(i); |
| 266 i = entries_.end(); | 266 i = entries_.end(); |
| 267 | 267 |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 // correctly write out the entries when Save is invoked (Save starts from | 940 // correctly write out the entries when Save is invoked (Save starts from |
| 941 // the front, not the end and we just added the entries to the end). | 941 // the front, not the end and we just added the entries to the end). |
| 942 entries_to_write_ = staging_entries_.size(); | 942 entries_to_write_ = staging_entries_.size(); |
| 943 | 943 |
| 944 PruneAndNotify(); | 944 PruneAndNotify(); |
| 945 } | 945 } |
| 946 | 946 |
| 947 Time TabRestoreService::TimeNow() const { | 947 Time TabRestoreService::TimeNow() const { |
| 948 return time_factory_ ? time_factory_->TimeNow() : Time::Now(); | 948 return time_factory_ ? time_factory_->TimeNow() : Time::Now(); |
| 949 } | 949 } |
| OLD | NEW |