| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // with a view width of 0, which may cause script outputs and anchor link | 122 // with a view width of 0, which may cause script outputs and anchor link |
| 123 // location calculations to be incorrect even after a new layout with | 123 // location calculations to be incorrect even after a new layout with |
| 124 // proper view dimensions. TabStripModel::AddWebContents() contains similar | 124 // proper view dimensions. TabStripModel::AddWebContents() contains similar |
| 125 // logic. | 125 // logic. |
| 126 gfx::Size size = browser->window()->GetContentsSize(); | 126 gfx::Size size = browser->window()->GetContentsSize(); |
| 127 // Fallback to the restore bounds if it's empty as the window is not shown | 127 // Fallback to the restore bounds if it's empty as the window is not shown |
| 128 // yet and the bounds may not be available on all platforms. | 128 // yet and the bounds may not be available on all platforms. |
| 129 if (size.IsEmpty()) | 129 if (size.IsEmpty()) |
| 130 size = browser->window()->GetRestoredBounds().size(); | 130 size = browser->window()->GetRestoredBounds().size(); |
| 131 ResizeWebContents(web_contents, size); | 131 ResizeWebContents(web_contents, size); |
| 132 web_contents->WasHidden(); | 132 |
| 133 // CreateRestoredTab() would have passed the correct |initially_hidden| via |
| 134 // the WebContents::CreateParams, so this line shouldn't be necessary. |
| 135 // TODO(tapted): Delete this line and see what breaks. |
| 136 web_contents->MarkBackgrounded(); |
| 133 } | 137 } |
| 134 SessionService* session_service = | 138 SessionService* session_service = |
| 135 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); | 139 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); |
| 136 if (session_service) | 140 if (session_service) |
| 137 session_service->TabRestored(web_contents, pin); | 141 session_service->TabRestored(web_contents, pin); |
| 138 return web_contents; | 142 return web_contents; |
| 139 } | 143 } |
| 140 | 144 |
| 141 content::WebContents* ReplaceRestoredTab( | 145 content::WebContents* ReplaceRestoredTab( |
| 142 Browser* browser, | 146 Browser* browser, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 161 int insertion_index = tab_strip->active_index(); | 165 int insertion_index = tab_strip->active_index(); |
| 162 tab_strip->InsertWebContentsAt(insertion_index + 1, | 166 tab_strip->InsertWebContentsAt(insertion_index + 1, |
| 163 web_contents, | 167 web_contents, |
| 164 TabStripModel::ADD_ACTIVE | | 168 TabStripModel::ADD_ACTIVE | |
| 165 TabStripModel::ADD_INHERIT_GROUP); | 169 TabStripModel::ADD_INHERIT_GROUP); |
| 166 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); | 170 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); |
| 167 return web_contents; | 171 return web_contents; |
| 168 } | 172 } |
| 169 | 173 |
| 170 } // namespace chrome | 174 } // namespace chrome |
| OLD | NEW |