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 = NULL; |
blundell
2014/03/31 08:29:22
Optional thought for a follow-up CL: You use this
Peter Kasting
2014/03/31 20:05:34
This comment made me glance at this code (which I
droger
2014/04/01 10:48:34
InfoBarService::FromWebContents() indeed returns N
| |
806 InfoBarService::FromWebContents(new_contents)); | 806 InfoBarService* infobar_service = |
807 InfoBarService::FromWebContents(new_contents); | |
808 if (infobar_service) | |
809 infobar_manager = infobar_service->infobar_manager(); | |
810 infobar_container_->ChangeInfoBarManager(infobar_manager); | |
807 contents_container_->SetTab(new_contents); | 811 contents_container_->SetTab(new_contents); |
808 UpdateDevToolsForContents(new_contents); | 812 UpdateDevToolsForContents(new_contents); |
809 | 813 |
810 // TODO(estade): after we manage browser activation, add a check to make sure | 814 // TODO(estade): after we manage browser activation, add a check to make sure |
811 // we are the active browser before calling RestoreFocus(). | 815 // we are the active browser before calling RestoreFocus(). |
812 if (!browser_->tab_strip_model()->closing_all()) { | 816 if (!browser_->tab_strip_model()->closing_all()) { |
813 new_contents->GetView()->RestoreFocus(); | 817 new_contents->GetView()->RestoreFocus(); |
814 FindTabHelper* find_tab_helper = | 818 FindTabHelper* find_tab_helper = |
815 FindTabHelper::FromWebContents(new_contents); | 819 FindTabHelper::FromWebContents(new_contents); |
816 if (find_tab_helper->find_ui_active()) | 820 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. | 1282 // The profile avatar icon may have changed. |
1279 gtk_util::SetWindowIcon(window_, browser_->profile()); | 1283 gtk_util::SetWindowIcon(window_, browser_->profile()); |
1280 } | 1284 } |
1281 | 1285 |
1282 void BrowserWindowGtk::TabDetachedAt(WebContents* contents, int index) { | 1286 void BrowserWindowGtk::TabDetachedAt(WebContents* contents, int index) { |
1283 // We use index here rather than comparing |contents| because by this time | 1287 // We use index here rather than comparing |contents| because by this time |
1284 // the model has already removed |contents| from its list, so | 1288 // the model has already removed |contents| from its list, so |
1285 // browser_->tab_strip_model()->GetActiveWebContents() will return NULL or | 1289 // browser_->tab_strip_model()->GetActiveWebContents() will return NULL or |
1286 // something else. | 1290 // something else. |
1287 if (index == browser_->tab_strip_model()->active_index()) { | 1291 if (index == browser_->tab_strip_model()->active_index()) { |
1288 infobar_container_->ChangeInfoBarService(NULL); | 1292 infobar_container_->ChangeInfoBarManager(NULL); |
1289 UpdateDevToolsForContents(NULL); | 1293 UpdateDevToolsForContents(NULL); |
1290 } | 1294 } |
1291 contents_container_->DetachTab(contents); | 1295 contents_container_->DetachTab(contents); |
1292 } | 1296 } |
1293 | 1297 |
1294 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { | 1298 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { |
1295 // Do nothing if we're in the process of closing the browser window. | 1299 // Do nothing if we're in the process of closing the browser window. |
1296 if (!window_) | 1300 if (!window_) |
1297 return; | 1301 return; |
1298 | 1302 |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2375 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2379 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
2376 browser_window_gtk->Init(); | 2380 browser_window_gtk->Init(); |
2377 return browser_window_gtk; | 2381 return browser_window_gtk; |
2378 } | 2382 } |
2379 | 2383 |
2380 // static | 2384 // static |
2381 chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( | 2385 chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( |
2382 chrome::HostDesktopType desktop_type) { | 2386 chrome::HostDesktopType desktop_type) { |
2383 return desktop_type; | 2387 return desktop_type; |
2384 } | 2388 } |
OLD | NEW |