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 <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/search/search.h" | 27 #include "chrome/browser/search/search.h" |
28 #include "chrome/browser/sessions/session_restore_delegate.h" | 28 #include "chrome/browser/sessions/session_restore_delegate.h" |
29 #include "chrome/browser/sessions/session_service.h" | 29 #include "chrome/browser/sessions/session_service.h" |
30 #include "chrome/browser/sessions/session_service_factory.h" | 30 #include "chrome/browser/sessions/session_service_factory.h" |
31 #include "chrome/browser/sessions/session_service_utils.h" | 31 #include "chrome/browser/sessions/session_service_utils.h" |
32 #include "chrome/browser/sessions/tab_loader.h" | 32 #include "chrome/browser/sessions/tab_loader.h" |
33 #include "chrome/browser/ui/browser.h" | 33 #include "chrome/browser/ui/browser.h" |
34 #include "chrome/browser/ui/browser_finder.h" | 34 #include "chrome/browser/ui/browser_finder.h" |
35 #include "chrome/browser/ui/browser_navigator.h" | 35 #include "chrome/browser/ui/browser_navigator.h" |
| 36 #include "chrome/browser/ui/browser_navigator_params.h" |
36 #include "chrome/browser/ui/browser_tabrestore.h" | 37 #include "chrome/browser/ui/browser_tabrestore.h" |
37 #include "chrome/browser/ui/browser_tabstrip.h" | 38 #include "chrome/browser/ui/browser_tabstrip.h" |
38 #include "chrome/browser/ui/browser_window.h" | 39 #include "chrome/browser/ui/browser_window.h" |
39 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 40 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
40 #include "chrome/common/extensions/extension_metrics.h" | 41 #include "chrome/common/extensions/extension_metrics.h" |
41 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
42 #include "components/sessions/core/session_types.h" | 43 #include "components/sessions/core/session_types.h" |
43 #include "content/public/browser/child_process_security_policy.h" | 44 #include "content/public/browser/child_process_security_policy.h" |
44 #include "content/public/browser/dom_storage_context.h" | 45 #include "content/public/browser/dom_storage_context.h" |
45 #include "content/public/browser/navigation_controller.h" | 46 #include "content/public/browser/navigation_controller.h" |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 profile, browser, host_desktop_type, (behavior & SYNCHRONOUS) != 0, | 773 profile, browser, host_desktop_type, (behavior & SYNCHRONOUS) != 0, |
773 (behavior & CLOBBER_CURRENT_TAB) != 0, | 774 (behavior & CLOBBER_CURRENT_TAB) != 0, |
774 (behavior & ALWAYS_CREATE_TABBED_BROWSER) != 0, | 775 (behavior & ALWAYS_CREATE_TABBED_BROWSER) != 0, |
775 urls_to_open, | 776 urls_to_open, |
776 SessionRestore::on_session_restored_callbacks()); | 777 SessionRestore::on_session_restored_callbacks()); |
777 return restorer->Restore(); | 778 return restorer->Restore(); |
778 } | 779 } |
779 | 780 |
780 // static | 781 // static |
781 void SessionRestore::RestoreSessionAfterCrash(Browser* browser) { | 782 void SessionRestore::RestoreSessionAfterCrash(Browser* browser) { |
782 uint32 behavior = 0; | 783 uint32 behavior = 0; |
783 if (browser->tab_strip_model()->count() == 1) { | 784 if (browser->tab_strip_model()->count() == 1) { |
784 const content::WebContents* active_tab = | 785 const content::WebContents* active_tab = |
785 browser->tab_strip_model()->GetWebContentsAt(0); | 786 browser->tab_strip_model()->GetWebContentsAt(0); |
786 if (active_tab->GetURL() == GURL(chrome::kChromeUINewTabURL) || | 787 if (active_tab->GetURL() == GURL(chrome::kChromeUINewTabURL) || |
787 search::IsInstantNTP(active_tab)) { | 788 search::IsInstantNTP(active_tab)) { |
788 // There is only one tab and its the new tab page, make session restore | 789 // There is only one tab and its the new tab page, make session restore |
789 // clobber it. | 790 // clobber it. |
790 behavior = SessionRestore::CLOBBER_CURRENT_TAB; | 791 behavior = SessionRestore::CLOBBER_CURRENT_TAB; |
791 } | 792 } |
792 } | 793 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 if (prioritize_tabs == "mru") | 863 if (prioritize_tabs == "mru") |
863 return SMART_RESTORE_MODE_MRU; | 864 return SMART_RESTORE_MODE_MRU; |
864 if (prioritize_tabs == "simple") | 865 if (prioritize_tabs == "simple") |
865 return SMART_RESTORE_MODE_SIMPLE; | 866 return SMART_RESTORE_MODE_SIMPLE; |
866 return SMART_RESTORE_MODE_OFF; | 867 return SMART_RESTORE_MODE_OFF; |
867 } | 868 } |
868 | 869 |
869 // static | 870 // static |
870 base::CallbackList<void(int)>* | 871 base::CallbackList<void(int)>* |
871 SessionRestore::on_session_restored_callbacks_ = nullptr; | 872 SessionRestore::on_session_restored_callbacks_ = nullptr; |
OLD | NEW |