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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/sessions/session_service.h" | 9 #include "chrome/browser/sessions/session_service.h" |
10 #include "chrome/browser/sessions/session_service_factory.h" | 10 #include "chrome/browser/sessions/session_service_factory.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 browser->window()->GetRestoredBounds().size()); | 123 browser->window()->GetRestoredBounds().size()); |
124 web_contents->WasHidden(); | 124 web_contents->WasHidden(); |
125 } | 125 } |
126 SessionService* session_service = | 126 SessionService* session_service = |
127 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); | 127 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); |
128 if (session_service) | 128 if (session_service) |
129 session_service->TabRestored(web_contents, pin); | 129 session_service->TabRestored(web_contents, pin); |
130 return web_contents; | 130 return web_contents; |
131 } | 131 } |
132 | 132 |
133 void ReplaceRestoredTab( | 133 content::WebContents* ReplaceRestoredTab( |
134 Browser* browser, | 134 Browser* browser, |
135 const std::vector<SerializedNavigationEntry>& navigations, | 135 const std::vector<SerializedNavigationEntry>& navigations, |
136 int selected_navigation, | 136 int selected_navigation, |
137 bool from_last_session, | 137 bool from_last_session, |
138 const std::string& extension_app_id, | 138 const std::string& extension_app_id, |
139 content::SessionStorageNamespace* session_storage_namespace, | 139 content::SessionStorageNamespace* session_storage_namespace, |
140 const std::string& user_agent_override) { | 140 const std::string& user_agent_override) { |
141 WebContents* web_contents = CreateRestoredTab(browser, | 141 WebContents* web_contents = CreateRestoredTab(browser, |
142 navigations, | 142 navigations, |
143 selected_navigation, | 143 selected_navigation, |
144 extension_app_id, | 144 extension_app_id, |
145 from_last_session, | 145 from_last_session, |
146 session_storage_namespace, | 146 session_storage_namespace, |
147 user_agent_override); | 147 user_agent_override); |
148 | 148 |
149 // ReplaceWebContentsAt won't animate in the restoration, so manually do the | 149 // ReplaceWebContentsAt won't animate in the restoration, so manually do the |
150 // equivalent of ReplaceWebContentsAt. | 150 // equivalent of ReplaceWebContentsAt. |
151 TabStripModel* tab_strip = browser->tab_strip_model(); | 151 TabStripModel* tab_strip = browser->tab_strip_model(); |
152 int insertion_index = tab_strip->active_index(); | 152 int insertion_index = tab_strip->active_index(); |
153 tab_strip->InsertWebContentsAt(insertion_index + 1, | 153 tab_strip->InsertWebContentsAt(insertion_index + 1, |
154 web_contents, | 154 web_contents, |
155 TabStripModel::ADD_ACTIVE | | 155 TabStripModel::ADD_ACTIVE | |
156 TabStripModel::ADD_INHERIT_GROUP); | 156 TabStripModel::ADD_INHERIT_GROUP); |
157 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); | 157 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); |
| 158 return web_contents; |
158 } | 159 } |
159 | 160 |
160 } // namespace chrome | 161 } // namespace chrome |
OLD | NEW |