| 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/find_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/find_bar_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 gtk_util::DrawThemedToolbarBackground(widget, cr, e, tabstrip_origin, | 894 gtk_util::DrawThemedToolbarBackground(widget, cr, e, tabstrip_origin, |
| 895 bar->theme_service_); | 895 bar->theme_service_); |
| 896 | 896 |
| 897 // During chrome theme mode, we need to draw the border around content_hbox | 897 // During chrome theme mode, we need to draw the border around content_hbox |
| 898 // now instead of when we render |border_bin_|. We don't use stacked event | 898 // now instead of when we render |border_bin_|. We don't use stacked event |
| 899 // boxes to simulate the effect because we need to blend them with this | 899 // boxes to simulate the effect because we need to blend them with this |
| 900 // background. | 900 // background. |
| 901 GtkAllocation border_allocation = bar->border_bin_->allocation; | 901 GtkAllocation border_allocation = bar->border_bin_->allocation; |
| 902 | 902 |
| 903 // Blit the left part of the background image once on the left. | 903 // Blit the left part of the background image once on the left. |
| 904 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 904 gfx::CairoCachedSurface* background_left = | 905 gfx::CairoCachedSurface* background_left = |
| 905 bar->theme_service_->GetRTLEnabledSurfaceNamed( | 906 rb.GetRTLEnabledImageNamed(IDR_FIND_BOX_BACKGROUND_LEFT).ToCairo(); |
| 906 IDR_FIND_BOX_BACKGROUND_LEFT, widget); | |
| 907 background_left->SetSource(cr, widget, | 907 background_left->SetSource(cr, widget, |
| 908 border_allocation.x, border_allocation.y); | 908 border_allocation.x, border_allocation.y); |
| 909 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 909 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 910 cairo_rectangle(cr, border_allocation.x, border_allocation.y, | 910 cairo_rectangle(cr, border_allocation.x, border_allocation.y, |
| 911 background_left->Width(), background_left->Height()); | 911 background_left->Width(), background_left->Height()); |
| 912 cairo_fill(cr); | 912 cairo_fill(cr); |
| 913 | 913 |
| 914 // Blit the center part of the background image in all the space between. | 914 // Blit the center part of the background image in all the space between. |
| 915 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | |
| 916 gfx::CairoCachedSurface* background = | 915 gfx::CairoCachedSurface* background = |
| 917 rb.GetNativeImageNamed(IDR_FIND_BOX_BACKGROUND).ToCairo(); | 916 rb.GetNativeImageNamed(IDR_FIND_BOX_BACKGROUND).ToCairo(); |
| 918 background->SetSource(cr, widget, | 917 background->SetSource(cr, widget, |
| 919 border_allocation.x + background_left->Width(), | 918 border_allocation.x + background_left->Width(), |
| 920 border_allocation.y); | 919 border_allocation.y); |
| 921 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 920 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 922 cairo_rectangle(cr, | 921 cairo_rectangle(cr, |
| 923 border_allocation.x + background_left->Width(), | 922 border_allocation.x + background_left->Width(), |
| 924 border_allocation.y, | 923 border_allocation.y, |
| 925 border_allocation.width - background_left->Width(), | 924 border_allocation.width - background_left->Width(), |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 return FALSE; // Continue propagation. | 986 return FALSE; // Continue propagation. |
| 988 } | 987 } |
| 989 | 988 |
| 990 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) { | 989 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) { |
| 991 g_signal_handlers_disconnect_by_func( | 990 g_signal_handlers_disconnect_by_func( |
| 992 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 991 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
| 993 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this); | 992 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this); |
| 994 | 993 |
| 995 return FALSE; // Continue propagation. | 994 return FALSE; // Continue propagation. |
| 996 } | 995 } |
| OLD | NEW |