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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // If we don't, the initial layout of background tabs will be performed | 121 // If we don't, the initial layout of background tabs will be performed |
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, gfx::Rect(size)); |
132 web_contents->WasHidden(); | 132 web_contents->WasHidden(); |
133 } | 133 } |
134 SessionService* session_service = | 134 SessionService* session_service = |
135 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); | 135 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); |
136 if (session_service) | 136 if (session_service) |
137 session_service->TabRestored(web_contents, pin); | 137 session_service->TabRestored(web_contents, pin); |
138 return web_contents; | 138 return web_contents; |
139 } | 139 } |
140 | 140 |
141 content::WebContents* ReplaceRestoredTab( | 141 content::WebContents* ReplaceRestoredTab( |
(...skipping 19 matching lines...) Expand all Loading... |
161 int insertion_index = tab_strip->active_index(); | 161 int insertion_index = tab_strip->active_index(); |
162 tab_strip->InsertWebContentsAt(insertion_index + 1, | 162 tab_strip->InsertWebContentsAt(insertion_index + 1, |
163 web_contents, | 163 web_contents, |
164 TabStripModel::ADD_ACTIVE | | 164 TabStripModel::ADD_ACTIVE | |
165 TabStripModel::ADD_INHERIT_GROUP); | 165 TabStripModel::ADD_INHERIT_GROUP); |
166 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); | 166 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); |
167 return web_contents; | 167 return web_contents; |
168 } | 168 } |
169 | 169 |
170 } // namespace chrome | 170 } // namespace chrome |
OLD | NEW |