| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> |
| 7 #include <algorithm> | 8 #include <algorithm> |
| 8 #include <gtk/gtk.h> | |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete.h" | 14 #include "chrome/browser/autocomplete/autocomplete.h" |
| 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 16 #include "chrome/browser/autocomplete/autocomplete_match.h" | 16 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/tabs/tab_strip_model_delegate.h" | 18 #include "chrome/browser/tabs/tab_strip_model_delegate.h" |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 int x, y; | 922 int x, y; |
| 923 if (!gtk_widget_translate_coordinates(widget(), target, | 923 if (!gtk_widget_translate_coordinates(widget(), target, |
| 924 -widget()->allocation.x, 0, &x, &y)) { | 924 -widget()->allocation.x, 0, &x, &y)) { |
| 925 // If the tab strip isn't showing, give the coordinates relative to the | 925 // If the tab strip isn't showing, give the coordinates relative to the |
| 926 // toplevel instead. | 926 // toplevel instead. |
| 927 if (!gtk_widget_translate_coordinates( | 927 if (!gtk_widget_translate_coordinates( |
| 928 gtk_widget_get_toplevel(widget()), target, 0, 0, &x, &y)) { | 928 gtk_widget_get_toplevel(widget()), target, 0, 0, &x, &y)) { |
| 929 NOTREACHED(); | 929 NOTREACHED(); |
| 930 } | 930 } |
| 931 } | 931 } |
| 932 if (GTK_WIDGET_NO_WINDOW(target)) { | 932 if (!gtk_widget_get_has_window(target)) { |
| 933 x += target->allocation.x; | 933 GtkAllocation allocation; |
| 934 y += target->allocation.y; | 934 gtk_widget_get_allocation(target, &allocation); |
| 935 x += allocation.x; |
| 936 y += allocation.y; |
| 935 } | 937 } |
| 936 return gfx::Point(x, y); | 938 return gfx::Point(x, y); |
| 937 } | 939 } |
| 938 | 940 |
| 939 //////////////////////////////////////////////////////////////////////////////// | 941 //////////////////////////////////////////////////////////////////////////////// |
| 940 // ViewIDUtil::Delegate implementation | 942 // ViewIDUtil::Delegate implementation |
| 941 | 943 |
| 942 GtkWidget* TabStripGtk::GetWidgetForViewID(ViewID view_id) { | 944 GtkWidget* TabStripGtk::GetWidgetForViewID(ViewID view_id) { |
| 943 if (GetTabCount() > 0) { | 945 if (GetTabCount() > 0) { |
| 944 if (view_id == VIEW_ID_TAB_LAST) { | 946 if (view_id == VIEW_ID_TAB_LAST) { |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 } | 2228 } |
| 2227 | 2229 |
| 2228 void TabStripGtk::SetNewTabButtonBackground() { | 2230 void TabStripGtk::SetNewTabButtonBackground() { |
| 2229 SkColor color = theme_service_->GetColor( | 2231 SkColor color = theme_service_->GetColor( |
| 2230 ThemeService::COLOR_BUTTON_BACKGROUND); | 2232 ThemeService::COLOR_BUTTON_BACKGROUND); |
| 2231 SkBitmap* background = theme_service_->GetBitmapNamed( | 2233 SkBitmap* background = theme_service_->GetBitmapNamed( |
| 2232 IDR_THEME_WINDOW_CONTROL_BACKGROUND); | 2234 IDR_THEME_WINDOW_CONTROL_BACKGROUND); |
| 2233 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); | 2235 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); |
| 2234 newtab_button_->SetBackground(color, background, mask); | 2236 newtab_button_->SetBackground(color, background, mask); |
| 2235 } | 2237 } |
| OLD | NEW |