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

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

Issue 503233003: Add AppDelegate::ResizeWebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Stop using chrome namespace Created 6 years, 3 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"
8 #include "chrome/browser/extensions/tab_helper.h" 7 #include "chrome/browser/extensions/tab_helper.h"
9 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/session_service.h" 9 #include "chrome/browser/sessions/session_service.h"
11 #include "chrome/browser/sessions/session_service_factory.h" 10 #include "chrome/browser/sessions/session_service_factory.h"
12 #include "chrome/browser/tab_contents/tab_util.h" 11 #include "chrome/browser/tab_contents/tab_util.h"
13 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/browser/ui/web_contents_sizer.h"
16 #include "content/public/browser/navigation_controller.h" 16 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
18 #include "content/public/browser/session_storage_namespace.h" 18 #include "content/public/browser/session_storage_namespace.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 20
21 using content::WebContents; 21 using content::WebContents;
22 using content::NavigationController; 22 using content::NavigationController;
23 using content::NavigationEntry; 23 using content::NavigationEntry;
24 using sessions::SerializedNavigationEntry; 24 using sessions::SerializedNavigationEntry;
25 25
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 gfx::Size size = browser->window()->GetBounds().size(); 125 gfx::Size size = browser->window()->GetBounds().size();
126 // Fallback to the restore bounds if it's empty as the window is not shown 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. 127 // yet and the bounds may not be available on all platforms.
128 if (size.IsEmpty()) 128 if (size.IsEmpty())
129 size = browser->window()->GetRestoredBounds().size(); 129 size = browser->window()->GetRestoredBounds().size();
130 apps::ResizeWebContents(web_contents, size); 130 ResizeWebContents(web_contents, size);
131 web_contents->WasHidden(); 131 web_contents->WasHidden();
132 } 132 }
133 SessionService* session_service = 133 SessionService* session_service =
134 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); 134 SessionServiceFactory::GetForProfileIfExisting(browser->profile());
135 if (session_service) 135 if (session_service)
136 session_service->TabRestored(web_contents, pin); 136 session_service->TabRestored(web_contents, pin);
137 return web_contents; 137 return web_contents;
138 } 138 }
139 139
140 content::WebContents* ReplaceRestoredTab( 140 content::WebContents* ReplaceRestoredTab(
(...skipping 19 matching lines...) Expand all
160 int insertion_index = tab_strip->active_index(); 160 int insertion_index = tab_strip->active_index();
161 tab_strip->InsertWebContentsAt(insertion_index + 1, 161 tab_strip->InsertWebContentsAt(insertion_index + 1,
162 web_contents, 162 web_contents,
163 TabStripModel::ADD_ACTIVE | 163 TabStripModel::ADD_ACTIVE |
164 TabStripModel::ADD_INHERIT_GROUP); 164 TabStripModel::ADD_INHERIT_GROUP);
165 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE); 165 tab_strip->CloseWebContentsAt(insertion_index, TabStripModel::CLOSE_NONE);
166 return web_contents; 166 return web_contents;
167 } 167 }
168 168
169 } // namespace chrome 169 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698