| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
| 6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "ui/native_theme/native_theme.h" | 11 #include "ui/native_theme/native_theme.h" |
| 12 | 12 |
| 13 namespace aura { | 13 namespace aura { |
| 14 class Window; | 14 class Window; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class CommandLine; | 18 class CommandLine; |
| 19 class Environment; | 19 class Environment; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace color_utils { |
| 23 struct HSL; |
| 24 } |
| 25 |
| 22 namespace ui { | 26 namespace ui { |
| 23 class Accelerator; | 27 class Accelerator; |
| 24 } | 28 } |
| 25 | 29 |
| 26 namespace libgtkui { | 30 namespace libgtkui { |
| 27 | 31 |
| 32 // Default frame tints |
| 33 extern const color_utils::HSL kDefaultTintFrameIncognito; |
| 34 extern const color_utils::HSL kDefaultTintFrameIncognitoInactive; |
| 35 |
| 28 extern const SkColor kInvalidColorIdColor; | 36 extern const SkColor kInvalidColorIdColor; |
| 29 extern const SkColor kURLTextColor; | 37 extern const SkColor kURLTextColor; |
| 30 | 38 |
| 31 // Generates the normal URL color, a green color used in unhighlighted URL | 39 // Generates the normal URL color, a green color used in unhighlighted URL |
| 32 // text. It is a mix of |kURLTextColor| and the current text color. Unlike the | 40 // text. It is a mix of |kURLTextColor| and the current text color. Unlike the |
| 33 // selected text color, it is more important to match the qualities of the | 41 // selected text color, it is more important to match the qualities of the |
| 34 // foreground typeface color instead of taking the background into account. | 42 // foreground typeface color instead of taking the background into account. |
| 35 SkColor NormalURLColor(SkColor foreground); | 43 SkColor NormalURLColor(SkColor foreground); |
| 36 | 44 |
| 37 // Generates the selected URL color, a green color used on URL text in the | 45 // Generates the selected URL color, a green color used on URL text in the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; | 121 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; |
| 114 | 122 |
| 115 // Parses |css_selector| into a GtkStyleContext. The format is a | 123 // Parses |css_selector| into a GtkStyleContext. The format is a |
| 116 // sequence of whitespace-separated objects. Each object may have at | 124 // sequence of whitespace-separated objects. Each object may have at |
| 117 // most one object name at the beginning of the string, and any number | 125 // most one object name at the beginning of the string, and any number |
| 118 // of '.'-prefixed classes and ':'-prefixed pseudoclasses. An example | 126 // of '.'-prefixed classes and ':'-prefixed pseudoclasses. An example |
| 119 // is "GtkButton.button.suggested-action:hover:active". The caller | 127 // is "GtkButton.button.suggested-action:hover:active". The caller |
| 120 // must g_object_unref() the returned context. | 128 // must g_object_unref() the returned context. |
| 121 ScopedStyleContext GetStyleContextFromCss(const char* css_selector); | 129 ScopedStyleContext GetStyleContextFromCss(const char* css_selector); |
| 122 | 130 |
| 131 // Removes all border-type properties on |context| and all of its parents. |
| 132 void RemoveBorders(GtkStyleContext* context); |
| 133 |
| 123 // Get the 'color' property from the style context created by | 134 // Get the 'color' property from the style context created by |
| 124 // GetStyleContextFromCss(|css_selector|). | 135 // GetStyleContextFromCss(|css_selector|). |
| 125 SkColor GetFgColor(const char* css_selector); | 136 SkColor GetFgColor(const char* css_selector); |
| 126 | 137 |
| 138 // Renders the backgrounds of all ancestors of |context|, then renders |
| 139 // the background for |context| itself. |
| 140 void RenderBackground(const gfx::Size& size, |
| 141 cairo_t* cr, |
| 142 GtkStyleContext* context); |
| 143 |
| 127 // Renders a background from the style context created by | 144 // Renders a background from the style context created by |
| 128 // GetStyleContextFromCss(|css_selector|) into a single pixel and | 145 // GetStyleContextFromCss(|css_selector|) into a single pixel and |
| 129 // returns the color. | 146 // returns the color. |
| 130 SkColor GetBgColor(const char* css_selector); | 147 SkColor GetBgColor(const char* css_selector); |
| 131 | 148 |
| 132 // If there is a border, renders the border from the style context | 149 // If there is a border, renders the border from the style context |
| 133 // created by GetStyleContextFromCss(|css_selector|) into a single | 150 // created by GetStyleContextFromCss(|css_selector|) into a single |
| 134 // pixel and returns the color. Otherwise returns kInvalidColor. | 151 // pixel and returns the color. Otherwise returns kInvalidColor. |
| 135 SkColor GetBorderColor(const char* css_selector); | 152 SkColor GetBorderColor(const char* css_selector); |
| 136 #endif | 153 #endif |
| 137 | 154 |
| 138 } // namespace libgtkui | 155 } // namespace libgtkui |
| 139 | 156 |
| 140 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 157 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
| OLD | NEW |