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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 586 |
587 RecordAppLaunchForTab(browser, tab, selected_index); | 587 RecordAppLaunchForTab(browser, tab, selected_index); |
588 | 588 |
589 if (disposition == CURRENT_TAB) { | 589 if (disposition == CURRENT_TAB) { |
590 DCHECK(!use_new_window); | 590 DCHECK(!use_new_window); |
591 chrome::ReplaceRestoredTab(browser, | 591 chrome::ReplaceRestoredTab(browser, |
592 tab.navigations, | 592 tab.navigations, |
593 selected_index, | 593 selected_index, |
594 true, | 594 true, |
595 tab.extension_app_id, | 595 tab.extension_app_id, |
596 NULL); | 596 NULL, |
| 597 tab.user_agent_override); |
597 } else { | 598 } else { |
598 int tab_index = use_new_window ? 0 : browser->active_index() + 1; | 599 int tab_index = use_new_window ? 0 : browser->active_index() + 1; |
599 WebContents* web_contents = chrome::AddRestoredTab( | 600 WebContents* web_contents = chrome::AddRestoredTab( |
600 browser, | 601 browser, |
601 tab.navigations, | 602 tab.navigations, |
602 tab_index, | 603 tab_index, |
603 selected_index, | 604 selected_index, |
604 tab.extension_app_id, | 605 tab.extension_app_id, |
605 false, // selected | 606 false, // selected |
606 tab.pinned, | 607 tab.pinned, |
607 true, | 608 true, |
608 NULL); | 609 NULL, |
| 610 tab.user_agent_override); |
609 // Start loading the tab immediately. | 611 // Start loading the tab immediately. |
610 web_contents->GetController().LoadIfNecessary(); | 612 web_contents->GetController().LoadIfNecessary(); |
611 } | 613 } |
612 | 614 |
613 if (use_new_window) { | 615 if (use_new_window) { |
614 chrome::ActivateTabAt(browser, 0, true); | 616 chrome::ActivateTabAt(browser, 0, true); |
615 browser->window()->Show(); | 617 browser->window()->Show(); |
616 } | 618 } |
617 NotifySessionServiceOfRestoredTabs(browser, browser->tab_count()); | 619 NotifySessionServiceOfRestoredTabs(browser, browser->tab_count()); |
618 | 620 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 | 899 |
898 WebContents* web_contents = | 900 WebContents* web_contents = |
899 chrome::AddRestoredTab(browser, | 901 chrome::AddRestoredTab(browser, |
900 tab.navigations, | 902 tab.navigations, |
901 tab_index, | 903 tab_index, |
902 selected_index, | 904 selected_index, |
903 tab.extension_app_id, | 905 tab.extension_app_id, |
904 false, // select | 906 false, // select |
905 tab.pinned, | 907 tab.pinned, |
906 true, | 908 true, |
907 session_storage_namespace.get()); | 909 session_storage_namespace.get(), |
| 910 tab.user_agent_override); |
908 // Regression check: check that the tab didn't start loading right away. The | 911 // Regression check: check that the tab didn't start loading right away. The |
909 // focused tab will be loaded by Browser, and TabLoader will load the rest. | 912 // focused tab will be loaded by Browser, and TabLoader will load the rest. |
910 DCHECK(web_contents->GetController().NeedsReload()); | 913 DCHECK(web_contents->GetController().NeedsReload()); |
911 | 914 |
912 // Set up the file access rights for the selected navigation entry. | 915 // Set up the file access rights for the selected navigation entry. |
913 const int id = web_contents->GetRenderProcessHost()->GetID(); | 916 const int id = web_contents->GetRenderProcessHost()->GetID(); |
914 const int read_file_permissions = | 917 const int read_file_permissions = |
915 base::PLATFORM_FILE_OPEN | | 918 base::PLATFORM_FILE_OPEN | |
916 base::PLATFORM_FILE_READ | | 919 base::PLATFORM_FILE_READ | |
917 base::PLATFORM_FILE_EXCLUSIVE_READ | | 920 base::PLATFORM_FILE_EXCLUSIVE_READ | |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 if (active_session_restorers == NULL) | 1105 if (active_session_restorers == NULL) |
1103 return false; | 1106 return false; |
1104 for (std::set<SessionRestoreImpl*>::const_iterator it = | 1107 for (std::set<SessionRestoreImpl*>::const_iterator it = |
1105 active_session_restorers->begin(); | 1108 active_session_restorers->begin(); |
1106 it != active_session_restorers->end(); ++it) { | 1109 it != active_session_restorers->end(); ++it) { |
1107 if ((*it)->profile() == profile) | 1110 if ((*it)->profile() == profile) |
1108 return true; | 1111 return true; |
1109 } | 1112 } |
1110 return false; | 1113 return false; |
1111 } | 1114 } |
OLD | NEW |