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

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

Issue 394653005: Use the window's bounds if available instead of restore bounds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "apps/ui/web_contents_sizer.h" 7 #include "apps/ui/web_contents_sizer.h"
8 #include "chrome/browser/extensions/tab_helper.h" 8 #include "chrome/browser/extensions/tab_helper.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/session_service.h" 10 #include "chrome/browser/sessions/session_service.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 add_types); 115 add_types);
116 if (select) { 116 if (select) {
117 browser->window()->Activate(); 117 browser->window()->Activate();
118 } else { 118 } else {
119 // We set the size of the view here, before Blink does its initial layout. 119 // We set the size of the view here, before Blink does its initial layout.
120 // If we don't, the initial layout of background tabs will be performed 120 // If we don't, the initial layout of background tabs will be performed
121 // with a view width of 0, which may cause script outputs and anchor link 121 // with a view width of 0, which may cause script outputs and anchor link
122 // location calculations to be incorrect even after a new layout with 122 // location calculations to be incorrect even after a new layout with
123 // proper view dimensions. TabStripModel::AddWebContents() contains similar 123 // proper view dimensions. TabStripModel::AddWebContents() contains similar
124 // logic. 124 // logic.
125 apps::ResizeWebContents(web_contents, 125 gfx::Size size = browser->window()->GetBounds().size();
126 browser->window()->GetRestoredBounds().size()); 126 // Fallback to the restore bounds if it's empty as the window is not shown
127 // yet and the bounds may not be available on all platforms.
128 if (size.IsEmpty())
129 size = browser->window()->GetRestoredBounds().size();
130 apps::ResizeWebContents(web_contents, size);
127 web_contents->WasHidden(); 131 web_contents->WasHidden();
128 } 132 }
129 SessionService* session_service = 133 SessionService* session_service =
130 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); 134 SessionServiceFactory::GetForProfileIfExisting(browser->profile());
131 if (session_service) 135 if (session_service)
132 session_service->TabRestored(web_contents, pin); 136 session_service->TabRestored(web_contents, pin);
133 return web_contents; 137 return web_contents;
134 } 138 }
135 139
136 content::WebContents* ReplaceRestoredTab( 140 content::WebContents* ReplaceRestoredTab(
(...skipping 19 matching lines...) Expand all
156 int insertion_index = tab_strip->active_index(); 160 int insertion_index = tab_strip->active_index();
157 tab_strip->InsertWebContentsAt(insertion_index + 1, 161 tab_strip->InsertWebContentsAt(insertion_index + 1,
158 web_contents, 162 web_contents,
159 TabStripModel::ADD_ACTIVE | 163 TabStripModel::ADD_ACTIVE |
160 TabStripModel::ADD_INHERIT_GROUP); 164 TabStripModel::ADD_INHERIT_GROUP);
161 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); 165 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE);
162 return web_contents; 166 return web_contents;
163 } 167 }
164 168
165 } // namespace chrome 169 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698