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

Side by Side Diff: components/sessions/core/tab_restore_service_helper.cc

Issue 1309323004: Create a NavigationEntry for the initial blank page. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GetEntryCount, more tests Created 5 years, 2 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
« no previous file with comments | « components/sessions/core/live_tab.h ('k') | components/sessions/ios/ios_live_tab.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "components/sessions/core/tab_restore_service_helper.h" 5 #include "components/sessions/core/tab_restore_service_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 NOTREACHED(); 354 NOTREACHED();
355 return false; 355 return false;
356 } 356 }
357 357
358 void TabRestoreServiceHelper::PopulateTab(Tab* tab, 358 void TabRestoreServiceHelper::PopulateTab(Tab* tab,
359 int index, 359 int index,
360 LiveTabContext* context, 360 LiveTabContext* context,
361 LiveTab* live_tab) { 361 LiveTab* live_tab) {
362 const int pending_index = live_tab->GetPendingEntryIndex(); 362 const int pending_index = live_tab->GetPendingEntryIndex();
363 int entry_count = 363 int entry_count =
364 live_tab->IsInitialNavigation() ? 0 : live_tab->GetEntryCount(); 364 live_tab->IsInitialBlankNavigation() ? 0 : live_tab->GetEntryCount();
365 if (entry_count == 0 && pending_index == 0) 365 if (entry_count == 0 && pending_index == 0)
366 entry_count++; 366 entry_count++;
367 tab->navigations.resize(static_cast<int>(entry_count)); 367 tab->navigations.resize(static_cast<int>(entry_count));
368 for (int i = 0; i < entry_count; ++i) { 368 for (int i = 0; i < entry_count; ++i) {
369 SerializedNavigationEntry entry = (i == pending_index) 369 SerializedNavigationEntry entry = (i == pending_index)
370 ? live_tab->GetPendingEntry() 370 ? live_tab->GetPendingEntry()
371 : live_tab->GetEntryAtIndex(i); 371 : live_tab->GetEntryAtIndex(i);
372 tab->navigations[i] = entry; 372 tab->navigations[i] = entry;
373 } 373 }
374 tab->timestamp = TimeNow(); 374 tab->timestamp = TimeNow();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 tab->browser_id = new_id; 525 tab->browser_id = new_id;
526 } 526 }
527 } 527 }
528 } 528 }
529 529
530 base::Time TabRestoreServiceHelper::TimeNow() const { 530 base::Time TabRestoreServiceHelper::TimeNow() const {
531 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); 531 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now();
532 } 532 }
533 533
534 } // namespace sessions 534 } // namespace sessions
OLDNEW
« no previous file with comments | « components/sessions/core/live_tab.h ('k') | components/sessions/ios/ios_live_tab.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698