Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: chrome/browser/ui/browser_tabrestore.cc

Issue 2259533003: Use bounds instead of size for prerender requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments nit Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/apps/chrome_app_delegate.cc ('k') | chrome/browser/ui/exclusive_access/fullscreen_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698