| 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" | |
| 25 #include "chrome/browser/gtk/custom_button.h" | 24 #include "chrome/browser/gtk/custom_button.h" |
| 26 #include "chrome/browser/gtk/gtk_chrome_button.h" | 25 #include "chrome/browser/gtk/gtk_chrome_button.h" |
| 27 #include "chrome/browser/gtk/gtk_theme_provider.h" | 26 #include "chrome/browser/gtk/gtk_theme_provider.h" |
| 28 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" | 27 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" |
| 29 #include "chrome/browser/gtk/view_id_util.h" | 28 #include "chrome/browser/gtk/view_id_util.h" |
| 30 #include "chrome/browser/metrics/user_metrics.h" | 29 #include "chrome/browser/metrics/user_metrics.h" |
| 31 #include "chrome/browser/profile.h" | 30 #include "chrome/browser/profile.h" |
| 32 #include "chrome/browser/tab_contents/tab_contents.h" | 31 #include "chrome/browser/tab_contents/tab_contents.h" |
| 33 #include "chrome/common/gtk_util.h" | 32 #include "chrome/common/gtk_util.h" |
| 34 #include "chrome/common/notification_service.h" | 33 #include "chrome/common/notification_service.h" |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 | 898 |
| 900 // Paint the background theme image. | 899 // Paint the background theme image. |
| 901 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 900 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); |
| 902 cairo_rectangle(cr, event->area.x, event->area.y, | 901 cairo_rectangle(cr, event->area.x, event->area.y, |
| 903 event->area.width, event->area.height); | 902 event->area.width, event->area.height); |
| 904 cairo_clip(cr); | 903 cairo_clip(cr); |
| 905 gfx::Point tabstrip_origin = | 904 gfx::Point tabstrip_origin = |
| 906 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); | 905 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); |
| 907 | 906 |
| 908 GtkThemeProvider* theme_provider = bar->theme_provider_; | 907 GtkThemeProvider* theme_provider = bar->theme_provider_; |
| 909 CairoCachedSurface* background = theme_provider->GetSurfaceNamed( | 908 GdkPixbuf* toolbar_background = theme_provider->GetPixbufNamed( |
| 910 IDR_THEME_TOOLBAR, widget); | 909 IDR_THEME_TOOLBAR); |
| 911 background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); | 910 gdk_cairo_set_source_pixbuf(cr, toolbar_background, tabstrip_origin.x(), |
| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 break; | 1023 break; |
| 1024 } | 1024 } |
| 1025 } | 1025 } |
| 1026 DCHECK_NE(button_idx, -1); | 1026 DCHECK_NE(button_idx, -1); |
| 1027 | 1027 |
| 1028 // Find the GtkWidget* for the actual target button. | 1028 // Find the GtkWidget* for the actual target button. |
| 1029 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1029 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1030 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1030 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1031 PopupForButton(folder_list[button_idx]); | 1031 PopupForButton(folder_list[button_idx]); |
| 1032 } | 1032 } |
| OLD | NEW |