| 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/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 browser->SelectTabContentsAt(browser->tab_count() - 1, true); | 352 browser->SelectTabContentsAt(browser->tab_count() - 1, true); |
| 353 return; | 353 return; |
| 354 } | 354 } |
| 355 | 355 |
| 356 DCHECK(browser); | 356 DCHECK(browser); |
| 357 DCHECK(browser->tab_count()); | 357 DCHECK(browser->tab_count()); |
| 358 browser->SelectTabContentsAt( | 358 browser->SelectTabContentsAt( |
| 359 std::min(initial_tab_count + std::max(0, selected_session_index), | 359 std::min(initial_tab_count + std::max(0, selected_session_index), |
| 360 browser->tab_count() - 1), true); | 360 browser->tab_count() - 1), true); |
| 361 browser->window()->Show(); | 361 browser->window()->Show(); |
| 362 // Showing the browser focuses the location bar, let the tab decide where | 362 // TODO(jcampan): http://crbug.com/8123 we should not need to set the |
| 363 // it wants the focus to be. | 363 // initial focus explicitly. |
| 364 browser->GetSelectedTabContents()->SetInitialFocus(); | 364 browser->GetSelectedTabContents()->SetInitialFocus(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void AppendURLsToBrowser(Browser* browser, const std::vector<GURL>& urls) { | 367 void AppendURLsToBrowser(Browser* browser, const std::vector<GURL>& urls) { |
| 368 for (size_t i = 0; i < urls.size(); ++i) { | 368 for (size_t i = 0; i < urls.size(); ++i) { |
| 369 browser->AddTabWithURL(urls[i], GURL(), PageTransition::START_PAGE, | 369 browser->AddTabWithURL(urls[i], GURL(), PageTransition::START_PAGE, |
| 370 (i == 0), NULL); | 370 (i == 0), NULL); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 Restore(profile, browser, false, clobber_existing_window, | 447 Restore(profile, browser, false, clobber_existing_window, |
| 448 always_create_tabbed_browser, urls_to_open); | 448 always_create_tabbed_browser, urls_to_open); |
| 449 } | 449 } |
| 450 | 450 |
| 451 // static | 451 // static |
| 452 void SessionRestore::RestoreSessionSynchronously( | 452 void SessionRestore::RestoreSessionSynchronously( |
| 453 Profile* profile, | 453 Profile* profile, |
| 454 const std::vector<GURL>& urls_to_open) { | 454 const std::vector<GURL>& urls_to_open) { |
| 455 Restore(profile, NULL, true, false, true, urls_to_open); | 455 Restore(profile, NULL, true, false, true, urls_to_open); |
| 456 } | 456 } |
| OLD | NEW |