| OLD | NEW |
| 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/gtk/browser_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 // the model has already removed |contents| from its list, so | 1209 // the model has already removed |contents| from its list, so |
| 1210 // chrome::GetActiveWebContents(browser_.get()) will return NULL or something | 1210 // chrome::GetActiveWebContents(browser_.get()) will return NULL or something |
| 1211 // else. | 1211 // else. |
| 1212 if (index == browser_->active_index()) { | 1212 if (index == browser_->active_index()) { |
| 1213 infobar_container_->ChangeTabContents(NULL); | 1213 infobar_container_->ChangeTabContents(NULL); |
| 1214 UpdateDevToolsForContents(NULL); | 1214 UpdateDevToolsForContents(NULL); |
| 1215 } | 1215 } |
| 1216 contents_container_->DetachTab(contents); | 1216 contents_container_->DetachTab(contents); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 void BrowserWindowGtk::ActiveTabChanged(TabContents* old_contents, | 1219 void BrowserWindowGtk::ActiveTabChanged(WebContents* old_contents, |
| 1220 TabContents* new_contents, | 1220 WebContents* new_contents, |
| 1221 int index, | 1221 int index, |
| 1222 bool user_gesture) { | 1222 bool user_gesture) { |
| 1223 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::ActiveTabChanged"); | 1223 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::ActiveTabChanged"); |
| 1224 if (old_contents && !old_contents->in_destructor()) | 1224 if (old_contents && !old_contents->IsBeingDestroyed()) |
| 1225 old_contents->web_contents()->GetView()->StoreFocus(); | 1225 old_contents->GetView()->StoreFocus(); |
| 1226 | 1226 |
| 1227 // Update various elements that are interested in knowing the current | 1227 // Update various elements that are interested in knowing the current |
| 1228 // WebContents. | 1228 // WebContents. |
| 1229 UpdateDevToolsForContents(new_contents->web_contents()); | 1229 UpdateDevToolsForContents(new_contents); |
| 1230 InfoBarTabHelper* new_infobar_tab_helper = | 1230 InfoBarTabHelper* new_infobar_tab_helper = |
| 1231 InfoBarTabHelper::FromWebContents(new_contents->web_contents()); | 1231 InfoBarTabHelper::FromWebContents(new_contents); |
| 1232 infobar_container_->ChangeTabContents(new_infobar_tab_helper); | 1232 infobar_container_->ChangeTabContents(new_infobar_tab_helper); |
| 1233 contents_container_->SetTab(new_contents); | 1233 contents_container_->SetTab(TabContents::FromWebContents(new_contents)); |
| 1234 | 1234 |
| 1235 // TODO(estade): after we manage browser activation, add a check to make sure | 1235 // TODO(estade): after we manage browser activation, add a check to make sure |
| 1236 // we are the active browser before calling RestoreFocus(). | 1236 // we are the active browser before calling RestoreFocus(). |
| 1237 if (!browser_->tab_strip_model()->closing_all()) { | 1237 if (!browser_->tab_strip_model()->closing_all()) { |
| 1238 new_contents->web_contents()->GetView()->RestoreFocus(); | 1238 new_contents->GetView()->RestoreFocus(); |
| 1239 FindTabHelper* find_tab_helper = | 1239 FindTabHelper* find_tab_helper = |
| 1240 FindTabHelper::FromWebContents(new_contents->web_contents()); | 1240 FindTabHelper::FromWebContents(new_contents); |
| 1241 if (find_tab_helper->find_ui_active()) | 1241 if (find_tab_helper->find_ui_active()) |
| 1242 browser_->GetFindBarController()->find_bar()->SetFocusAndSelection(); | 1242 browser_->GetFindBarController()->find_bar()->SetFocusAndSelection(); |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 // Update all the UI bits. | 1245 // Update all the UI bits. |
| 1246 UpdateTitleBar(); | 1246 UpdateTitleBar(); |
| 1247 MaybeShowBookmarkBar(false); | 1247 MaybeShowBookmarkBar(false); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { | 1250 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 wm_type == ui::WM_OPENBOX || | 2423 wm_type == ui::WM_OPENBOX || |
| 2424 wm_type == ui::WM_XFWM4); | 2424 wm_type == ui::WM_XFWM4); |
| 2425 } | 2425 } |
| 2426 | 2426 |
| 2427 // static | 2427 // static |
| 2428 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2428 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2429 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2429 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
| 2430 browser_window_gtk->Init(); | 2430 browser_window_gtk->Init(); |
| 2431 return browser_window_gtk; | 2431 return browser_window_gtk; |
| 2432 } | 2432 } |
| OLD | NEW |