| 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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 DCHECK(index >= 0 && index < GetTabCount()); | 843 DCHECK(index >= 0 && index < GetTabCount()); |
| 844 return tab_data_.at(index).ideal_bounds; | 844 return tab_data_.at(index).ideal_bounds; |
| 845 } | 845 } |
| 846 | 846 |
| 847 gfx::Point TabStripGtk::GetTabStripOriginForWidget(GtkWidget* target) { | 847 gfx::Point TabStripGtk::GetTabStripOriginForWidget(GtkWidget* target) { |
| 848 int x, y; | 848 int x, y; |
| 849 if (!gtk_widget_translate_coordinates(widget(), target, | 849 if (!gtk_widget_translate_coordinates(widget(), target, |
| 850 -widget()->allocation.x, 0, &x, &y)) { | 850 -widget()->allocation.x, 0, &x, &y)) { |
| 851 // If the tab strip isn't showing, give the coordinates relative to the | 851 // If the tab strip isn't showing, give the coordinates relative to the |
| 852 // toplevel instead. | 852 // toplevel instead. |
| 853 gtk_widget_translate_coordinates( | 853 if (!gtk_widget_translate_coordinates( |
| 854 gtk_widget_get_toplevel(widget()), target, 0, 0, &x, &y); | 854 gtk_widget_get_toplevel(widget()), target, 0, 0, &x, &y)) { |
| 855 NOTREACHED(); |
| 856 } |
| 855 } | 857 } |
| 856 if (GTK_WIDGET_NO_WINDOW(target)) { | 858 if (GTK_WIDGET_NO_WINDOW(target)) { |
| 857 x += target->allocation.x; | 859 x += target->allocation.x; |
| 858 y += target->allocation.y; | 860 y += target->allocation.y; |
| 859 } | 861 } |
| 860 return gfx::Point(x, y); | 862 return gfx::Point(x, y); |
| 861 } | 863 } |
| 862 | 864 |
| 863 //////////////////////////////////////////////////////////////////////////////// | 865 //////////////////////////////////////////////////////////////////////////////// |
| 864 // TabStripGtk, TabStripModelObserver implementation: | 866 // TabStripGtk, TabStripModelObserver implementation: |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 message.set_type(TabOverviewTypes::Message::WM_SWITCH_TO_OVERVIEW_MODE); | 1935 message.set_type(TabOverviewTypes::Message::WM_SWITCH_TO_OVERVIEW_MODE); |
| 1934 GtkWidget* browser_widget = GTK_WIDGET( | 1936 GtkWidget* browser_widget = GTK_WIDGET( |
| 1935 static_cast<BrowserWindowGtk*>(browser->window())->GetNativeHandle()); | 1937 static_cast<BrowserWindowGtk*>(browser->window())->GetNativeHandle()); |
| 1936 message.set_param(0, x11_util::GetX11WindowFromGtkWidget(browser_widget)); | 1938 message.set_param(0, x11_util::GetX11WindowFromGtkWidget(browser_widget)); |
| 1937 TabOverviewTypes::instance()->SendMessage(message); | 1939 TabOverviewTypes::instance()->SendMessage(message); |
| 1938 | 1940 |
| 1939 UserMetrics::RecordAction(L"TabOverview_PressedTabOverviewButton", | 1941 UserMetrics::RecordAction(L"TabOverview_PressedTabOverviewButton", |
| 1940 tabstrip->model_->profile()); | 1942 tabstrip->model_->profile()); |
| 1941 } | 1943 } |
| 1942 #endif | 1944 #endif |
| OLD | NEW |