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 InfoBarManager* infobar_manager = |
806 InfoBarService::FromWebContents(new_contents)); | 806 InfoBarService::InfoBarManagerFromWebContents(new_contents); |
| 807 infobar_container_->ChangeInfoBarManager(infobar_manager); |
807 contents_container_->SetTab(new_contents); | 808 contents_container_->SetTab(new_contents); |
808 UpdateDevToolsForContents(new_contents); | 809 UpdateDevToolsForContents(new_contents); |
809 | 810 |
810 // TODO(estade): after we manage browser activation, add a check to make sure | 811 // TODO(estade): after we manage browser activation, add a check to make sure |
811 // we are the active browser before calling RestoreFocus(). | 812 // we are the active browser before calling RestoreFocus(). |
812 if (!browser_->tab_strip_model()->closing_all()) { | 813 if (!browser_->tab_strip_model()->closing_all()) { |
813 new_contents->GetView()->RestoreFocus(); | 814 new_contents->GetView()->RestoreFocus(); |
814 FindTabHelper* find_tab_helper = | 815 FindTabHelper* find_tab_helper = |
815 FindTabHelper::FromWebContents(new_contents); | 816 FindTabHelper::FromWebContents(new_contents); |
816 if (find_tab_helper->find_ui_active()) | 817 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. | 1279 // The profile avatar icon may have changed. |
1279 gtk_util::SetWindowIcon(window_, browser_->profile()); | 1280 gtk_util::SetWindowIcon(window_, browser_->profile()); |
1280 } | 1281 } |
1281 | 1282 |
1282 void BrowserWindowGtk::TabDetachedAt(WebContents* contents, int index) { | 1283 void BrowserWindowGtk::TabDetachedAt(WebContents* contents, int index) { |
1283 // We use index here rather than comparing |contents| because by this time | 1284 // We use index here rather than comparing |contents| because by this time |
1284 // the model has already removed |contents| from its list, so | 1285 // the model has already removed |contents| from its list, so |
1285 // browser_->tab_strip_model()->GetActiveWebContents() will return NULL or | 1286 // browser_->tab_strip_model()->GetActiveWebContents() will return NULL or |
1286 // something else. | 1287 // something else. |
1287 if (index == browser_->tab_strip_model()->active_index()) { | 1288 if (index == browser_->tab_strip_model()->active_index()) { |
1288 infobar_container_->ChangeInfoBarService(NULL); | 1289 infobar_container_->ChangeInfoBarManager(NULL); |
1289 UpdateDevToolsForContents(NULL); | 1290 UpdateDevToolsForContents(NULL); |
1290 } | 1291 } |
1291 contents_container_->DetachTab(contents); | 1292 contents_container_->DetachTab(contents); |
1292 } | 1293 } |
1293 | 1294 |
1294 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { | 1295 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { |
1295 // Do nothing if we're in the process of closing the browser window. | 1296 // Do nothing if we're in the process of closing the browser window. |
1296 if (!window_) | 1297 if (!window_) |
1297 return; | 1298 return; |
1298 | 1299 |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2376 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
2376 browser_window_gtk->Init(); | 2377 browser_window_gtk->Init(); |
2377 return browser_window_gtk; | 2378 return browser_window_gtk; |
2378 } | 2379 } |
2379 | 2380 |
2380 // static | 2381 // static |
2381 chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( | 2382 chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( |
2382 chrome::HostDesktopType desktop_type) { | 2383 chrome::HostDesktopType desktop_type) { |
2383 return desktop_type; | 2384 return desktop_type; |
2384 } | 2385 } |
OLD | NEW |