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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 899 |
899 // Paint the background theme image. | 900 // Paint the background theme image. |
900 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 901 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); |
901 cairo_rectangle(cr, event->area.x, event->area.y, | 902 cairo_rectangle(cr, event->area.x, event->area.y, |
902 event->area.width, event->area.height); | 903 event->area.width, event->area.height); |
903 cairo_clip(cr); | 904 cairo_clip(cr); |
904 gfx::Point tabstrip_origin = | 905 gfx::Point tabstrip_origin = |
905 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); | 906 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); |
906 | 907 |
907 GtkThemeProvider* theme_provider = bar->theme_provider_; | 908 GtkThemeProvider* theme_provider = bar->theme_provider_; |
908 GdkPixbuf* toolbar_background = theme_provider->GetPixbufNamed( | 909 CairoCachedSurface* background = theme_provider->GetSurfaceNamed( |
909 IDR_THEME_TOOLBAR); | 910 IDR_THEME_TOOLBAR, widget); |
910 gdk_cairo_set_source_pixbuf(cr, toolbar_background, tabstrip_origin.x(), | 911 background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); |
911 tabstrip_origin.y()); | |
912 // We tile the toolbar background in both directions. | 912 // We tile the toolbar background in both directions. |
913 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 913 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
914 cairo_rectangle(cr, | 914 cairo_rectangle(cr, |
915 tabstrip_origin.x(), | 915 tabstrip_origin.x(), |
916 tabstrip_origin.y(), | 916 tabstrip_origin.y(), |
917 event->area.x + event->area.width - tabstrip_origin.x(), | 917 event->area.x + event->area.width - tabstrip_origin.x(), |
918 event->area.y + event->area.height - tabstrip_origin.y()); | 918 event->area.y + event->area.height - tabstrip_origin.y()); |
919 cairo_fill(cr); | 919 cairo_fill(cr); |
920 cairo_destroy(cr); | 920 cairo_destroy(cr); |
921 | 921 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 break; | 1016 break; |
1017 } | 1017 } |
1018 } | 1018 } |
1019 DCHECK_NE(button_idx, -1); | 1019 DCHECK_NE(button_idx, -1); |
1020 | 1020 |
1021 // Find the GtkWidget* for the actual target button. | 1021 // Find the GtkWidget* for the actual target button. |
1022 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1022 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
1023 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1023 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
1024 PopupForButton(folder_list[button_idx]); | 1024 PopupForButton(folder_list[button_idx]); |
1025 } | 1025 } |
OLD | NEW |