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

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

Issue 209023003: Remove references to WebContentsView::SizeContents from chrome/ and app/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a missing NULL pointer check to android code. Created 6 years, 8 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 "apps/ui/web_contents_sizer.h"
7 #include "chrome/browser/extensions/tab_helper.h" 8 #include "chrome/browser/extensions/tab_helper.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sessions/session_service.h" 10 #include "chrome/browser/sessions/session_service.h"
10 #include "chrome/browser/sessions/session_service_factory.h" 11 #include "chrome/browser/sessions/session_service_factory.h"
11 #include "chrome/browser/tab_contents/tab_util.h" 12 #include "chrome/browser/tab_contents/tab_util.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "content/public/browser/navigation_controller.h" 16 #include "content/public/browser/navigation_controller.h"
16 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 int first_mini_tab_idx = 107 int first_mini_tab_idx =
107 browser->tab_strip_model()->IndexOfFirstNonMiniTab(); 108 browser->tab_strip_model()->IndexOfFirstNonMiniTab();
108 tab_index = std::min(tab_index, first_mini_tab_idx); 109 tab_index = std::min(tab_index, first_mini_tab_idx);
109 add_types |= TabStripModel::ADD_PINNED; 110 add_types |= TabStripModel::ADD_PINNED;
110 } 111 }
111 browser->tab_strip_model()->InsertWebContentsAt(tab_index, web_contents, 112 browser->tab_strip_model()->InsertWebContentsAt(tab_index, web_contents,
112 add_types); 113 add_types);
113 if (select) { 114 if (select) {
114 browser->window()->Activate(); 115 browser->window()->Activate();
115 } else { 116 } else {
116 // We set the size of the view here, before WebKit does its initial 117 // We set the size of the view here, before Blink does its initial layout.
117 // layout. If we don't, the initial layout of background tabs will be 118 // If we don't, the initial layout of background tabs will be performed
118 // performed with a view width of 0, which may cause script outputs and 119 // with a view width of 0, which may cause script outputs and anchor link
119 // anchor link location calculations to be incorrect even after a new 120 // location calculations to be incorrect even after a new layout with
120 // layout with proper view dimensions. TabStripModel::AddWebContents() 121 // proper view dimensions. TabStripModel::AddWebContents() contains similar
121 // contains similar logic. 122 // logic.
122 web_contents->GetView()->SizeContents( 123 apps::ResizeWebContents(web_contents,
123 browser->window()->GetRestoredBounds().size()); 124 browser->window()->GetRestoredBounds().size());
124 web_contents->WasHidden(); 125 web_contents->WasHidden();
125 } 126 }
126 SessionService* session_service = 127 SessionService* session_service =
127 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); 128 SessionServiceFactory::GetForProfileIfExisting(browser->profile());
128 if (session_service) 129 if (session_service)
129 session_service->TabRestored(web_contents, pin); 130 session_service->TabRestored(web_contents, pin);
130 return web_contents; 131 return web_contents;
131 } 132 }
132 133
133 content::WebContents* ReplaceRestoredTab( 134 content::WebContents* ReplaceRestoredTab(
(...skipping 18 matching lines...) Expand all
152 int insertion_index = tab_strip->active_index(); 153 int insertion_index = tab_strip->active_index();
153 tab_strip->InsertWebContentsAt(insertion_index + 1, 154 tab_strip->InsertWebContentsAt(insertion_index + 1,
154 web_contents, 155 web_contents,
155 TabStripModel::ADD_ACTIVE | 156 TabStripModel::ADD_ACTIVE |
156 TabStripModel::ADD_INHERIT_GROUP); 157 TabStripModel::ADD_INHERIT_GROUP);
157 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); 158 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE);
158 return web_contents; 159 return web_contents;
159 } 160 }
160 161
161 } // namespace chrome 162 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_contents.cc ('k') | chrome/browser/ui/fullscreen/fullscreen_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698