| 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(); | |
| 133 } | 132 } |
| 134 SessionService* session_service = | 133 SessionService* session_service = |
| 135 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); | 134 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); |
| 136 if (session_service) | 135 if (session_service) |
| 137 session_service->TabRestored(web_contents, pin); | 136 session_service->TabRestored(web_contents, pin); |
| 138 return web_contents; | 137 return web_contents; |
| 139 } | 138 } |
| 140 | 139 |
| 141 content::WebContents* ReplaceRestoredTab( | 140 content::WebContents* ReplaceRestoredTab( |
| 142 Browser* browser, | 141 Browser* browser, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 161 int insertion_index = tab_strip->active_index(); | 160 int insertion_index = tab_strip->active_index(); |
| 162 tab_strip->InsertWebContentsAt(insertion_index + 1, | 161 tab_strip->InsertWebContentsAt(insertion_index + 1, |
| 163 web_contents, | 162 web_contents, |
| 164 TabStripModel::ADD_ACTIVE | | 163 TabStripModel::ADD_ACTIVE | |
| 165 TabStripModel::ADD_INHERIT_GROUP); | 164 TabStripModel::ADD_INHERIT_GROUP); |
| 166 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); | 165 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); |
| 167 return web_contents; | 166 return web_contents; |
| 168 } | 167 } |
| 169 | 168 |
| 170 } // namespace chrome | 169 } // namespace chrome |
| OLD | NEW |