| 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/session_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 int selected_index = tab.current_navigation_index; | 327 int selected_index = tab.current_navigation_index; |
| 328 selected_index = std::max( | 328 selected_index = std::max( |
| 329 0, | 329 0, |
| 330 std::min(selected_index, | 330 std::min(selected_index, |
| 331 static_cast<int>(tab.navigations.size() - 1))); | 331 static_cast<int>(tab.navigations.size() - 1))); |
| 332 tab_loader_->AddTab( | 332 tab_loader_->AddTab( |
| 333 &browser->AddRestoredTab(tab.navigations, | 333 &browser->AddRestoredTab(tab.navigations, |
| 334 static_cast<int>(i - window.tabs.begin()), | 334 static_cast<int>(i - window.tabs.begin()), |
| 335 selected_index, | 335 selected_index, |
| 336 false, | 336 false, |
| 337 tab.pinned)->controller()); | 337 tab.pinned, |
| 338 true)->controller()); |
| 338 } | 339 } |
| 339 } | 340 } |
| 340 | 341 |
| 341 void ShowBrowser(Browser* browser, | 342 void ShowBrowser(Browser* browser, |
| 342 int initial_tab_count, | 343 int initial_tab_count, |
| 343 int selected_session_index) { | 344 int selected_session_index) { |
| 344 if (browser_ == browser) { | 345 if (browser_ == browser) { |
| 345 browser->SelectTabContentsAt(browser->tab_count() - 1, true); | 346 browser->SelectTabContentsAt(browser->tab_count() - 1, true); |
| 346 return; | 347 return; |
| 347 } | 348 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 Restore(profile, browser, false, clobber_existing_window, | 459 Restore(profile, browser, false, clobber_existing_window, |
| 459 always_create_tabbed_browser, urls_to_open); | 460 always_create_tabbed_browser, urls_to_open); |
| 460 } | 461 } |
| 461 | 462 |
| 462 // static | 463 // static |
| 463 void SessionRestore::RestoreSessionSynchronously( | 464 void SessionRestore::RestoreSessionSynchronously( |
| 464 Profile* profile, | 465 Profile* profile, |
| 465 const std::vector<GURL>& urls_to_open) { | 466 const std::vector<GURL>& urls_to_open) { |
| 466 Restore(profile, NULL, true, false, true, urls_to_open); | 467 Restore(profile, NULL, true, false, true, urls_to_open); |
| 467 } | 468 } |
| OLD | NEW |