| 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/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
| 14 #include "base/environment.h" | 14 #include "base/environment.h" |
| 15 #include "base/nix/xdg_util.h" | 15 #include "base/nix/xdg_util.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/themes/theme_service_factory.h" | 19 #include "chrome/browser/themes/theme_service_factory.h" |
| 20 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
| 21 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.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" | |
| 30 #include "content/public/browser/notification_details.h" | 29 #include "content/public/browser/notification_details.h" |
| 31 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
| 32 #include "content/public/browser/notification_source.h" | 31 #include "content/public/browser/notification_source.h" |
| 32 #include "content/public/browser/user_metrics.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" |
| 42 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
| 43 #include "ui/gfx/canvas_skia.h" | 43 #include "ui/gfx/canvas_skia.h" |
| 44 #include "ui/gfx/color_utils.h" | 44 #include "ui/gfx/color_utils.h" |
| 45 #include "ui/gfx/gtk_util.h" | 45 #include "ui/gfx/gtk_util.h" |
| 46 #include "ui/gfx/image/cairo_cached_surface.h" | 46 #include "ui/gfx/image/cairo_cached_surface.h" |
| 47 #include "ui/gfx/image/image.h" | 47 #include "ui/gfx/image/image.h" |
| 48 #include "ui/gfx/skbitmap_operations.h" | 48 #include "ui/gfx/skbitmap_operations.h" |
| 49 #include "ui/gfx/skia_util.h" | 49 #include "ui/gfx/skia_util.h" |
| 50 #include "ui/gfx/skia_utils_gtk.h" | 50 #include "ui/gfx/skia_utils_gtk.h" |
| 51 | 51 |
| 52 using content::UserMetricsAction; |
| 53 |
| 52 namespace { | 54 namespace { |
| 53 | 55 |
| 54 // The size of the rendered toolbar image. | 56 // The size of the rendered toolbar image. |
| 55 const int kToolbarImageWidth = 64; | 57 const int kToolbarImageWidth = 64; |
| 56 const int kToolbarImageHeight = 128; | 58 const int kToolbarImageHeight = 128; |
| 57 | 59 |
| 58 // How much to tint the GTK+ color lighter at the top of the window. | 60 // How much to tint the GTK+ color lighter at the top of the window. |
| 59 const color_utils::HSL kGtkFrameShift = { -1, -1, 0.58 }; | 61 const color_utils::HSL kGtkFrameShift = { -1, -1, 0.58 }; |
| 60 | 62 |
| 61 // How much to tint the GTK+ color when an explicit frame color hasn't been | 63 // How much to tint the GTK+ color when an explicit frame color hasn't been |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 cairo_new_path(cr); | 1230 cairo_new_path(cr); |
| 1229 cairo_set_line_width(cr, 1.0); | 1231 cairo_set_line_width(cr, 1.0); |
| 1230 cairo_move_to(cr, start_x, allocation.y); | 1232 cairo_move_to(cr, start_x, allocation.y); |
| 1231 cairo_line_to(cr, start_x, allocation.y + allocation.height); | 1233 cairo_line_to(cr, start_x, allocation.y + allocation.height); |
| 1232 cairo_stroke(cr); | 1234 cairo_stroke(cr); |
| 1233 cairo_destroy(cr); | 1235 cairo_destroy(cr); |
| 1234 cairo_pattern_destroy(pattern); | 1236 cairo_pattern_destroy(pattern); |
| 1235 | 1237 |
| 1236 return TRUE; | 1238 return TRUE; |
| 1237 } | 1239 } |
| OLD | NEW |