summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/mime_util.h2
-rw-r--r--base/mime_util_xdg.cc11
2 files changed, 11 insertions, 2 deletions
diff --git a/base/mime_util.h b/base/mime_util.h
index fd862ed..7af0472 100644
--- a/base/mime_util.h
+++ b/base/mime_util.h
@@ -24,7 +24,7 @@ BASE_EXPORT std::string GetFileMimeType(const FilePath& filepath);
// Get the mime type for a byte vector.
BASE_EXPORT std::string GetDataMimeType(const std::string& data);
-#if defined(TOOLKIT_GTK)
+#if defined(TOOLKIT_USES_GTK)
// This detects the current GTK theme by calling gtk_settings_get_default().
// It should only be executed on the UI thread and must be called before
// GetMimeIcon().
diff --git a/base/mime_util_xdg.cc b/base/mime_util_xdg.cc
index fcd8d97..efe64b3 100644
--- a/base/mime_util_xdg.cc
+++ b/base/mime_util_xdg.cc
@@ -4,7 +4,6 @@
#include "base/mime_util.h"
-#include <gtk/gtk.h>
#include <sys/time.h>
#include <time.h>
@@ -27,6 +26,10 @@
#include "base/third_party/xdg_mime/xdgmime.h"
#include "base/threading/thread_restrictions.h"
+#if defined(TOOLKIT_USES_GTK)
+#include <gtk/gtk.h>
+#endif
+
namespace {
// None of the XDG stuff is thread-safe, so serialize all access under
@@ -66,10 +69,12 @@ class MimeUtilConstants {
time_t last_check_time_;
+#if defined(TOOLKIT_USES_GTK)
// This is set by DetectGtkTheme(). We cache it so that we can access the
// theme name from threads that aren't allowed to call
// gtk_settings_get_default().
std::string gtk_theme_name_;
+#endif
private:
MimeUtilConstants()
@@ -507,10 +512,12 @@ void InitDefaultThemes() {
default_themes[1] = IconTheme::LoadTheme(kde_default_theme);
default_themes[2] = IconTheme::LoadTheme(kde_fallback_theme);
} else {
+#if defined(TOOLKIT_USES_GTK)
// Assume it's Gnome and use GTK to figure out the theme.
default_themes[1] = IconTheme::LoadTheme(
MimeUtilConstants::GetInstance()->gtk_theme_name_);
default_themes[2] = IconTheme::LoadTheme("gnome");
+#endif
}
// hicolor needs to be last per icon theme spec.
default_themes[3] = IconTheme::LoadTheme("hicolor");
@@ -567,6 +574,7 @@ std::string GetDataMimeType(const std::string& data) {
return xdg_mime_get_mime_type_for_data(data.data(), data.length(), NULL);
}
+#if defined(TOOLKIT_USES_GTK)
void DetectGtkTheme() {
// If the theme name is already loaded, do nothing. Chrome doesn't respond
// to changes in the system theme, so we never need to set this more than
@@ -584,6 +592,7 @@ void DetectGtkTheme() {
MimeUtilConstants::GetInstance()->gtk_theme_name_.assign(gtk_theme_name);
g_free(gtk_theme_name);
}
+#endif
FilePath GetMimeIcon(const std::string& mime_type, size_t size) {
base::ThreadRestrictions::AssertIOAllowed();