OLD | NEW |
1 | 1 |
2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 6 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/environment.h" | 13 #include "base/environment.h" |
14 #include "base/nix/xdg_util.h" | 14 #include "base/nix/xdg_util.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/themes/theme_service_factory.h" | 18 #include "chrome/browser/themes/theme_service_factory.h" |
19 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" | 21 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" |
22 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" | 22 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" |
23 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 23 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
24 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 24 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
25 #include "chrome/browser/ui/gtk/gtk_util.h" | 25 #include "chrome/browser/ui/gtk/gtk_util.h" |
26 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" | 26 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" |
27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "content/browser/user_metrics.h" | 29 #include "content/browser/user_metrics.h" |
| 30 #include "content/public/browser/notification_details.h" |
30 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
31 #include "content/public/browser/notification_details.h" | |
32 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
33 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
34 #include "grit/theme_resources_standard.h" | 34 #include "grit/theme_resources_standard.h" |
35 #include "grit/ui_resources.h" | 35 #include "grit/ui_resources.h" |
36 #include "third_party/skia/include/core/SkBitmap.h" | 36 #include "third_party/skia/include/core/SkBitmap.h" |
37 #include "third_party/skia/include/core/SkCanvas.h" | 37 #include "third_party/skia/include/core/SkCanvas.h" |
38 #include "third_party/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
39 #include "third_party/skia/include/core/SkShader.h" | 39 #include "third_party/skia/include/core/SkShader.h" |
40 #include "ui/base/gtk/gtk_hig_constants.h" | 40 #include "ui/base/gtk/gtk_hig_constants.h" |
41 #include "ui/base/gtk/gtk_signal_registrar.h" | 41 #include "ui/base/gtk/gtk_signal_registrar.h" |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 0, gradient_size, lighter, base); | 1058 0, gradient_size, lighter, base); |
1059 SkPaint paint; | 1059 SkPaint paint; |
1060 paint.setStyle(SkPaint::kFill_Style); | 1060 paint.setStyle(SkPaint::kFill_Style); |
1061 paint.setAntiAlias(true); | 1061 paint.setAntiAlias(true); |
1062 paint.setShader(shader); | 1062 paint.setShader(shader); |
1063 shader->unref(); | 1063 shader->unref(); |
1064 | 1064 |
1065 canvas.DrawRectInt(0, 0, kToolbarImageWidth, gradient_size, paint); | 1065 canvas.DrawRectInt(0, 0, kToolbarImageWidth, gradient_size, paint); |
1066 } | 1066 } |
1067 | 1067 |
1068 canvas.FillRectInt(base, 0, gradient_size, | 1068 canvas.FillRect(base, gfx::Rect(0, gradient_size, |
1069 kToolbarImageWidth, | 1069 kToolbarImageWidth, |
1070 kToolbarImageHeight - gradient_size); | 1070 kToolbarImageHeight - gradient_size)); |
1071 return new SkBitmap(canvas.ExtractBitmap()); | 1071 return new SkBitmap(canvas.ExtractBitmap()); |
1072 } | 1072 } |
1073 | 1073 |
1074 SkBitmap* GtkThemeService::GenerateTabImage(int base_id) const { | 1074 SkBitmap* GtkThemeService::GenerateTabImage(int base_id) const { |
1075 SkBitmap* base_image = GetBitmapNamed(base_id); | 1075 SkBitmap* base_image = GetBitmapNamed(base_id); |
1076 SkBitmap bg_tint = SkBitmapOperations::CreateHSLShiftedBitmap( | 1076 SkBitmap bg_tint = SkBitmapOperations::CreateHSLShiftedBitmap( |
1077 *base_image, GetTint(ThemeService::TINT_BACKGROUND_TAB)); | 1077 *base_image, GetTint(ThemeService::TINT_BACKGROUND_TAB)); |
1078 return new SkBitmap(SkBitmapOperations::CreateTiledBitmap( | 1078 return new SkBitmap(SkBitmapOperations::CreateTiledBitmap( |
1079 bg_tint, 0, 0, bg_tint.width(), bg_tint.height())); | 1079 bg_tint, 0, 0, bg_tint.width(), bg_tint.height())); |
1080 } | 1080 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 cairo_set_line_width(cr, 1.0); | 1198 cairo_set_line_width(cr, 1.0); |
1199 cairo_move_to(cr, start_x, widget->allocation.y); | 1199 cairo_move_to(cr, start_x, widget->allocation.y); |
1200 cairo_line_to(cr, start_x, | 1200 cairo_line_to(cr, start_x, |
1201 widget->allocation.y + widget->allocation.height); | 1201 widget->allocation.y + widget->allocation.height); |
1202 cairo_stroke(cr); | 1202 cairo_stroke(cr); |
1203 cairo_destroy(cr); | 1203 cairo_destroy(cr); |
1204 cairo_pattern_destroy(pattern); | 1204 cairo_pattern_destroy(pattern); |
1205 | 1205 |
1206 return TRUE; | 1206 return TRUE; |
1207 } | 1207 } |
OLD | NEW |