OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/platform_file.h" | 18 #include "base/platform_file.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/sessions/session_service.h" | 24 #include "chrome/browser/sessions/session_service.h" |
25 #include "chrome/browser/sessions/session_service_factory.h" | 25 #include "chrome/browser/sessions/session_service_factory.h" |
26 #include "chrome/browser/sessions/session_types.h" | 26 #include "chrome/browser/sessions/session_types.h" |
27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
29 #include "chrome/browser/ui/browser_navigator.h" | 29 #include "chrome/browser/ui/browser_navigator.h" |
| 30 #include "chrome/browser/ui/browser_tabrestore.h" |
| 31 #include "chrome/browser/ui/browser_tabstrip.h" |
30 #include "chrome/browser/ui/browser_window.h" | 32 #include "chrome/browser/ui/browser_window.h" |
31 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 33 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
32 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 34 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
33 #include "chrome/common/chrome_notification_types.h" | 35 #include "chrome/common/chrome_notification_types.h" |
34 #include "content/public/browser/child_process_security_policy.h" | 36 #include "content/public/browser/child_process_security_policy.h" |
35 #include "content/public/browser/dom_storage_context.h" | 37 #include "content/public/browser/dom_storage_context.h" |
36 #include "content/public/browser/navigation_controller.h" | 38 #include "content/public/browser/navigation_controller.h" |
37 #include "content/public/browser/notification_registrar.h" | 39 #include "content/public/browser/notification_registrar.h" |
38 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
39 #include "content/public/browser/render_process_host.h" | 41 #include "content/public/browser/render_process_host.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 NavigationController* tab = tabs_to_load_.front(); | 262 NavigationController* tab = tabs_to_load_.front(); |
261 DCHECK(tab); | 263 DCHECK(tab); |
262 tabs_loading_.insert(tab); | 264 tabs_loading_.insert(tab); |
263 if (tabs_loading_.size() > max_parallel_tab_loads_) | 265 if (tabs_loading_.size() > max_parallel_tab_loads_) |
264 max_parallel_tab_loads_ = tabs_loading_.size(); | 266 max_parallel_tab_loads_ = tabs_loading_.size(); |
265 tabs_to_load_.pop_front(); | 267 tabs_to_load_.pop_front(); |
266 tab->LoadIfNecessary(); | 268 tab->LoadIfNecessary(); |
267 content::WebContents* contents = tab->GetWebContents(); | 269 content::WebContents* contents = tab->GetWebContents(); |
268 if (contents) { | 270 if (contents) { |
269 Browser* browser = browser::FindBrowserWithWebContents(contents); | 271 Browser* browser = browser::FindBrowserWithWebContents(contents); |
270 if (browser && browser->GetActiveWebContents() != contents) { | 272 if (browser && chrome::GetActiveWebContents(browser) != contents) { |
271 // By default tabs are marked as visible. As only the active tab is | 273 // By default tabs are marked as visible. As only the active tab is |
272 // visible we need to explicitly tell non-active tabs they are hidden. | 274 // visible we need to explicitly tell non-active tabs they are hidden. |
273 // Without this call non-active tabs are not marked as backgrounded. | 275 // Without this call non-active tabs are not marked as backgrounded. |
274 // | 276 // |
275 // NOTE: We need to do this here rather than when the tab is added to | 277 // NOTE: We need to do this here rather than when the tab is added to |
276 // the Browser as at that time not everything has been created, so that | 278 // the Browser as at that time not everything has been created, so that |
277 // the call would do nothing. | 279 // the call would do nothing. |
278 contents->WasHidden(); | 280 contents->WasHidden(); |
279 } | 281 } |
280 } | 282 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 // Restore and show the browser. | 549 // Restore and show the browser. |
548 const int initial_tab_count = 0; | 550 const int initial_tab_count = 0; |
549 int selected_tab_index = std::max( | 551 int selected_tab_index = std::max( |
550 0, | 552 0, |
551 std::min((*i)->selected_tab_index, | 553 std::min((*i)->selected_tab_index, |
552 static_cast<int>((*i)->tabs.size()) - 1)); | 554 static_cast<int>((*i)->tabs.size()) - 1)); |
553 selected_tab_index = | 555 selected_tab_index = |
554 RestoreTabsToBrowser(*(*i), browser, selected_tab_index); | 556 RestoreTabsToBrowser(*(*i), browser, selected_tab_index); |
555 ShowBrowser(browser, selected_tab_index); | 557 ShowBrowser(browser, selected_tab_index); |
556 tab_loader_->TabIsLoading( | 558 tab_loader_->TabIsLoading( |
557 &browser->GetActiveWebContents()->GetController()); | 559 &chrome::GetActiveWebContents(browser)->GetController()); |
558 NotifySessionServiceOfRestoredTabs(browser, initial_tab_count); | 560 NotifySessionServiceOfRestoredTabs(browser, initial_tab_count); |
559 } | 561 } |
560 | 562 |
561 // Always create in a new window | 563 // Always create in a new window |
562 FinishedTabCreation(true, true); | 564 FinishedTabCreation(true, true); |
563 } | 565 } |
564 | 566 |
565 // Restore a single tab from a foreign session. | 567 // Restore a single tab from a foreign session. |
566 // Opens in the tab in the last active browser, unless disposition is | 568 // Opens in the tab in the last active browser, unless disposition is |
567 // NEW_WINDOW, in which case the tab will be opened in a new browser. | 569 // NEW_WINDOW, in which case the tab will be opened in a new browser. |
568 void RestoreForeignTab(const SessionTab& tab, | 570 void RestoreForeignTab(const SessionTab& tab, |
569 WindowOpenDisposition disposition) { | 571 WindowOpenDisposition disposition) { |
570 DCHECK(!tab.navigations.empty()); | 572 DCHECK(!tab.navigations.empty()); |
571 int selected_index = tab.current_navigation_index; | 573 int selected_index = tab.current_navigation_index; |
572 selected_index = std::max( | 574 selected_index = std::max( |
573 0, | 575 0, |
574 std::min(selected_index, | 576 std::min(selected_index, |
575 static_cast<int>(tab.navigations.size() - 1))); | 577 static_cast<int>(tab.navigations.size() - 1))); |
576 | 578 |
577 bool use_new_window = disposition == NEW_WINDOW; | 579 bool use_new_window = disposition == NEW_WINDOW; |
578 | 580 |
579 Browser* browser = use_new_window ? Browser::Create(profile_) : browser_; | 581 Browser* browser = use_new_window ? Browser::Create(profile_) : browser_; |
580 | 582 |
581 RecordAppLaunchForTab(browser, tab, selected_index); | 583 RecordAppLaunchForTab(browser, tab, selected_index); |
582 | 584 |
583 if (disposition == CURRENT_TAB) { | 585 if (disposition == CURRENT_TAB) { |
584 DCHECK(!use_new_window); | 586 DCHECK(!use_new_window); |
585 browser->ReplaceRestoredTab(tab.navigations, | 587 chrome::ReplaceRestoredTab(browser, |
586 selected_index, | 588 tab.navigations, |
587 true, | 589 selected_index, |
588 tab.extension_app_id, | 590 true, |
589 NULL); | 591 tab.extension_app_id, |
| 592 NULL); |
590 } else { | 593 } else { |
591 int tab_index = use_new_window ? 0 : browser->active_index() + 1; | 594 int tab_index = use_new_window ? 0 : browser->active_index() + 1; |
592 WebContents* web_contents = browser->AddRestoredTab( | 595 WebContents* web_contents = chrome::AddRestoredTab( |
| 596 browser, |
593 tab.navigations, | 597 tab.navigations, |
594 tab_index, | 598 tab_index, |
595 selected_index, | 599 selected_index, |
596 tab.extension_app_id, | 600 tab.extension_app_id, |
597 false, // selected | 601 false, // selected |
598 tab.pinned, | 602 tab.pinned, |
599 true, | 603 true, |
600 NULL); | 604 NULL); |
601 // Start loading the tab immediately. | 605 // Start loading the tab immediately. |
602 web_contents->GetController().LoadIfNecessary(); | 606 web_contents->GetController().LoadIfNecessary(); |
603 } | 607 } |
604 | 608 |
605 if (use_new_window) { | 609 if (use_new_window) { |
606 browser->ActivateTabAt(0, true); | 610 chrome::ActivateTabAt(browser, 0, true); |
607 browser->window()->Show(); | 611 browser->window()->Show(); |
608 } | 612 } |
609 NotifySessionServiceOfRestoredTabs(browser, browser->tab_count()); | 613 NotifySessionServiceOfRestoredTabs(browser, browser->tab_count()); |
610 | 614 |
611 // Since FinishedTabCreation() is not called here, |this| will leak if we | 615 // Since FinishedTabCreation() is not called here, |this| will leak if we |
612 // are not in sychronous mode. | 616 // are not in sychronous mode. |
613 DCHECK(synchronous_); | 617 DCHECK(synchronous_); |
614 } | 618 } |
615 | 619 |
616 ~SessionRestoreImpl() { | 620 ~SessionRestoreImpl() { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 (*i)->bounds, | 782 (*i)->bounds, |
779 show_state, | 783 show_state, |
780 (*i)->app_name); | 784 (*i)->app_name); |
781 #if defined(OS_CHROMEOS) | 785 #if defined(OS_CHROMEOS) |
782 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( | 786 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( |
783 "SessionRestore-CreateRestoredBrowser-End", false); | 787 "SessionRestore-CreateRestoredBrowser-End", false); |
784 #endif | 788 #endif |
785 } | 789 } |
786 if ((*i)->type == Browser::TYPE_TABBED) | 790 if ((*i)->type == Browser::TYPE_TABBED) |
787 last_browser = browser; | 791 last_browser = browser; |
788 WebContents* active_tab = browser->GetActiveWebContents(); | 792 WebContents* active_tab = chrome::GetActiveWebContents(browser); |
789 int initial_tab_count = browser->tab_count(); | 793 int initial_tab_count = browser->tab_count(); |
790 int selected_tab_index = std::max( | 794 int selected_tab_index = std::max( |
791 0, | 795 0, |
792 std::min((*i)->selected_tab_index, | 796 std::min((*i)->selected_tab_index, |
793 static_cast<int>((*i)->tabs.size()) - 1)); | 797 static_cast<int>((*i)->tabs.size()) - 1)); |
794 selected_tab_index = | 798 selected_tab_index = |
795 RestoreTabsToBrowser(*(*i), browser, selected_tab_index); | 799 RestoreTabsToBrowser(*(*i), browser, selected_tab_index); |
796 ShowBrowser(browser, selected_tab_index); | 800 ShowBrowser(browser, selected_tab_index); |
797 if (clobber_existing_tab_ && i == windows->begin() && | 801 if (clobber_existing_tab_ && i == windows->begin() && |
798 (*i)->type == Browser::TYPE_TABBED && active_tab && | 802 (*i)->type == Browser::TYPE_TABBED && active_tab && |
799 browser == browser_ && browser->tab_count() > initial_tab_count) { | 803 browser == browser_ && browser->tab_count() > initial_tab_count) { |
800 browser->CloseTabContents(active_tab); | 804 chrome::CloseWebContents(browser, active_tab); |
801 active_tab = NULL; | 805 active_tab = NULL; |
802 } | 806 } |
803 tab_loader_->TabIsLoading( | 807 tab_loader_->TabIsLoading( |
804 &browser->GetActiveWebContents()->GetController()); | 808 &chrome::GetActiveWebContents(browser)->GetController()); |
805 NotifySessionServiceOfRestoredTabs(browser, initial_tab_count); | 809 NotifySessionServiceOfRestoredTabs(browser, initial_tab_count); |
806 } | 810 } |
807 | 811 |
808 if (last_browser && !urls_to_open_.empty()) | 812 if (last_browser && !urls_to_open_.empty()) |
809 AppendURLsToBrowser(last_browser, urls_to_open_); | 813 AppendURLsToBrowser(last_browser, urls_to_open_); |
810 #if defined(OS_CHROMEOS) | 814 #if defined(OS_CHROMEOS) |
811 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( | 815 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( |
812 "SessionRestore-CreatingTabs-End", false); | 816 "SessionRestore-CreatingTabs-End", false); |
813 #endif | 817 #endif |
814 // If last_browser is NULL and urls_to_open_ is non-empty, | 818 // If last_browser is NULL and urls_to_open_ is non-empty, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 WebContents* selected_web_contents = NULL; | 850 WebContents* selected_web_contents = NULL; |
847 for (int i = 0; i < static_cast<int>(window.tabs.size()); ++i) { | 851 for (int i = 0; i < static_cast<int>(window.tabs.size()); ++i) { |
848 const SessionTab& tab = *(window.tabs[i]); | 852 const SessionTab& tab = *(window.tabs[i]); |
849 // Don't schedule a load for the selected tab, as ShowBrowser() will do | 853 // Don't schedule a load for the selected tab, as ShowBrowser() will do |
850 // that. | 854 // that. |
851 if (i == selected_tab_index) | 855 if (i == selected_tab_index) |
852 selected_web_contents = RestoreTab(tab, i, browser, false); | 856 selected_web_contents = RestoreTab(tab, i, browser, false); |
853 else | 857 else |
854 RestoreTab(tab, i, browser, true); | 858 RestoreTab(tab, i, browser, true); |
855 } | 859 } |
856 if (selected_web_contents) { | 860 return selected_web_contents ? |
857 return browser->GetIndexOfController( | 861 chrome::GetIndexOfTab(browser, selected_web_contents) : 0; |
858 &selected_web_contents->GetController()); | |
859 } | |
860 return 0; | |
861 } | 862 } |
862 | 863 |
863 WebContents* RestoreTab(const SessionTab& tab, | 864 WebContents* RestoreTab(const SessionTab& tab, |
864 const int tab_index, | 865 const int tab_index, |
865 Browser* browser, | 866 Browser* browser, |
866 bool schedule_load) { | 867 bool schedule_load) { |
867 DCHECK(!tab.navigations.empty()); | 868 DCHECK(!tab.navigations.empty()); |
868 int selected_index = tab.current_navigation_index; | 869 int selected_index = tab.current_navigation_index; |
869 selected_index = std::max( | 870 selected_index = std::max( |
870 0, | 871 0, |
871 std::min(selected_index, | 872 std::min(selected_index, |
872 static_cast<int>(tab.navigations.size() - 1))); | 873 static_cast<int>(tab.navigations.size() - 1))); |
873 | 874 |
874 RecordAppLaunchForTab(browser, tab, selected_index); | 875 RecordAppLaunchForTab(browser, tab, selected_index); |
875 | 876 |
876 // Associate sessionStorage (if any) to the restored tab. | 877 // Associate sessionStorage (if any) to the restored tab. |
877 scoped_refptr<content::SessionStorageNamespace> session_storage_namespace; | 878 scoped_refptr<content::SessionStorageNamespace> session_storage_namespace; |
878 if (!tab.session_storage_persistent_id.empty()) { | 879 if (!tab.session_storage_persistent_id.empty()) { |
879 session_storage_namespace = | 880 session_storage_namespace = |
880 content::BrowserContext::GetDOMStorageContext(profile_)-> | 881 content::BrowserContext::GetDOMStorageContext(profile_)-> |
881 RecreateSessionStorage(tab.session_storage_persistent_id); | 882 RecreateSessionStorage(tab.session_storage_persistent_id); |
882 } | 883 } |
883 | 884 |
884 WebContents* web_contents = | 885 WebContents* web_contents = |
885 browser->AddRestoredTab(tab.navigations, | 886 chrome::AddRestoredTab(browser, |
886 tab_index, | 887 tab.navigations, |
887 selected_index, | 888 tab_index, |
888 tab.extension_app_id, | 889 selected_index, |
889 false, // select | 890 tab.extension_app_id, |
890 tab.pinned, | 891 false, // select |
891 true, | 892 tab.pinned, |
892 session_storage_namespace.get()); | 893 true, |
| 894 session_storage_namespace.get()); |
893 // Regression check: check that the tab didn't start loading right away. The | 895 // Regression check: check that the tab didn't start loading right away. The |
894 // focused tab will be loaded by Browser, and TabLoader will load the rest. | 896 // focused tab will be loaded by Browser, and TabLoader will load the rest. |
895 DCHECK(web_contents->GetController().NeedsReload()); | 897 DCHECK(web_contents->GetController().NeedsReload()); |
896 | 898 |
897 // Set up the file access rights for the selected navigation entry. | 899 // Set up the file access rights for the selected navigation entry. |
898 const int id = web_contents->GetRenderProcessHost()->GetID(); | 900 const int id = web_contents->GetRenderProcessHost()->GetID(); |
899 const int read_file_permissions = | 901 const int read_file_permissions = |
900 base::PLATFORM_FILE_OPEN | | 902 base::PLATFORM_FILE_OPEN | |
901 base::PLATFORM_FILE_READ | | 903 base::PLATFORM_FILE_READ | |
902 base::PLATFORM_FILE_EXCLUSIVE_READ | | 904 base::PLATFORM_FILE_EXCLUSIVE_READ | |
(...skipping 21 matching lines...) Expand all Loading... |
924 params.app_name = app_name; | 926 params.app_name = app_name; |
925 params.initial_bounds = bounds; | 927 params.initial_bounds = bounds; |
926 params.initial_show_state = show_state; | 928 params.initial_show_state = show_state; |
927 params.is_session_restore = true; | 929 params.is_session_restore = true; |
928 return Browser::CreateWithParams(params); | 930 return Browser::CreateWithParams(params); |
929 } | 931 } |
930 | 932 |
931 void ShowBrowser(Browser* browser, int selected_tab_index) { | 933 void ShowBrowser(Browser* browser, int selected_tab_index) { |
932 DCHECK(browser); | 934 DCHECK(browser); |
933 DCHECK(browser->tab_count()); | 935 DCHECK(browser->tab_count()); |
934 browser->ActivateTabAt(selected_tab_index, true); | 936 chrome::ActivateTabAt(browser, selected_tab_index, true); |
935 | 937 |
936 if (browser_ == browser) | 938 if (browser_ == browser) |
937 return; | 939 return; |
938 | 940 |
939 browser->window()->Show(); | 941 browser->window()->Show(); |
940 browser->set_is_session_restore(false); | 942 browser->set_is_session_restore(false); |
941 | 943 |
942 // TODO(jcampan): http://crbug.com/8123 we should not need to set the | 944 // TODO(jcampan): http://crbug.com/8123 we should not need to set the |
943 // initial focus explicitly. | 945 // initial focus explicitly. |
944 browser->GetActiveWebContents()->GetView()->SetInitialFocus(); | 946 chrome::GetActiveWebContents(browser)->GetView()->SetInitialFocus(); |
945 | 947 |
946 if (!browser_shown_) { | 948 if (!browser_shown_) { |
947 browser_shown_ = true; | 949 browser_shown_ = true; |
948 base::TimeDelta time_to_first_show = | 950 base::TimeDelta time_to_first_show = |
949 base::TimeTicks::Now() - restore_started_; | 951 base::TimeTicks::Now() - restore_started_; |
950 UMA_HISTOGRAM_CUSTOM_TIMES( | 952 UMA_HISTOGRAM_CUSTOM_TIMES( |
951 "SessionRestore.TimeToFirstShow", | 953 "SessionRestore.TimeToFirstShow", |
952 time_to_first_show, | 954 time_to_first_show, |
953 base::TimeDelta::FromMilliseconds(10), | 955 base::TimeDelta::FromMilliseconds(10), |
954 base::TimeDelta::FromSeconds(1000), | 956 base::TimeDelta::FromSeconds(1000), |
955 100); | 957 100); |
956 } | 958 } |
957 } | 959 } |
958 | 960 |
959 // Appends the urls in |urls| to |browser|. | 961 // Appends the urls in |urls| to |browser|. |
960 void AppendURLsToBrowser(Browser* browser, | 962 void AppendURLsToBrowser(Browser* browser, |
961 const std::vector<GURL>& urls) { | 963 const std::vector<GURL>& urls) { |
962 for (size_t i = 0; i < urls.size(); ++i) { | 964 for (size_t i = 0; i < urls.size(); ++i) { |
963 int add_types = TabStripModel::ADD_FORCE_INDEX; | 965 int add_types = TabStripModel::ADD_FORCE_INDEX; |
964 if (i == 0) | 966 if (i == 0) |
965 add_types |= TabStripModel::ADD_ACTIVE; | 967 add_types |= TabStripModel::ADD_ACTIVE; |
966 int index = browser->GetIndexForInsertionDuringRestore(i); | 968 int index = chrome::GetIndexForInsertionDuringRestore(browser, i); |
967 browser::NavigateParams params(browser, urls[i], | 969 browser::NavigateParams params(browser, urls[i], |
968 content::PAGE_TRANSITION_START_PAGE); | 970 content::PAGE_TRANSITION_START_PAGE); |
969 params.disposition = i == 0 ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; | 971 params.disposition = i == 0 ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; |
970 params.tabstrip_index = index; | 972 params.tabstrip_index = index; |
971 params.tabstrip_add_types = add_types; | 973 params.tabstrip_add_types = add_types; |
972 browser::Navigate(¶ms); | 974 browser::Navigate(¶ms); |
973 } | 975 } |
974 } | 976 } |
975 | 977 |
976 // Invokes TabRestored on the SessionService for all tabs in browser after | 978 // Invokes TabRestored on the SessionService for all tabs in browser after |
977 // initial_count. | 979 // initial_count. |
978 void NotifySessionServiceOfRestoredTabs(Browser* browser, int initial_count) { | 980 void NotifySessionServiceOfRestoredTabs(Browser* browser, int initial_count) { |
979 SessionService* session_service = | 981 SessionService* session_service = |
980 SessionServiceFactory::GetForProfile(profile_); | 982 SessionServiceFactory::GetForProfile(profile_); |
981 if (!session_service) | 983 if (!session_service) |
982 return; | 984 return; |
983 for (int i = initial_count; i < browser->tab_count(); ++i) | 985 for (int i = initial_count; i < browser->tab_count(); ++i) |
984 session_service->TabRestored(browser->GetTabContentsAt(i), | 986 session_service->TabRestored(chrome::GetTabContentsAt(browser, i), |
985 browser->IsTabPinned(i)); | 987 browser->tab_strip_model()->IsTabPinned(i)); |
986 } | 988 } |
987 | 989 |
988 // The profile to create the sessions for. | 990 // The profile to create the sessions for. |
989 Profile* profile_; | 991 Profile* profile_; |
990 | 992 |
991 // The first browser to restore to, may be null. | 993 // The first browser to restore to, may be null. |
992 Browser* browser_; | 994 Browser* browser_; |
993 | 995 |
994 // Whether or not restore is synchronous. | 996 // Whether or not restore is synchronous. |
995 const bool synchronous_; | 997 const bool synchronous_; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 if (active_session_restorers == NULL) | 1089 if (active_session_restorers == NULL) |
1088 return false; | 1090 return false; |
1089 for (std::set<SessionRestoreImpl*>::const_iterator it = | 1091 for (std::set<SessionRestoreImpl*>::const_iterator it = |
1090 active_session_restorers->begin(); | 1092 active_session_restorers->begin(); |
1091 it != active_session_restorers->end(); ++it) { | 1093 it != active_session_restorers->end(); ++it) { |
1092 if ((*it)->profile() == profile) | 1094 if ((*it)->profile() == profile) |
1093 return true; | 1095 return true; |
1094 } | 1096 } |
1095 return false; | 1097 return false; |
1096 } | 1098 } |
OLD | NEW |