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> |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 RecordAppLaunchForTab(browser, tab, selected_index); | 611 RecordAppLaunchForTab(browser, tab, selected_index); |
612 | 612 |
613 if (disposition == CURRENT_TAB) { | 613 if (disposition == CURRENT_TAB) { |
614 DCHECK(!use_new_window); | 614 DCHECK(!use_new_window); |
615 chrome::ReplaceRestoredTab(browser, | 615 chrome::ReplaceRestoredTab(browser, |
616 tab.navigations, | 616 tab.navigations, |
617 selected_index, | 617 selected_index, |
618 true, | 618 true, |
619 tab.extension_app_id, | 619 tab.extension_app_id, |
620 NULL, | 620 NULL, |
621 tab.user_agent_override); | 621 tab.user_agent_override, |
| 622 tab.sync_session_id); |
622 } else { | 623 } else { |
623 int tab_index = | 624 int tab_index = |
624 use_new_window ? 0 : browser->tab_strip_model()->active_index() + 1; | 625 use_new_window ? 0 : browser->tab_strip_model()->active_index() + 1; |
625 WebContents* web_contents = chrome::AddRestoredTab( | 626 WebContents* web_contents = |
626 browser, | 627 chrome::AddRestoredTab(browser, |
627 tab.navigations, | 628 tab.navigations, |
628 tab_index, | 629 tab_index, |
629 selected_index, | 630 selected_index, |
630 tab.extension_app_id, | 631 tab.extension_app_id, |
631 disposition == NEW_FOREGROUND_TAB, // selected | 632 disposition == NEW_FOREGROUND_TAB, // selected |
632 tab.pinned, | 633 tab.pinned, |
633 true, | 634 true, |
634 NULL, | 635 NULL, |
635 tab.user_agent_override); | 636 tab.user_agent_override, |
| 637 tab.sync_session_id); |
636 // Start loading the tab immediately. | 638 // Start loading the tab immediately. |
637 web_contents->GetController().LoadIfNecessary(); | 639 web_contents->GetController().LoadIfNecessary(); |
638 } | 640 } |
639 | 641 |
640 if (use_new_window) { | 642 if (use_new_window) { |
641 browser->tab_strip_model()->ActivateTabAt(0, true); | 643 browser->tab_strip_model()->ActivateTabAt(0, true); |
642 browser->window()->Show(); | 644 browser->window()->Show(); |
643 } | 645 } |
644 NotifySessionServiceOfRestoredTabs(browser, | 646 NotifySessionServiceOfRestoredTabs(browser, |
645 browser->tab_strip_model()->count()); | 647 browser->tab_strip_model()->count()); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 WebContents* web_contents = | 1002 WebContents* web_contents = |
1001 chrome::AddRestoredTab(browser, | 1003 chrome::AddRestoredTab(browser, |
1002 tab.navigations, | 1004 tab.navigations, |
1003 tab_index, | 1005 tab_index, |
1004 selected_index, | 1006 selected_index, |
1005 tab.extension_app_id, | 1007 tab.extension_app_id, |
1006 false, // select | 1008 false, // select |
1007 tab.pinned, | 1009 tab.pinned, |
1008 true, | 1010 true, |
1009 session_storage_namespace.get(), | 1011 session_storage_namespace.get(), |
1010 tab.user_agent_override); | 1012 tab.user_agent_override, |
| 1013 tab.sync_session_id); |
1011 // Regression check: check that the tab didn't start loading right away. The | 1014 // Regression check: check that the tab didn't start loading right away. The |
1012 // focused tab will be loaded by Browser, and TabLoader will load the rest. | 1015 // focused tab will be loaded by Browser, and TabLoader will load the rest. |
1013 DCHECK(web_contents->GetController().NeedsReload()); | 1016 DCHECK(web_contents->GetController().NeedsReload()); |
1014 | 1017 |
1015 // Set up the file access rights for the selected navigation entry. | 1018 // Set up the file access rights for the selected navigation entry. |
1016 const int id = web_contents->GetRenderProcessHost()->GetID(); | 1019 const int id = web_contents->GetRenderProcessHost()->GetID(); |
1017 const int read_file_permissions = | 1020 const int read_file_permissions = |
1018 base::PLATFORM_FILE_OPEN | | 1021 base::PLATFORM_FILE_OPEN | |
1019 base::PLATFORM_FILE_READ | | 1022 base::PLATFORM_FILE_READ | |
1020 base::PLATFORM_FILE_EXCLUSIVE_READ | | 1023 base::PLATFORM_FILE_EXCLUSIVE_READ | |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 if (!active_session_restorers) | 1239 if (!active_session_restorers) |
1237 return false; | 1240 return false; |
1238 for (std::set<SessionRestoreImpl*>::const_iterator it = | 1241 for (std::set<SessionRestoreImpl*>::const_iterator it = |
1239 active_session_restorers->begin(); | 1242 active_session_restorers->begin(); |
1240 it != active_session_restorers->end(); ++it) { | 1243 it != active_session_restorers->end(); ++it) { |
1241 if ((*it)->synchronous()) | 1244 if ((*it)->synchronous()) |
1242 return true; | 1245 return true; |
1243 } | 1246 } |
1244 return false; | 1247 return false; |
1245 } | 1248 } |
OLD | NEW |