OLD | NEW |
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 "chrome/browser/sessions/session_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 SessionRestoreImpl* restorer = new SessionRestoreImpl( | 766 SessionRestoreImpl* restorer = new SessionRestoreImpl( |
767 profile, browser, (behavior & SYNCHRONOUS) != 0, | 767 profile, browser, (behavior & SYNCHRONOUS) != 0, |
768 (behavior & CLOBBER_CURRENT_TAB) != 0, | 768 (behavior & CLOBBER_CURRENT_TAB) != 0, |
769 (behavior & ALWAYS_CREATE_TABBED_BROWSER) != 0, urls_to_open, | 769 (behavior & ALWAYS_CREATE_TABBED_BROWSER) != 0, urls_to_open, |
770 SessionRestore::on_session_restored_callbacks()); | 770 SessionRestore::on_session_restored_callbacks()); |
771 return restorer->Restore(); | 771 return restorer->Restore(); |
772 } | 772 } |
773 | 773 |
774 // static | 774 // static |
775 void SessionRestore::RestoreSessionAfterCrash(Browser* browser) { | 775 void SessionRestore::RestoreSessionAfterCrash(Browser* browser) { |
776 SessionRestore::BehaviorBitmask behavior = | 776 Profile* profile = browser->profile(); |
777 HasSingleNewTabPage(browser) ? SessionRestore::CLOBBER_CURRENT_TAB : 0; | 777 browser->window()->Close(); |
778 SessionRestore::RestoreSession(browser->profile(), browser, behavior, | 778 SessionRestore::RestoreSession(profile, nullptr, 0, std::vector<GURL>()); |
779 std::vector<GURL>()); | |
780 } | 779 } |
781 | 780 |
782 // static | 781 // static |
783 void SessionRestore::OpenStartupPagesAfterCrash(Browser* browser) { | 782 void SessionRestore::OpenStartupPagesAfterCrash(Browser* browser) { |
784 WebContents* tab_to_clobber = nullptr; | 783 WebContents* tab_to_clobber = nullptr; |
785 if (HasSingleNewTabPage(browser)) | 784 if (HasSingleNewTabPage(browser)) |
786 tab_to_clobber = browser->tab_strip_model()->GetActiveWebContents(); | 785 tab_to_clobber = browser->tab_strip_model()->GetActiveWebContents(); |
787 | 786 |
788 StartupBrowserCreator::OpenStartupPages(browser, true); | 787 StartupBrowserCreator::OpenStartupPages(browser, true); |
789 if (tab_to_clobber && browser->tab_strip_model()->count() > 1) | 788 if (tab_to_clobber && browser->tab_strip_model()->count() > 1) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 // static | 843 // static |
845 SessionRestore::CallbackSubscription | 844 SessionRestore::CallbackSubscription |
846 SessionRestore::RegisterOnSessionRestoredCallback( | 845 SessionRestore::RegisterOnSessionRestoredCallback( |
847 const base::Callback<void(int)>& callback) { | 846 const base::Callback<void(int)>& callback) { |
848 return on_session_restored_callbacks()->Add(callback); | 847 return on_session_restored_callbacks()->Add(callback); |
849 } | 848 } |
850 | 849 |
851 // static | 850 // static |
852 base::CallbackList<void(int)>* | 851 base::CallbackList<void(int)>* |
853 SessionRestore::on_session_restored_callbacks_ = nullptr; | 852 SessionRestore::on_session_restored_callbacks_ = nullptr; |
OLD | NEW |