| 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 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // it above |parent|. Do nothing if |parent| is NULL. | 61 // it above |parent|. Do nothing if |parent| is NULL. |
| 62 void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent); | 62 void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent); |
| 63 | 63 |
| 64 // Gets the transient parent aura window for |dialog|. | 64 // Gets the transient parent aura window for |dialog|. |
| 65 aura::Window* GetAuraTransientParent(GtkWidget* dialog); | 65 aura::Window* GetAuraTransientParent(GtkWidget* dialog); |
| 66 | 66 |
| 67 // Clears the transient parent for |dialog|. | 67 // Clears the transient parent for |dialog|. |
| 68 void ClearAuraTransientParent(GtkWidget* dialog); | 68 void ClearAuraTransientParent(GtkWidget* dialog); |
| 69 | 69 |
| 70 #if GTK_MAJOR_VERSION > 2 | 70 #if GTK_MAJOR_VERSION > 2 |
| 71 // These constants are defined in gtk/gtkenums.h in Gtk3.12 or later. |
| 72 // They are added here as a convenience to avoid version checks, and |
| 73 // can be removed once the sysroot is switched from Wheezy to Jessie. |
| 74 #define GTK_STATE_FLAG_LINK static_cast<GtkStateFlags>(1 << 9) |
| 75 #define GTK_STATE_FLAG_VISITED static_cast<GtkStateFlags>(1 << 10) |
| 76 #define GTK_STATE_FLAG_CHECKED static_cast<GtkStateFlags>(1 << 11) |
| 77 |
| 71 // Returns true iff the runtime version of Gtk used meets | 78 // Returns true iff the runtime version of Gtk used meets |
| 72 // |major|.|minor|.|micro|. | 79 // |major|.|minor|.|micro|. |
| 73 bool GtkVersionCheck(int major, int minor = 0, int micro = 0); | 80 bool GtkVersionCheck(int major, int minor = 0, int micro = 0); |
| 74 | 81 |
| 75 template <typename T> | 82 template <typename T> |
| 76 class ScopedGObject { | 83 class ScopedGObject { |
| 77 public: | 84 public: |
| 78 explicit ScopedGObject(T* obj) : obj_(obj) { | 85 explicit ScopedGObject(T* obj) : obj_(obj) { |
| 79 // Increase the reference count of |obj_|, removing the floating | 86 // Increase the reference count of |obj_|, removing the floating |
| 80 // reference if it has one. | 87 // reference if it has one. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 142 |
| 136 // If there is a border, renders the border from the style context | 143 // If there is a border, renders the border from the style context |
| 137 // created by GetStyleContextFromCss(|css_selector|) into a single | 144 // created by GetStyleContextFromCss(|css_selector|) into a single |
| 138 // pixel and returns the color. Otherwise returns kInvalidColor. | 145 // pixel and returns the color. Otherwise returns kInvalidColor. |
| 139 SkColor GetBorderColor(const char* css_selector); | 146 SkColor GetBorderColor(const char* css_selector); |
| 140 #endif | 147 #endif |
| 141 | 148 |
| 142 } // namespace libgtkui | 149 } // namespace libgtkui |
| 143 | 150 |
| 144 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 151 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
| OLD | NEW |