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

Unified Diff: base/mime_util_xdg.cc

Issue 8501030: aura: Make the Linux version of IconLoader not require GTK+. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move platform-specific include Created 9 years, 1 month 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 | « base/mime_util.h ('k') | build/common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mime_util_xdg.cc
diff --git a/base/mime_util_xdg.cc b/base/mime_util_xdg.cc
index fcd8d97576c802a60adf9050513383ca21434c0e..efe64b39d47004c0bfa00cfb55314cdcc5c238f3 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();
« no previous file with comments | « base/mime_util.h ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698