| 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/gtk/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas_paint.h" | 7 #include "app/gfx/canvas_paint.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "app/slide_animation.h" | 10 #include "app/slide_animation.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 Layout(); | 615 Layout(); |
| 616 } | 616 } |
| 617 | 617 |
| 618 gfx::Rect TabStripGtk::GetIdealBounds(int index) { | 618 gfx::Rect TabStripGtk::GetIdealBounds(int index) { |
| 619 DCHECK(index >= 0 && index < GetTabCount()); | 619 DCHECK(index >= 0 && index < GetTabCount()); |
| 620 return tab_data_.at(index).ideal_bounds; | 620 return tab_data_.at(index).ideal_bounds; |
| 621 } | 621 } |
| 622 | 622 |
| 623 gfx::Point TabStripGtk::GetTabStripOriginForWidget(GtkWidget* target) { | 623 gfx::Point TabStripGtk::GetTabStripOriginForWidget(GtkWidget* target) { |
| 624 int x, y; | 624 int x, y; |
| 625 if (!gtk_widget_translate_coordinates(widget(), target, 0, 0, &x, &y)) { | 625 if (!gtk_widget_translate_coordinates(widget(), target, |
| 626 -widget()->allocation.x, 0, &x, &y)) { |
| 626 // If the tab strip isn't showing, give the coordinates relative to the | 627 // If the tab strip isn't showing, give the coordinates relative to the |
| 627 // toplevel instead. | 628 // toplevel instead. |
| 628 gtk_widget_translate_coordinates( | 629 gtk_widget_translate_coordinates( |
| 629 gtk_widget_get_toplevel(widget()), target, 0, 0, &x, &y); | 630 gtk_widget_get_toplevel(widget()), target, 0, 0, &x, &y); |
| 630 } | 631 } |
| 631 if (GTK_WIDGET_NO_WINDOW(target)) { | 632 if (GTK_WIDGET_NO_WINDOW(target)) { |
| 632 x += target->allocation.x; | 633 x += target->allocation.x; |
| 633 y += target->allocation.y; | 634 y += target->allocation.y; |
| 634 } | 635 } |
| 635 return gfx::Point(x, y); | 636 return gfx::Point(x, y); |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1592 DCHECK(browser); // In order for the user to click on the tab there should | 1593 DCHECK(browser); // In order for the user to click on the tab there should |
| 1593 // be an active browser. | 1594 // be an active browser. |
| 1594 TabOverviewTypes::Message message; | 1595 TabOverviewTypes::Message message; |
| 1595 message.set_type(TabOverviewTypes::Message::WM_SWITCH_TO_OVERVIEW_MODE); | 1596 message.set_type(TabOverviewTypes::Message::WM_SWITCH_TO_OVERVIEW_MODE); |
| 1596 GtkWidget* browser_widget = GTK_WIDGET( | 1597 GtkWidget* browser_widget = GTK_WIDGET( |
| 1597 static_cast<BrowserWindowGtk*>(browser->window())->GetNativeHandle()); | 1598 static_cast<BrowserWindowGtk*>(browser->window())->GetNativeHandle()); |
| 1598 message.set_param(0, x11_util::GetX11WindowFromGtkWidget(browser_widget)); | 1599 message.set_param(0, x11_util::GetX11WindowFromGtkWidget(browser_widget)); |
| 1599 TabOverviewTypes::instance()->SendMessage(message); | 1600 TabOverviewTypes::instance()->SendMessage(message); |
| 1600 } | 1601 } |
| 1601 #endif | 1602 #endif |
| OLD | NEW |