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

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

Issue 8769017: GTK: Move CairoCachedSurface from being owned by GtkThemeService to gfx::Image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase for commit 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
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/gtk_util.h" 5 #include "chrome/browser/ui/gtk/gtk_util.h"
6 6
7 #include <cairo/cairo.h> 7 #include <cairo/cairo.h>
8 8
9 #include <cstdarg> 9 #include <cstdarg>
10 10
11 #include <map> 11 #include <map>
12 12
13 #include "base/environment.h" 13 #include "base/environment.h"
14 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
15 #include "base/linux_util.h" 15 #include "base/linux_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/nix/xdg_util.h" 17 #include "base/nix/xdg_util.h"
18 #include "base/string_number_conversions.h" 18 #include "base/string_number_conversions.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/autocomplete/autocomplete.h" 20 #include "chrome/browser/autocomplete/autocomplete.h"
21 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 21 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
22 #include "chrome/browser/autocomplete/autocomplete_match.h" 22 #include "chrome/browser/autocomplete/autocomplete_match.h"
23 #include "chrome/browser/event_disposition.h" 23 #include "chrome/browser/event_disposition.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/ui/browser_list.h" 25 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/browser_window.h" 26 #include "chrome/browser/ui/browser_window.h"
27 #include "chrome/browser/ui/gtk/cairo_cached_surface.h"
28 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 27 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
29 #include "content/browser/disposition_utils.h" 28 #include "content/browser/disposition_utils.h"
30 #include "content/browser/renderer_host/render_view_host.h" 29 #include "content/browser/renderer_host/render_view_host.h"
31 #include "content/browser/tab_contents/tab_contents.h" 30 #include "content/browser/tab_contents/tab_contents.h"
32 #include "content/public/common/renderer_preferences.h" 31 #include "content/public/common/renderer_preferences.h"
33 #include "googleurl/src/gurl.h" 32 #include "googleurl/src/gurl.h"
34 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
35 #include "grit/theme_resources_standard.h" 34 #include "grit/theme_resources_standard.h"
36 #include "third_party/skia/include/core/SkBitmap.h" 35 #include "third_party/skia/include/core/SkBitmap.h"
37 #include "third_party/skia/include/core/SkColor.h" 36 #include "third_party/skia/include/core/SkColor.h"
38 #include "ui/base/events.h" 37 #include "ui/base/events.h"
39 #include "ui/base/gtk/gtk_compat.h" 38 #include "ui/base/gtk/gtk_compat.h"
40 #include "ui/base/gtk/gtk_hig_constants.h" 39 #include "ui/base/gtk/gtk_hig_constants.h"
41 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
42 #include "ui/base/resource/resource_bundle.h" 41 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/base/text/text_elider.h" 42 #include "ui/base/text/text_elider.h"
44 #include "ui/base/x/x11_util.h" 43 #include "ui/base/x/x11_util.h"
45 #include "ui/gfx/gtk_util.h" 44 #include "ui/gfx/gtk_util.h"
45 #include "ui/gfx/image/cairo_cached_surface.h"
46 #include "ui/gfx/image/image.h" 46 #include "ui/gfx/image/image.h"
47 47
48 #if defined(OS_CHROMEOS) 48 #if defined(OS_CHROMEOS)
49 #include "chrome/browser/chromeos/frame/browser_view.h" 49 #include "chrome/browser/chromeos/frame/browser_view.h"
50 #include "chrome/browser/chromeos/native_dialog_window.h" 50 #include "chrome/browser/chromeos/native_dialog_window.h"
51 #else 51 #else
52 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 52 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
53 #endif 53 #endif
54 54
55 // These conflict with base/tracked_objects.h, so need to come last. 55 // These conflict with base/tracked_objects.h, so need to come last.
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 GtkThemeService* theme_service) { 794 GtkThemeService* theme_service) {
795 // Fill the entire region with the toolbar color. 795 // Fill the entire region with the toolbar color.
796 GdkColor color = theme_service->GetGdkColor( 796 GdkColor color = theme_service->GetGdkColor(
797 ThemeService::COLOR_TOOLBAR); 797 ThemeService::COLOR_TOOLBAR);
798 gdk_cairo_set_source_color(cr, &color); 798 gdk_cairo_set_source_color(cr, &color);
799 cairo_fill(cr); 799 cairo_fill(cr);
800 800
801 // The toolbar is supposed to blend in with the active tab, so we have to pass 801 // The toolbar is supposed to blend in with the active tab, so we have to pass
802 // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the 802 // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the
803 // tab strip. 803 // tab strip.
804 CairoCachedSurface* background = theme_service->GetSurfaceNamed( 804 gfx::CairoCachedSurface* background = theme_service->GetSurfaceNamed(
805 IDR_THEME_TOOLBAR, widget); 805 IDR_THEME_TOOLBAR, widget);
806 background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); 806 background->SetSource(cr, widget, tabstrip_origin.x(), tabstrip_origin.y());
807 // We tile the toolbar background in both directions. 807 // We tile the toolbar background in both directions.
808 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); 808 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
809 cairo_rectangle(cr, 809 cairo_rectangle(cr,
810 tabstrip_origin.x(), 810 tabstrip_origin.x(),
811 tabstrip_origin.y(), 811 tabstrip_origin.y(),
812 event->area.x + event->area.width - tabstrip_origin.x(), 812 event->area.x + event->area.width - tabstrip_origin.x(),
813 event->area.y + event->area.height - tabstrip_origin.y()); 813 event->area.y + event->area.height - tabstrip_origin.y());
814 cairo_fill(cr); 814 cairo_fill(cr);
815 } 815 }
816 816
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 1205
1206 void DoCopy(BrowserWindow* window) { 1206 void DoCopy(BrowserWindow* window) {
1207 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); 1207 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard");
1208 } 1208 }
1209 1209
1210 void DoPaste(BrowserWindow* window) { 1210 void DoPaste(BrowserWindow* window) {
1211 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); 1211 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard");
1212 } 1212 }
1213 1213
1214 } // namespace gtk_util 1214 } // namespace gtk_util
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.cc ('k') | chrome/browser/ui/gtk/location_bar_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698