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/find_bar_gtk.h" | 5 #include "chrome/browser/gtk/find_bar_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/gfx/gtk_util.h" | 10 #include "base/gfx/gtk_util.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
13 #include "chrome/browser/profile.h" | 13 #include "chrome/browser/profile.h" |
14 #include "chrome/browser/find_bar_controller.h" | 14 #include "chrome/browser/find_bar_controller.h" |
15 #include "chrome/browser/gtk/browser_window_gtk.h" | 15 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 16 #include "chrome/browser/gtk/cairo_cached_surface.h" |
16 #include "chrome/browser/gtk/custom_button.h" | 17 #include "chrome/browser/gtk/custom_button.h" |
17 #include "chrome/browser/gtk/gtk_theme_provider.h" | 18 #include "chrome/browser/gtk/gtk_theme_provider.h" |
18 #include "chrome/browser/gtk/nine_box.h" | 19 #include "chrome/browser/gtk/nine_box.h" |
19 #include "chrome/browser/gtk/slide_animator_gtk.h" | 20 #include "chrome/browser/gtk/slide_animator_gtk.h" |
20 #include "chrome/browser/gtk/tab_contents_container_gtk.h" | 21 #include "chrome/browser/gtk/tab_contents_container_gtk.h" |
21 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" | 22 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" |
22 #include "chrome/browser/gtk/view_id_util.h" | 23 #include "chrome/browser/gtk/view_id_util.h" |
23 #include "chrome/browser/tab_contents/tab_contents.h" | 24 #include "chrome/browser/tab_contents/tab_contents.h" |
24 #include "chrome/common/gtk_util.h" | 25 #include "chrome/common/gtk_util.h" |
25 #include "chrome/common/notification_service.h" | 26 #include "chrome/common/notification_service.h" |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 bar->container_width_ = widget->allocation.width; | 756 bar->container_width_ = widget->allocation.width; |
756 bar->container_height_ = widget->allocation.height; | 757 bar->container_height_ = widget->allocation.height; |
757 } | 758 } |
758 | 759 |
759 // Draw the background theme image. | 760 // Draw the background theme image. |
760 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 761 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); |
761 cairo_rectangle(cr, e->area.x, e->area.y, e->area.width, e->area.height); | 762 cairo_rectangle(cr, e->area.x, e->area.y, e->area.width, e->area.height); |
762 cairo_clip(cr); | 763 cairo_clip(cr); |
763 gfx::Point tabstrip_origin = | 764 gfx::Point tabstrip_origin = |
764 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); | 765 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); |
765 GdkPixbuf* background = bar->browser_->profile()->GetThemeProvider()-> | 766 CairoCachedSurface* background = bar->theme_provider_->GetSurfaceNamed( |
766 GetPixbufNamed(IDR_THEME_TOOLBAR); | 767 IDR_THEME_TOOLBAR, widget); |
767 gdk_cairo_set_source_pixbuf(cr, background, | 768 background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); |
768 tabstrip_origin.x(), tabstrip_origin.y()); | |
769 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 769 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
770 cairo_rectangle(cr, tabstrip_origin.x(), tabstrip_origin.y(), | 770 cairo_rectangle(cr, tabstrip_origin.x(), tabstrip_origin.y(), |
771 e->area.x + e->area.width - tabstrip_origin.x(), | 771 e->area.x + e->area.width - tabstrip_origin.x(), |
772 gdk_pixbuf_get_height(background)); | 772 background->Height()); |
773 cairo_fill(cr); | 773 cairo_fill(cr); |
774 cairo_destroy(cr); | 774 cairo_destroy(cr); |
775 | 775 |
776 // Draw the border. | 776 // Draw the border. |
777 GetDialogBorder()->RenderToWidget(widget); | 777 GetDialogBorder()->RenderToWidget(widget); |
778 } | 778 } |
779 | 779 |
780 // Propagate to the container's child. | 780 // Propagate to the container's child. |
781 GtkWidget* child = gtk_bin_get_child(GTK_BIN(widget)); | 781 GtkWidget* child = gtk_bin_get_child(GTK_BIN(widget)); |
782 if (child) | 782 if (child) |
(...skipping 11 matching lines...) Expand all Loading... |
794 } | 794 } |
795 | 795 |
796 // static | 796 // static |
797 gboolean FindBarGtk::OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, | 797 gboolean FindBarGtk::OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, |
798 FindBarGtk* find_bar) { | 798 FindBarGtk* find_bar) { |
799 find_bar->StoreOutsideFocus(); | 799 find_bar->StoreOutsideFocus(); |
800 | 800 |
801 // Continue propagating the event. | 801 // Continue propagating the event. |
802 return FALSE; | 802 return FALSE; |
803 } | 803 } |
OLD | NEW |