Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/frame/browser_view.h" | 5 #include "chrome/browser/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1283 | 1283 |
| 1284 void BrowserView::TabSelectedAt(TabContents* old_contents, | 1284 void BrowserView::TabSelectedAt(TabContents* old_contents, |
| 1285 TabContents* new_contents, | 1285 TabContents* new_contents, |
| 1286 int index, | 1286 int index, |
| 1287 bool user_gesture) { | 1287 bool user_gesture) { |
| 1288 DCHECK(old_contents != new_contents); | 1288 DCHECK(old_contents != new_contents); |
| 1289 | 1289 |
| 1290 // Update various elements that are interested in knowing the current | 1290 // Update various elements that are interested in knowing the current |
| 1291 // TabContents. | 1291 // TabContents. |
| 1292 | 1292 |
| 1293 // When we toggle the NTP floating bookmarks bar, | 1293 // When we toggle the NTP floating bookmarks bar and/or the info bar, |
| 1294 // we don't want any TabContents to be attached, so that we | 1294 // we don't want any TabContents to be attached, so that we |
| 1295 // avoid an unnecessary resize and re-layout of a TabContents. | 1295 // avoid an unnecessary resize and re-layout of a TabContents. |
| 1296 contents_container_->ChangeTabContents(NULL); | 1296 contents_container_->ChangeTabContents(NULL); |
| 1297 | |
| 1298 infobar_container_->ChangeTabContents(new_contents); | 1297 infobar_container_->ChangeTabContents(new_contents); |
| 1299 | |
| 1300 // Update all the UI bits. | |
| 1301 UpdateTitleBar(); | |
| 1302 toolbar_->SetProfile(new_contents->profile()); | |
| 1303 UpdateToolbar(new_contents, true); | |
| 1304 UpdateUIForContents(new_contents); | 1298 UpdateUIForContents(new_contents); |
| 1305 | |
| 1306 contents_container_->ChangeTabContents(new_contents); | 1299 contents_container_->ChangeTabContents(new_contents); |
| 1307 | 1300 |
| 1308 UpdateDevToolsForContents(new_contents); | 1301 UpdateDevToolsForContents(new_contents); |
| 1309 // TODO(beng): This should be called automatically by ChangeTabContents, but I | 1302 // TODO(beng): This should be called automatically by ChangeTabContents, but I |
| 1310 // am striving for parity now rather than cleanliness. This is | 1303 // am striving for parity now rather than cleanliness. This is |
| 1311 // required to make features like Duplicate Tab, Undo Close Tab, | 1304 // required to make features like Duplicate Tab, Undo Close Tab, |
| 1312 // etc not result in sad tab. | 1305 // etc not result in sad tab. |
| 1313 new_contents->DidBecomeSelected(); | 1306 new_contents->DidBecomeSelected(); |
| 1314 if (BrowserList::GetLastActive() == browser_ && | 1307 if (BrowserList::GetLastActive() == browser_ && |
| 1315 !browser_->tabstrip_model()->closing_all() && GetWindow()->IsVisible()) { | 1308 !browser_->tabstrip_model()->closing_all() && GetWindow()->IsVisible()) { |
| 1316 // We only restore focus if our window is visible, to avoid invoking blur | 1309 // We only restore focus if our window is visible, to avoid invoking blur |
| 1317 // handlers when we are eventually shown. | 1310 // handlers when we are eventually shown. |
| 1318 new_contents->view()->RestoreFocus(); | 1311 new_contents->view()->RestoreFocus(); |
| 1319 } | 1312 } |
| 1313 | |
| 1314 // Update all the UI bits. | |
|
Ben Goodger (Google)
2009/11/18 02:45:34
Note why the ordering here is important.
| |
| 1315 UpdateTitleBar(); | |
| 1316 toolbar_->SetProfile(new_contents->profile()); | |
| 1317 UpdateToolbar(new_contents, true); | |
| 1318 UpdateUIForContents(new_contents); | |
| 1320 } | 1319 } |
| 1321 | 1320 |
| 1322 void BrowserView::TabStripEmpty() { | 1321 void BrowserView::TabStripEmpty() { |
| 1323 // Make sure all optional UI is removed before we are destroyed, otherwise | 1322 // Make sure all optional UI is removed before we are destroyed, otherwise |
| 1324 // there will be consequences (since our view hierarchy will still have | 1323 // there will be consequences (since our view hierarchy will still have |
| 1325 // references to freed views). | 1324 // references to freed views). |
| 1326 UpdateUIForContents(NULL); | 1325 UpdateUIForContents(NULL); |
| 1327 } | 1326 } |
| 1328 | 1327 |
| 1329 /////////////////////////////////////////////////////////////////////////////// | 1328 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2282 | 2281 |
| 2283 // static | 2282 // static |
| 2284 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2283 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 2285 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2284 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 2286 } | 2285 } |
| 2287 | 2286 |
| 2288 // static | 2287 // static |
| 2289 void BrowserList::AllBrowsersClosed() { | 2288 void BrowserList::AllBrowsersClosed() { |
| 2290 views::Window::CloseAllSecondaryWindows(); | 2289 views::Window::CloseAllSecondaryWindows(); |
| 2291 } | 2290 } |
| OLD | NEW |