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

Unified Diff: base/nix/mime_util_xdg.cc

Issue 12230026: linux: Both gtk and the aura port should set the icon theme name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for thestig Created 7 years, 10 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 | « base/nix/mime_util_xdg.h ('k') | chrome/browser/icon_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/nix/mime_util_xdg.cc
diff --git a/base/nix/mime_util_xdg.cc b/base/nix/mime_util_xdg.cc
index 63760bdebd896b6628380c5631cbd21d0b27fbc1..affc46d4df0de5f0a48043393b3e70a45272d30c 100644
--- a/base/nix/mime_util_xdg.cc
+++ b/base/nix/mime_util_xdg.cc
@@ -23,12 +23,6 @@
#include "base/threading/thread_restrictions.h"
#include "base/time.h"
-#if defined(TOOLKIT_GTK)
-#include <gtk/gtk.h> // NOLINT
-
-#include "base/message_loop.h"
-#endif
-
namespace {
class IconTheme;
@@ -67,12 +61,8 @@ class MimeUtilConstants {
base::TimeTicks last_check_time_;
-#if defined(TOOLKIT_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
+ // The current icon theme, usually set through GTK theme integration.
+ std::string icon_theme_name_;
private:
MimeUtilConstants() {
@@ -535,12 +525,10 @@ void InitDefaultThemes() {
default_themes[1] = IconTheme::LoadTheme(kde_default_theme);
default_themes[2] = IconTheme::LoadTheme(kde_fallback_theme);
} else {
-#if defined(TOOLKIT_GTK)
// Assume it's Gnome and use GTK to figure out the theme.
default_themes[1] = IconTheme::LoadTheme(
- MimeUtilConstants::GetInstance()->gtk_theme_name_);
+ MimeUtilConstants::GetInstance()->icon_theme_name_);
default_themes[2] = IconTheme::LoadTheme("gnome");
-#endif
}
// hicolor needs to be last per icon theme spec.
default_themes[3] = IconTheme::LoadTheme("hicolor");
@@ -600,25 +588,15 @@ std::string GetDataMimeType(const std::string& data) {
return xdg_mime_get_mime_type_for_data(data.data(), data.length(), NULL);
}
-#if defined(TOOLKIT_GTK)
-void DetectGtkTheme() {
+void SetIconThemeName(const std::string& name) {
// 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
// once.
- if (!MimeUtilConstants::GetInstance()->gtk_theme_name_.empty())
+ if (!MimeUtilConstants::GetInstance()->icon_theme_name_.empty())
return;
- // We should only be called on the UI thread.
- DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
-
- gchar* gtk_theme_name;
- g_object_get(gtk_settings_get_default(),
- "gtk-icon-theme-name",
- &gtk_theme_name, NULL);
- MimeUtilConstants::GetInstance()->gtk_theme_name_.assign(gtk_theme_name);
- g_free(gtk_theme_name);
+ MimeUtilConstants::GetInstance()->icon_theme_name_ = name;
}
-#endif
FilePath GetMimeIcon(const std::string& mime_type, size_t size) {
base::ThreadRestrictions::AssertIOAllowed();
« no previous file with comments | « base/nix/mime_util_xdg.h ('k') | chrome/browser/icon_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698