| 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/ui/browser_tabrestore.h" | 5 #include "chrome/browser/ui/browser_tabrestore.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/tab_helper.h" | 7 #include "chrome/browser/extensions/tab_helper.h" |
| 8 #include "chrome/browser/sessions/session_service.h" | 8 #include "chrome/browser/sessions/session_service.h" |
| 9 #include "chrome/browser/sessions/session_service_factory.h" | 9 #include "chrome/browser/sessions/session_service_factory.h" |
| 10 #include "chrome/browser/tab_contents/tab_util.h" | 10 #include "chrome/browser/tab_contents/tab_util.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 session_storage_namespace_map[""] = session_storage_namespace; | 52 session_storage_namespace_map[""] = session_storage_namespace; |
| 53 TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory( | 53 TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory( |
| 54 browser->profile(), | 54 browser->profile(), |
| 55 tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url), | 55 tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url), |
| 56 MSG_ROUTING_NONE, | 56 MSG_ROUTING_NONE, |
| 57 chrome::GetActiveWebContents(browser), | 57 chrome::GetActiveWebContents(browser), |
| 58 session_storage_namespace_map); | 58 session_storage_namespace_map); |
| 59 WebContents* new_tab = tab_contents->web_contents(); | 59 WebContents* new_tab = tab_contents->web_contents(); |
| 60 extensions::TabHelper::FromWebContents(new_tab)-> | 60 extensions::TabHelper::FromWebContents(new_tab)-> |
| 61 SetExtensionAppById(extension_app_id); | 61 SetExtensionAppById(extension_app_id); |
| 62 std::vector<NavigationEntry*> entries; | 62 std::vector<NavigationEntry*> entries = |
| 63 TabNavigation::CreateNavigationEntriesFromTabNavigations( | 63 TabNavigation::CreateNavigationEntriesFromTabNavigations( |
| 64 browser->profile(), navigations, &entries); | 64 navigations, browser->profile()); |
| 65 new_tab->SetUserAgentOverride(user_agent_override); | 65 new_tab->SetUserAgentOverride(user_agent_override); |
| 66 new_tab->GetController().Restore( | 66 new_tab->GetController().Restore( |
| 67 selected_navigation, from_last_session, &entries); | 67 selected_navigation, from_last_session, &entries); |
| 68 DCHECK_EQ(0u, entries.size()); | 68 DCHECK_EQ(0u, entries.size()); |
| 69 | 69 |
| 70 int add_types = select ? TabStripModel::ADD_ACTIVE : | 70 int add_types = select ? TabStripModel::ADD_ACTIVE : |
| 71 TabStripModel::ADD_NONE; | 71 TabStripModel::ADD_NONE; |
| 72 if (pin) { | 72 if (pin) { |
| 73 int first_mini_tab_idx = | 73 int first_mini_tab_idx = |
| 74 browser->tab_strip_model()->IndexOfFirstNonMiniTab(); | 74 browser->tab_strip_model()->IndexOfFirstNonMiniTab(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory( | 116 TabContents* tab_contents = chrome::TabContentsWithSessionStorageFactory( |
| 117 browser->profile(), | 117 browser->profile(), |
| 118 tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url), | 118 tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url), |
| 119 MSG_ROUTING_NONE, | 119 MSG_ROUTING_NONE, |
| 120 GetActiveWebContents(browser), | 120 GetActiveWebContents(browser), |
| 121 session_storage_namespace_map); | 121 session_storage_namespace_map); |
| 122 WebContents* replacement = tab_contents->web_contents(); | 122 WebContents* replacement = tab_contents->web_contents(); |
| 123 extensions::TabHelper::FromWebContents(replacement)-> | 123 extensions::TabHelper::FromWebContents(replacement)-> |
| 124 SetExtensionAppById(extension_app_id); | 124 SetExtensionAppById(extension_app_id); |
| 125 replacement->SetUserAgentOverride(user_agent_override); | 125 replacement->SetUserAgentOverride(user_agent_override); |
| 126 std::vector<NavigationEntry*> entries; | 126 std::vector<NavigationEntry*> entries = |
| 127 TabNavigation::CreateNavigationEntriesFromTabNavigations( | 127 TabNavigation::CreateNavigationEntriesFromTabNavigations( |
| 128 browser->profile(), navigations, &entries); | 128 navigations, browser->profile()); |
| 129 replacement->GetController().Restore( | 129 replacement->GetController().Restore( |
| 130 selected_navigation, from_last_session, &entries); | 130 selected_navigation, from_last_session, &entries); |
| 131 DCHECK_EQ(0u, entries.size()); | 131 DCHECK_EQ(0u, entries.size()); |
| 132 | 132 |
| 133 browser->tab_strip_model()->ReplaceNavigationControllerAt( | 133 browser->tab_strip_model()->ReplaceNavigationControllerAt( |
| 134 browser->active_index(), | 134 browser->active_index(), |
| 135 tab_contents); | 135 tab_contents); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace chrome | 138 } // namespace chrome |
| OLD | NEW |