Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/browser/ui/gtk/find_bar_gtk.cc

Issue 8866002: GTK: Stamp out GtkThemeService::GetSurfaceNamed(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/gtk/gtk_theme_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
36 #include "content/public/browser/notification_source.h" 36 #include "content/public/browser/notification_source.h"
37 #include "content/public/browser/native_web_keyboard_event.h" 37 #include "content/public/browser/native_web_keyboard_event.h"
38 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
39 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
40 #include "grit/theme_resources_standard.h" 40 #include "grit/theme_resources_standard.h"
41 #include "ui/base/gtk/gtk_floating_container.h" 41 #include "ui/base/gtk/gtk_floating_container.h"
42 #include "ui/base/gtk/gtk_hig_constants.h" 42 #include "ui/base/gtk/gtk_hig_constants.h"
43 #include "ui/base/l10n/l10n_util.h" 43 #include "ui/base/l10n/l10n_util.h"
44 #include "ui/base/resource/resource_bundle.h" 44 #include "ui/base/resource/resource_bundle.h"
45 #include "ui/gfx/image/cairo_cached_surface.h" 45 #include "ui/gfx/image/cairo_cached_surface.h"
46 #include "ui/gfx/image/image.h"
46 47
47 namespace { 48 namespace {
48 49
49 // Used as the color of the text in the entry box and the text for the results 50 // Used as the color of the text in the entry box and the text for the results
50 // label for failure searches. 51 // label for failure searches.
51 const GdkColor& kEntryTextColor = ui::kGdkBlack; 52 const GdkColor& kEntryTextColor = ui::kGdkBlack;
52 53
53 // Used as the color of the background of the entry box and the background of 54 // Used as the color of the background of the entry box and the background of
54 // the find label for successful searches. 55 // the find label for successful searches.
55 const GdkColor& kEntryBackgroundColor = ui::kGdkWhite; 56 const GdkColor& kEntryBackgroundColor = ui::kGdkWhite;
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 bar->theme_service_->GetRTLEnabledSurfaceNamed( 895 bar->theme_service_->GetRTLEnabledSurfaceNamed(
895 IDR_FIND_BOX_BACKGROUND_LEFT, widget); 896 IDR_FIND_BOX_BACKGROUND_LEFT, widget);
896 background_left->SetSource(cr, widget, 897 background_left->SetSource(cr, widget,
897 border_allocation.x, border_allocation.y); 898 border_allocation.x, border_allocation.y);
898 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); 899 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
899 cairo_rectangle(cr, border_allocation.x, border_allocation.y, 900 cairo_rectangle(cr, border_allocation.x, border_allocation.y,
900 background_left->Width(), background_left->Height()); 901 background_left->Width(), background_left->Height());
901 cairo_fill(cr); 902 cairo_fill(cr);
902 903
903 // Blit the center part of the background image in all the space between. 904 // Blit the center part of the background image in all the space between.
904 gfx::CairoCachedSurface* background = bar->theme_service_->GetSurfaceNamed( 905 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
905 IDR_FIND_BOX_BACKGROUND, widget); 906 gfx::CairoCachedSurface* background =
907 rb.GetNativeImageNamed(IDR_FIND_BOX_BACKGROUND).ToCairo();
906 background->SetSource(cr, widget, 908 background->SetSource(cr, widget,
907 border_allocation.x + background_left->Width(), 909 border_allocation.x + background_left->Width(),
908 border_allocation.y); 910 border_allocation.y);
909 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); 911 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
910 cairo_rectangle(cr, 912 cairo_rectangle(cr,
911 border_allocation.x + background_left->Width(), 913 border_allocation.x + background_left->Width(),
912 border_allocation.y, 914 border_allocation.y,
913 border_allocation.width - background_left->Width(), 915 border_allocation.width - background_left->Width(),
914 background->Height()); 916 background->Height());
915 cairo_fill(cr); 917 cairo_fill(cr);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 return FALSE; // Continue propagation. 977 return FALSE; // Continue propagation.
976 } 978 }
977 979
978 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) { 980 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) {
979 g_signal_handlers_disconnect_by_func( 981 g_signal_handlers_disconnect_by_func(
980 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), 982 gdk_keymap_get_for_display(gtk_widget_get_display(entry)),
981 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this); 983 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this);
982 984
983 return FALSE; // Continue propagation. 985 return FALSE; // Continue propagation.
984 } 986 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/gtk/gtk_theme_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698