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

Unified Diff: chrome/browser/ui/libgtkui/gtk_util.cc

Issue 2762723003: Gtk3: Whitelist X11 backend (Closed)
Patch Set: Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtkui/gtk_util.cc
diff --git a/chrome/browser/ui/libgtkui/gtk_util.cc b/chrome/browser/ui/libgtkui/gtk_util.cc
index 6c10b434ad309ddbab917b9f207390ba42f41755..c380fcef740e76e36d6c8672524b947dcd0501e6 100644
--- a/chrome/browser/ui/libgtkui/gtk_util.cc
+++ b/chrome/browser/ui/libgtkui/gtk_util.cc
@@ -53,14 +53,6 @@ void CommonInitFromCommandLine(const base::CommandLine& command_line,
}
}
-#if GTK_MAJOR_VERSION == 3
-void* GetGtk3SharedLibrary() {
- static void* gtk3lib = dlopen("libgtk-3.so.0", RTLD_LAZY);
- DCHECK(gtk3lib);
- return gtk3lib;
-}
-#endif
-
} // namespace
namespace libgtkui {
@@ -207,6 +199,22 @@ void ClearAuraTransientParent(GtkWidget* dialog) {
}
#if GTK_MAJOR_VERSION > 2
+void* GetGdkSharedLibrary() {
+ std::string lib_name =
+ "libgdk-" + std::to_string(GTK_MAJOR_VERSION) + ".so.0";
Elliot Glaysher 2017/03/20 21:01:41 Is this ever not 3?
Tom (Use chromium acct) 2017/03/20 21:04:46 For now it is, but we'll need it for gtk4 ;)
+ static void* gdk_lib = dlopen(lib_name.c_str(), RTLD_LAZY);
+ DCHECK(gdk_lib);
+ return gdk_lib;
+}
+
+void* GetGtkSharedLibrary() {
+ std::string lib_name =
+ "libgtk-" + std::to_string(GTK_MAJOR_VERSION) + ".so.0";
+ static void* gtk_lib = dlopen(lib_name.c_str(), RTLD_LAZY);
+ DCHECK(gtk_lib);
+ return gtk_lib;
+}
+
CairoSurface::CairoSurface(SkBitmap& bitmap)
: surface_(cairo_image_surface_create_for_data(
static_cast<unsigned char*>(bitmap.getAddr(0, 0)),
@@ -347,7 +355,7 @@ ScopedStyleContext AppendCssNodeToStyleContext(GtkStyleContext* context,
} else {
static auto* _gtk_widget_path_iter_set_object_name =
reinterpret_cast<void (*)(GtkWidgetPath*, gint, const char*)>(dlsym(
- GetGtk3SharedLibrary(), "gtk_widget_path_iter_set_object_name"));
+ GetGtkSharedLibrary(), "gtk_widget_path_iter_set_object_name"));
switch (part_type) {
case CSS_NAME: {
if (GtkVersionCheck(3, 20)) {
@@ -393,7 +401,7 @@ ScopedStyleContext AppendCssNodeToStyleContext(GtkStyleContext* context,
if (GtkVersionCheck(3, 14)) {
static auto* _gtk_widget_path_iter_set_state =
reinterpret_cast<void (*)(GtkWidgetPath*, gint, GtkStateFlags)>(
- dlsym(GetGtk3SharedLibrary(), "gtk_widget_path_iter_set_state"));
+ dlsym(GetGtkSharedLibrary(), "gtk_widget_path_iter_set_state"));
DCHECK(_gtk_widget_path_iter_set_state);
_gtk_widget_path_iter_set_state(path, -1, state);
}
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698