| 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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 | 1280 |
| 1281 void BrowserView::TabSelectedAt(TabContents* old_contents, | 1281 void BrowserView::TabSelectedAt(TabContents* old_contents, |
| 1282 TabContents* new_contents, | 1282 TabContents* new_contents, |
| 1283 int index, | 1283 int index, |
| 1284 bool user_gesture) { | 1284 bool user_gesture) { |
| 1285 DCHECK(old_contents != new_contents); | 1285 DCHECK(old_contents != new_contents); |
| 1286 | 1286 |
| 1287 // Update various elements that are interested in knowing the current | 1287 // Update various elements that are interested in knowing the current |
| 1288 // TabContents. | 1288 // TabContents. |
| 1289 | 1289 |
| 1290 // When we toggle the NTP floating bookmarks bar, | 1290 // When we toggle the NTP floating bookmarks bar and/or the info bar, |
| 1291 // we don't want any TabContents to be attached, so that we | 1291 // we don't want any TabContents to be attached, so that we |
| 1292 // avoid an unnecessary resize and re-layout of a TabContents. | 1292 // avoid an unnecessary resize and re-layout of a TabContents. |
| 1293 contents_container_->ChangeTabContents(NULL); | 1293 contents_container_->ChangeTabContents(NULL); |
| 1294 | |
| 1295 infobar_container_->ChangeTabContents(new_contents); | 1294 infobar_container_->ChangeTabContents(new_contents); |
| 1296 | |
| 1297 // Update all the UI bits. | |
| 1298 UpdateTitleBar(); | |
| 1299 toolbar_->SetProfile(new_contents->profile()); | |
| 1300 UpdateToolbar(new_contents, true); | |
| 1301 UpdateUIForContents(new_contents); | 1295 UpdateUIForContents(new_contents); |
| 1302 | |
| 1303 contents_container_->ChangeTabContents(new_contents); | 1296 contents_container_->ChangeTabContents(new_contents); |
| 1304 | 1297 |
| 1305 UpdateDevToolsForContents(new_contents); | 1298 UpdateDevToolsForContents(new_contents); |
| 1306 // TODO(beng): This should be called automatically by ChangeTabContents, but I | 1299 // TODO(beng): This should be called automatically by ChangeTabContents, but I |
| 1307 // am striving for parity now rather than cleanliness. This is | 1300 // am striving for parity now rather than cleanliness. This is |
| 1308 // required to make features like Duplicate Tab, Undo Close Tab, | 1301 // required to make features like Duplicate Tab, Undo Close Tab, |
| 1309 // etc not result in sad tab. | 1302 // etc not result in sad tab. |
| 1310 new_contents->DidBecomeSelected(); | 1303 new_contents->DidBecomeSelected(); |
| 1311 if (BrowserList::GetLastActive() == browser_ && | 1304 if (BrowserList::GetLastActive() == browser_ && |
| 1312 !browser_->tabstrip_model()->closing_all() && GetWindow()->IsVisible()) { | 1305 !browser_->tabstrip_model()->closing_all() && GetWindow()->IsVisible()) { |
| 1313 // We only restore focus if our window is visible, to avoid invoking blur | 1306 // We only restore focus if our window is visible, to avoid invoking blur |
| 1314 // handlers when we are eventually shown. | 1307 // handlers when we are eventually shown. |
| 1315 new_contents->view()->RestoreFocus(); | 1308 new_contents->view()->RestoreFocus(); |
| 1316 } | 1309 } |
| 1310 |
| 1311 // Update all the UI bits. |
| 1312 UpdateTitleBar(); |
| 1313 toolbar_->SetProfile(new_contents->profile()); |
| 1314 UpdateToolbar(new_contents, true); |
| 1315 UpdateUIForContents(new_contents); |
| 1317 } | 1316 } |
| 1318 | 1317 |
| 1319 void BrowserView::TabStripEmpty() { | 1318 void BrowserView::TabStripEmpty() { |
| 1320 // Make sure all optional UI is removed before we are destroyed, otherwise | 1319 // Make sure all optional UI is removed before we are destroyed, otherwise |
| 1321 // there will be consequences (since our view hierarchy will still have | 1320 // there will be consequences (since our view hierarchy will still have |
| 1322 // references to freed views). | 1321 // references to freed views). |
| 1323 UpdateUIForContents(NULL); | 1322 UpdateUIForContents(NULL); |
| 1324 } | 1323 } |
| 1325 | 1324 |
| 1326 /////////////////////////////////////////////////////////////////////////////// | 1325 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 955 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 |