Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 795 void BrowserWindowGtk::OnActiveTabChanged(WebContents* old_contents, | 795 void BrowserWindowGtk::OnActiveTabChanged(WebContents* old_contents, |
| 796 WebContents* new_contents, | 796 WebContents* new_contents, |
| 797 int index, | 797 int index, |
| 798 int reason) { | 798 int reason) { |
| 799 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::ActiveTabChanged"); | 799 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::ActiveTabChanged"); |
| 800 if (old_contents && !old_contents->IsBeingDestroyed()) | 800 if (old_contents && !old_contents->IsBeingDestroyed()) |
| 801 old_contents->GetView()->StoreFocus(); | 801 old_contents->GetView()->StoreFocus(); |
| 802 | 802 |
| 803 // Update various elements that are interested in knowing the current | 803 // Update various elements that are interested in knowing the current |
| 804 // WebContents. | 804 // WebContents. |
| 805 infobar_container_->ChangeInfoBarService( | 805 infobar_container_->ChangeInfoBarManager( |
| 806 InfoBarService::FromWebContents(new_contents)); | 806 &InfoBarService::FromWebContents(new_contents)->infobar_manager()); |
|
blundell
2014/03/27 09:40:30
Do you know the InfoBarService won't be NULL?
| |
| 807 contents_container_->SetTab(new_contents); | 807 contents_container_->SetTab(new_contents); |
| 808 UpdateDevToolsForContents(new_contents); | 808 UpdateDevToolsForContents(new_contents); |
| 809 | 809 |
| 810 // TODO(estade): after we manage browser activation, add a check to make sure | 810 // TODO(estade): after we manage browser activation, add a check to make sure |
| 811 // we are the active browser before calling RestoreFocus(). | 811 // we are the active browser before calling RestoreFocus(). |
| 812 if (!browser_->tab_strip_model()->closing_all()) { | 812 if (!browser_->tab_strip_model()->closing_all()) { |
| 813 new_contents->GetView()->RestoreFocus(); | 813 new_contents->GetView()->RestoreFocus(); |
| 814 FindTabHelper* find_tab_helper = | 814 FindTabHelper* find_tab_helper = |
| 815 FindTabHelper::FromWebContents(new_contents); | 815 FindTabHelper::FromWebContents(new_contents); |
| 816 if (find_tab_helper->find_ui_active()) | 816 if (find_tab_helper->find_ui_active()) |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1278 // The profile avatar icon may have changed. | 1278 // The profile avatar icon may have changed. |
| 1279 gtk_util::SetWindowIcon(window_, browser_->profile()); | 1279 gtk_util::SetWindowIcon(window_, browser_->profile()); |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 void BrowserWindowGtk::TabDetachedAt(WebContents* contents, int index) { | 1282 void BrowserWindowGtk::TabDetachedAt(WebContents* contents, int index) { |
| 1283 // We use index here rather than comparing |contents| because by this time | 1283 // We use index here rather than comparing |contents| because by this time |
| 1284 // the model has already removed |contents| from its list, so | 1284 // the model has already removed |contents| from its list, so |
| 1285 // browser_->tab_strip_model()->GetActiveWebContents() will return NULL or | 1285 // browser_->tab_strip_model()->GetActiveWebContents() will return NULL or |
| 1286 // something else. | 1286 // something else. |
| 1287 if (index == browser_->tab_strip_model()->active_index()) { | 1287 if (index == browser_->tab_strip_model()->active_index()) { |
| 1288 infobar_container_->ChangeInfoBarService(NULL); | 1288 infobar_container_->ChangeInfoBarManager(NULL); |
| 1289 UpdateDevToolsForContents(NULL); | 1289 UpdateDevToolsForContents(NULL); |
| 1290 } | 1290 } |
| 1291 contents_container_->DetachTab(contents); | 1291 contents_container_->DetachTab(contents); |
| 1292 } | 1292 } |
| 1293 | 1293 |
| 1294 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { | 1294 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { |
| 1295 // Do nothing if we're in the process of closing the browser window. | 1295 // Do nothing if we're in the process of closing the browser window. |
| 1296 if (!window_) | 1296 if (!window_) |
| 1297 return; | 1297 return; |
| 1298 | 1298 |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2375 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2375 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
| 2376 browser_window_gtk->Init(); | 2376 browser_window_gtk->Init(); |
| 2377 return browser_window_gtk; | 2377 return browser_window_gtk; |
| 2378 } | 2378 } |
| 2379 | 2379 |
| 2380 // static | 2380 // static |
| 2381 chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( | 2381 chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( |
| 2382 chrome::HostDesktopType desktop_type) { | 2382 chrome::HostDesktopType desktop_type) { |
| 2383 return desktop_type; | 2383 return desktop_type; |
| 2384 } | 2384 } |
| OLD | NEW |