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/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
10 #include "app/gtk_dnd_util.h" | 10 #include "app/gtk_dnd_util.h" |
11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
13 #include "base/gfx/gtk_util.h" | 13 #include "base/gfx/gtk_util.h" |
14 #include "base/pickle.h" | 14 #include "base/pickle.h" |
15 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 15 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
16 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
17 #include "chrome/browser/bookmarks/bookmark_utils.h" | 17 #include "chrome/browser/bookmarks/bookmark_utils.h" |
18 #include "chrome/browser/browser.h" | 18 #include "chrome/browser/browser.h" |
19 #include "chrome/browser/gtk/bookmark_context_menu.h" | 19 #include "chrome/browser/gtk/bookmark_context_menu.h" |
20 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h" | 20 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h" |
21 #include "chrome/browser/gtk/bookmark_tree_model.h" | 21 #include "chrome/browser/gtk/bookmark_tree_model.h" |
22 #include "chrome/browser/gtk/bookmark_utils_gtk.h" | 22 #include "chrome/browser/gtk/bookmark_utils_gtk.h" |
23 #include "chrome/browser/gtk/browser_window_gtk.h" | 23 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 24 #include "chrome/browser/gtk/cairo_cached_surface.h" |
24 #include "chrome/browser/gtk/custom_button.h" | 25 #include "chrome/browser/gtk/custom_button.h" |
25 #include "chrome/browser/gtk/gtk_chrome_button.h" | 26 #include "chrome/browser/gtk/gtk_chrome_button.h" |
26 #include "chrome/browser/gtk/gtk_theme_provider.h" | 27 #include "chrome/browser/gtk/gtk_theme_provider.h" |
27 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" | 28 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" |
28 #include "chrome/browser/gtk/view_id_util.h" | 29 #include "chrome/browser/gtk/view_id_util.h" |
29 #include "chrome/browser/metrics/user_metrics.h" | 30 #include "chrome/browser/metrics/user_metrics.h" |
30 #include "chrome/browser/profile.h" | 31 #include "chrome/browser/profile.h" |
31 #include "chrome/browser/tab_contents/tab_contents.h" | 32 #include "chrome/browser/tab_contents/tab_contents.h" |
32 #include "chrome/common/gtk_util.h" | 33 #include "chrome/common/gtk_util.h" |
33 #include "chrome/common/notification_service.h" | 34 #include "chrome/common/notification_service.h" |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 | 901 |
901 // Paint the background theme image. | 902 // Paint the background theme image. |
902 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 903 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); |
903 cairo_rectangle(cr, event->area.x, event->area.y, | 904 cairo_rectangle(cr, event->area.x, event->area.y, |
904 event->area.width, event->area.height); | 905 event->area.width, event->area.height); |
905 cairo_clip(cr); | 906 cairo_clip(cr); |
906 gfx::Point tabstrip_origin = | 907 gfx::Point tabstrip_origin = |
907 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); | 908 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); |
908 | 909 |
909 GtkThemeProvider* theme_provider = bar->theme_provider_; | 910 GtkThemeProvider* theme_provider = bar->theme_provider_; |
910 GdkPixbuf* toolbar_background = theme_provider->GetPixbufNamed( | 911 CairoCachedSurface* background = theme_provider->GetSurfaceNamed( |
911 IDR_THEME_TOOLBAR); | 912 IDR_THEME_TOOLBAR, widget); |
912 gdk_cairo_set_source_pixbuf(cr, toolbar_background, tabstrip_origin.x(), | 913 background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); |
913 tabstrip_origin.y()); | |
914 // We tile the toolbar background in both directions. | 914 // We tile the toolbar background in both directions. |
915 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 915 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
916 cairo_rectangle(cr, | 916 cairo_rectangle(cr, |
917 tabstrip_origin.x(), | 917 tabstrip_origin.x(), |
918 tabstrip_origin.y(), | 918 tabstrip_origin.y(), |
919 event->area.x + event->area.width - tabstrip_origin.x(), | 919 event->area.x + event->area.width - tabstrip_origin.x(), |
920 event->area.y + event->area.height - tabstrip_origin.y()); | 920 event->area.y + event->area.height - tabstrip_origin.y()); |
921 cairo_fill(cr); | 921 cairo_fill(cr); |
922 cairo_destroy(cr); | 922 cairo_destroy(cr); |
923 | 923 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 break; | 1025 break; |
1026 } | 1026 } |
1027 } | 1027 } |
1028 DCHECK_NE(button_idx, -1); | 1028 DCHECK_NE(button_idx, -1); |
1029 | 1029 |
1030 // Find the GtkWidget* for the actual target button. | 1030 // Find the GtkWidget* for the actual target button. |
1031 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1031 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
1032 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1032 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
1033 PopupForButton(folder_list[button_idx]); | 1033 PopupForButton(folder_list[button_idx]); |
1034 } | 1034 } |
OLD | NEW |