| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 TabGtk* first_tab = GetTabAt(0); | 1091 TabGtk* first_tab = GetTabAt(0); |
| 1092 int w = Round(first_tab->IsSelected() ? selected : unselected); | 1092 int w = Round(first_tab->IsSelected() ? selected : unselected); |
| 1093 | 1093 |
| 1094 // We only want to run the animation if we're not already at the desired | 1094 // We only want to run the animation if we're not already at the desired |
| 1095 // size. | 1095 // size. |
| 1096 if (abs(first_tab->width() - w) > 1) | 1096 if (abs(first_tab->width() - w) > 1) |
| 1097 StartResizeLayoutAnimation(); | 1097 StartResizeLayoutAnimation(); |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 bool TabStripGtk::IsCursorInTabStripZone() const { | 1100 bool TabStripGtk::IsCursorInTabStripZone() const { |
| 1101 gfx::Point tabstrip_topleft; |
| 1102 gtk_util::ConvertWidgetPointToScreen(tabstrip_.get(), &tabstrip_topleft); |
| 1103 |
| 1101 gfx::Rect bds = bounds(); | 1104 gfx::Rect bds = bounds(); |
| 1102 gfx::Point tabstrip_topleft(bds.origin()); | |
| 1103 gtk_util::ConvertWidgetPointToScreen(tabstrip_.get(), &tabstrip_topleft); | |
| 1104 bds.set_origin(tabstrip_topleft); | 1105 bds.set_origin(tabstrip_topleft); |
| 1105 bds.set_height(bds.height() + kTabStripAnimationVSlop); | 1106 bds.set_height(bds.height() + kTabStripAnimationVSlop); |
| 1106 | 1107 |
| 1107 GdkScreen* screen = gdk_screen_get_default(); | 1108 GdkScreen* screen = gdk_screen_get_default(); |
| 1108 GdkDisplay* display = gdk_screen_get_display(screen); | 1109 GdkDisplay* display = gdk_screen_get_display(screen); |
| 1109 gint x, y; | 1110 gint x, y; |
| 1110 gdk_display_get_pointer(display, NULL, &x, &y, NULL); | 1111 gdk_display_get_pointer(display, NULL, &x, &y, NULL); |
| 1111 gfx::Point cursor_point(x, y); | 1112 gfx::Point cursor_point(x, y); |
| 1112 | 1113 |
| 1113 return bds.Contains(cursor_point); | 1114 return bds.Contains(cursor_point); |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 message.set_type(TabOverviewTypes::Message::WM_SWITCH_TO_OVERVIEW_MODE); | 1619 message.set_type(TabOverviewTypes::Message::WM_SWITCH_TO_OVERVIEW_MODE); |
| 1619 GtkWidget* browser_widget = GTK_WIDGET( | 1620 GtkWidget* browser_widget = GTK_WIDGET( |
| 1620 static_cast<BrowserWindowGtk*>(browser->window())->GetNativeHandle()); | 1621 static_cast<BrowserWindowGtk*>(browser->window())->GetNativeHandle()); |
| 1621 message.set_param(0, x11_util::GetX11WindowFromGtkWidget(browser_widget)); | 1622 message.set_param(0, x11_util::GetX11WindowFromGtkWidget(browser_widget)); |
| 1622 TabOverviewTypes::instance()->SendMessage(message); | 1623 TabOverviewTypes::instance()->SendMessage(message); |
| 1623 | 1624 |
| 1624 UserMetrics::RecordAction(L"TabOverview_PressedTabOverviewButton", | 1625 UserMetrics::RecordAction(L"TabOverview_PressedTabOverviewButton", |
| 1625 tabstrip->model_->profile()); | 1626 tabstrip->model_->profile()); |
| 1626 } | 1627 } |
| 1627 #endif | 1628 #endif |
| OLD | NEW |