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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
28 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
29 #include "content/browser/tab_contents/tab_contents.h" | 29 #include "content/browser/tab_contents/tab_contents.h" |
30 #include "content/public/browser/notification_source.h" | 30 #include "content/public/browser/notification_source.h" |
31 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
32 #include "grit/theme_resources_standard.h" | 32 #include "grit/theme_resources_standard.h" |
33 #include "grit/ui_resources.h" | 33 #include "grit/ui_resources.h" |
34 #include "ui/base/animation/animation_delegate.h" | 34 #include "ui/base/animation/animation_delegate.h" |
35 #include "ui/base/animation/slide_animation.h" | 35 #include "ui/base/animation/slide_animation.h" |
36 #include "ui/base/dragdrop/gtk_dnd_util.h" | 36 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| 37 #include "ui/base/gtk/gtk_compat.h" |
37 #include "ui/base/gtk/gtk_screen_utils.h" | 38 #include "ui/base/gtk/gtk_screen_utils.h" |
38 #include "ui/base/resource/resource_bundle.h" | 39 #include "ui/base/resource/resource_bundle.h" |
39 #include "ui/gfx/gtk_util.h" | 40 #include "ui/gfx/gtk_util.h" |
40 #include "ui/gfx/image/image.h" | 41 #include "ui/gfx/image/image.h" |
41 #include "ui/gfx/point.h" | 42 #include "ui/gfx/point.h" |
42 | 43 |
43 namespace { | 44 namespace { |
44 | 45 |
45 const int kDefaultAnimationDurationMs = 100; | 46 const int kDefaultAnimationDurationMs = 100; |
46 const int kResizeLayoutAnimationDurationMs = 166; | 47 const int kResizeLayoutAnimationDurationMs = 166; |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 GdkScreen* screen = gdk_screen_get_default(); | 1605 GdkScreen* screen = gdk_screen_get_default(); |
1605 GdkDisplay* display = gdk_screen_get_display(screen); | 1606 GdkDisplay* display = gdk_screen_get_display(screen); |
1606 gint x, y; | 1607 gint x, y; |
1607 gdk_display_get_pointer(display, NULL, &x, &y, NULL); | 1608 gdk_display_get_pointer(display, NULL, &x, &y, NULL); |
1608 gfx::Point cursor_point(x, y); | 1609 gfx::Point cursor_point(x, y); |
1609 | 1610 |
1610 return bds.Contains(cursor_point); | 1611 return bds.Contains(cursor_point); |
1611 } | 1612 } |
1612 | 1613 |
1613 void TabStripGtk::ReStack() { | 1614 void TabStripGtk::ReStack() { |
1614 if (!GTK_WIDGET_REALIZED(tabstrip_.get())) { | 1615 if (!gtk_widget_get_realized(tabstrip_.get())) { |
1615 // If the window isn't realized yet, we can't stack them yet. It will be | 1616 // If the window isn't realized yet, we can't stack them yet. It will be |
1616 // done by the OnMap signal handler. | 1617 // done by the OnMap signal handler. |
1617 return; | 1618 return; |
1618 } | 1619 } |
1619 int tab_count = GetTabCount(); | 1620 int tab_count = GetTabCount(); |
1620 TabGtk* active_tab = NULL; | 1621 TabGtk* active_tab = NULL; |
1621 for (int i = tab_count - 1; i >= 0; --i) { | 1622 for (int i = tab_count - 1; i >= 0; --i) { |
1622 TabGtk* tab = GetTabAt(i); | 1623 TabGtk* tab = GetTabAt(i); |
1623 if (tab->IsActive()) | 1624 if (tab->IsActive()) |
1624 active_tab = tab; | 1625 active_tab = tab; |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 } | 2230 } |
2230 | 2231 |
2231 void TabStripGtk::SetNewTabButtonBackground() { | 2232 void TabStripGtk::SetNewTabButtonBackground() { |
2232 SkColor color = theme_service_->GetColor( | 2233 SkColor color = theme_service_->GetColor( |
2233 ThemeService::COLOR_BUTTON_BACKGROUND); | 2234 ThemeService::COLOR_BUTTON_BACKGROUND); |
2234 SkBitmap* background = theme_service_->GetBitmapNamed( | 2235 SkBitmap* background = theme_service_->GetBitmapNamed( |
2235 IDR_THEME_WINDOW_CONTROL_BACKGROUND); | 2236 IDR_THEME_WINDOW_CONTROL_BACKGROUND); |
2236 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); | 2237 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); |
2237 newtab_button_->SetBackground(color, background, mask); | 2238 newtab_button_->SetBackground(color, background, mask); |
2238 } | 2239 } |
OLD | NEW |