| 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 // static | 410 // static |
| 411 size_t SessionRestore::num_tabs_to_load_ = 0; | 411 size_t SessionRestore::num_tabs_to_load_ = 0; |
| 412 | 412 |
| 413 static void Restore(Profile* profile, | 413 static void Restore(Profile* profile, |
| 414 Browser* browser, | 414 Browser* browser, |
| 415 bool synchronous, | 415 bool synchronous, |
| 416 bool clobber_existing_window, | 416 bool clobber_existing_window, |
| 417 bool always_create_tabbed_browser, | 417 bool always_create_tabbed_browser, |
| 418 const std::vector<GURL>& urls_to_open) { | 418 const std::vector<GURL>& urls_to_open) { |
| 419 DCHECK(profile); | 419 DCHECK(profile); |
| 420 if (!profile->GetSessionService()) | 420 // Always restore from the original profile (incognito profiles have no |
| 421 // session service). |
| 422 profile = profile->GetOriginalProfile(); |
| 423 if (!profile->GetSessionService()) { |
| 424 NOTREACHED(); |
| 421 return; | 425 return; |
| 426 } |
| 422 // SessionRestoreImpl takes care of deleting itself when done. | 427 // SessionRestoreImpl takes care of deleting itself when done. |
| 423 SessionRestoreImpl* restorer = | 428 SessionRestoreImpl* restorer = |
| 424 new SessionRestoreImpl(profile, browser, synchronous, | 429 new SessionRestoreImpl(profile, browser, synchronous, |
| 425 clobber_existing_window, | 430 clobber_existing_window, |
| 426 always_create_tabbed_browser, urls_to_open); | 431 always_create_tabbed_browser, urls_to_open); |
| 427 restorer->Restore(); | 432 restorer->Restore(); |
| 428 } | 433 } |
| 429 | 434 |
| 430 // static | 435 // static |
| 431 void SessionRestore::RestoreSession(Profile* profile, | 436 void SessionRestore::RestoreSession(Profile* profile, |
| 432 Browser* browser, | 437 Browser* browser, |
| 433 bool clobber_existing_window, | 438 bool clobber_existing_window, |
| 434 bool always_create_tabbed_browser, | 439 bool always_create_tabbed_browser, |
| 435 const std::vector<GURL>& urls_to_open) { | 440 const std::vector<GURL>& urls_to_open) { |
| 436 Restore(profile, browser, false, clobber_existing_window, | 441 Restore(profile, browser, false, clobber_existing_window, |
| 437 always_create_tabbed_browser, urls_to_open); | 442 always_create_tabbed_browser, urls_to_open); |
| 438 } | 443 } |
| 439 | 444 |
| 440 // static | 445 // static |
| 441 void SessionRestore::RestoreSessionSynchronously( | 446 void SessionRestore::RestoreSessionSynchronously( |
| 442 Profile* profile, | 447 Profile* profile, |
| 443 const std::vector<GURL>& urls_to_open) { | 448 const std::vector<GURL>& urls_to_open) { |
| 444 Restore(profile, NULL, true, false, true, urls_to_open); | 449 Restore(profile, NULL, true, false, true, urls_to_open); |
| 445 } | 450 } |
| OLD | NEW |