summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/nix/xdg_util.cc13
-rw-r--r--base/nix/xdg_util.h1
-rw-r--r--chrome/browser/password_manager/password_store_factory.cc1
-rw-r--r--chrome/browser/printing/printer_manager_dialog_linux.cc6
-rw-r--r--chrome/browser/ui/gtk/gtk_theme_service.cc8
-rw-r--r--chrome/browser/ui/gtk/unity_service.cc8
-rw-r--r--chrome/browser/ui/webui/options2/advanced_options_utils_x11.cc3
-rw-r--r--content/browser/power_save_blocker_linux.cc1
-rw-r--r--media/audio/linux/audio_manager_linux.cc19
-rw-r--r--net/proxy/proxy_config_service_linux.cc1
10 files changed, 49 insertions, 12 deletions
diff --git a/base/nix/xdg_util.cc b/base/nix/xdg_util.cc
index 08d4eee..10cbcaa 100644
--- a/base/nix/xdg_util.cc
+++ b/base/nix/xdg_util.cc
@@ -48,6 +48,17 @@ FilePath GetXDGUserDirectory(const char* dir_name, const char* fallback_dir) {
}
DesktopEnvironment GetDesktopEnvironment(Environment* env) {
+ // XDG_CURRENT_DESKTOP is the newest standard circa 2012.
+ std::string xdg_current_desktop;
+ if (env->GetVar("XDG_CURRENT_DESKTOP", &xdg_current_desktop)) {
+ // Not all desktop environments set this env var as of this writing.
+ if (xdg_current_desktop == "Unity")
+ return DESKTOP_ENVIRONMENT_UNITY;
+ else if (xdg_current_desktop == "GNOME")
+ return DESKTOP_ENVIRONMENT_GNOME;
+ }
+
+ // DESKTOP_SESSION was what everyone used in 2010.
std::string desktop_session;
if (env->GetVar("DESKTOP_SESSION", &desktop_session)) {
if (desktop_session == "gnome") {
@@ -88,6 +99,8 @@ const char* GetDesktopEnvironmentName(DesktopEnvironment env) {
return "KDE3";
case DESKTOP_ENVIRONMENT_KDE4:
return "KDE4";
+ case DESKTOP_ENVIRONMENT_UNITY:
+ return "UNITY";
case DESKTOP_ENVIRONMENT_XFCE:
return "XFCE";
}
diff --git a/base/nix/xdg_util.h b/base/nix/xdg_util.h
index b068d84..fc72663 100644
--- a/base/nix/xdg_util.h
+++ b/base/nix/xdg_util.h
@@ -53,6 +53,7 @@ enum DesktopEnvironment {
// them as two different desktop environments here.
DESKTOP_ENVIRONMENT_KDE3,
DESKTOP_ENVIRONMENT_KDE4,
+ DESKTOP_ENVIRONMENT_UNITY,
DESKTOP_ENVIRONMENT_XFCE,
};
diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc
index 57a135c..bee596d 100644
--- a/chrome/browser/password_manager/password_store_factory.cc
+++ b/chrome/browser/password_manager/password_store_factory.cc
@@ -154,6 +154,7 @@ PasswordStoreFactory::BuildServiceInstanceFor(Profile* profile) const {
else
backend.reset();
} else if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_GNOME ||
+ desktop_env == base::nix::DESKTOP_ENVIRONMENT_UNITY ||
desktop_env == base::nix::DESKTOP_ENVIRONMENT_XFCE) {
#if defined(USE_GNOME_KEYRING)
VLOG(1) << "Trying GNOME keyring for password storage.";
diff --git a/chrome/browser/printing/printer_manager_dialog_linux.cc b/chrome/browser/printing/printer_manager_dialog_linux.cc
index 44135f3..11e493b7 100644
--- a/chrome/browser/printing/printer_manager_dialog_linux.cc
+++ b/chrome/browser/printing/printer_manager_dialog_linux.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -33,14 +33,12 @@ void DetectAndOpenPrinterConfigDialog() {
case base::nix::DESKTOP_ENVIRONMENT_GNOME:
case base::nix::DESKTOP_ENVIRONMENT_KDE3:
case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+ case base::nix::DESKTOP_ENVIRONMENT_UNITY:
command = kGNOMEPrinterConfigCommand;
break;
case base::nix::DESKTOP_ENVIRONMENT_XFCE:
case base::nix::DESKTOP_ENVIRONMENT_OTHER:
break;
- default:
- NOTREACHED();
- break;
}
if (!command) {
diff --git a/chrome/browser/ui/gtk/gtk_theme_service.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc
index 9ad5bfd..7a46299 100644
--- a/chrome/browser/ui/gtk/gtk_theme_service.cc
+++ b/chrome/browser/ui/gtk/gtk_theme_service.cc
@@ -615,11 +615,17 @@ bool GtkThemeService::DefaultUsesSystemTheme() {
switch (base::nix::GetDesktopEnvironment(env.get())) {
case base::nix::DESKTOP_ENVIRONMENT_GNOME:
+ case base::nix::DESKTOP_ENVIRONMENT_UNITY:
case base::nix::DESKTOP_ENVIRONMENT_XFCE:
return true;
- default:
+ case base::nix::DESKTOP_ENVIRONMENT_KDE3:
+ case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+ case base::nix::DESKTOP_ENVIRONMENT_OTHER:
return false;
}
+ // Unless GetDesktopEnvironment() badly misbehaves, this should never happen.
+ NOTREACHED();
+ return false;
}
void GtkThemeService::ClearAllThemeData() {
diff --git a/chrome/browser/ui/gtk/unity_service.cc b/chrome/browser/ui/gtk/unity_service.cc
index c35a65f..4f3dbd4 100644
--- a/chrome/browser/ui/gtk/unity_service.cc
+++ b/chrome/browser/ui/gtk/unity_service.cc
@@ -8,6 +8,7 @@
#include <string>
#include "base/environment.h"
+#include "base/nix/xdg_util.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/shell_integration_linux.h"
@@ -49,10 +50,16 @@ unity_launcher_entry_set_progress_visible_func entry_set_progress_visible =
NULL;
void EnsureMethodsLoaded() {
+ using base::nix::GetDesktopEnvironment;
+
if (attempted_load)
return;
attempted_load = true;
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ if (GetDesktopEnvironment(env.get()) != base::nix::DESKTOP_ENVIRONMENT_UNITY)
+ return;
+
// TODO(erg): When unity stabilizes its interface, switch all this to looking
// up just ".so" instead of specific versions.
void* unity_lib = dlopen("libunity.so.4", RTLD_LAZY);
@@ -78,7 +85,6 @@ void EnsureMethodsLoaded() {
reinterpret_cast<unity_launcher_entry_get_for_desktop_id_func>(
dlsym(unity_lib, "unity_launcher_entry_get_for_desktop_id"));
if (entry_get_for_desktop_id) {
- scoped_ptr<base::Environment> env(base::Environment::Create());
std::string desktop_id = ShellIntegrationLinux::GetDesktopName(env.get());
chrome_entry = entry_get_for_desktop_id(desktop_id.c_str());
diff --git a/chrome/browser/ui/webui/options2/advanced_options_utils_x11.cc b/chrome/browser/ui/webui/options2/advanced_options_utils_x11.cc
index 520f2ab..da2293a 100644
--- a/chrome/browser/ui/webui/options2/advanced_options_utils_x11.cc
+++ b/chrome/browser/ui/webui/options2/advanced_options_utils_x11.cc
@@ -110,7 +110,8 @@ void DetectAndStartProxyConfigUtil(int render_process_id,
bool launched = false;
switch (base::nix::GetDesktopEnvironment(env.get())) {
- case base::nix::DESKTOP_ENVIRONMENT_GNOME: {
+ case base::nix::DESKTOP_ENVIRONMENT_GNOME:
+ case base::nix::DESKTOP_ENVIRONMENT_UNITY: {
launched = StartProxyConfigUtil(kGNOME2ProxyConfigCommand);
if (!launched) {
// We try this second, even though it's the newer way, because this
diff --git a/content/browser/power_save_blocker_linux.cc b/content/browser/power_save_blocker_linux.cc
index da68cd3..2ebf7be 100644
--- a/content/browser/power_save_blocker_linux.cc
+++ b/content/browser/power_save_blocker_linux.cc
@@ -312,6 +312,7 @@ DBusAPI PowerSaveBlocker::Delegate::SelectAPI() {
scoped_ptr<base::Environment> env(base::Environment::Create());
switch (base::nix::GetDesktopEnvironment(env.get())) {
case base::nix::DESKTOP_ENVIRONMENT_GNOME:
+ case base::nix::DESKTOP_ENVIRONMENT_UNITY:
if (DPMSEnabled())
return GNOME_API;
break;
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc
index 8a8cad2..9d9e833 100644
--- a/media/audio/linux/audio_manager_linux.cc
+++ b/media/audio/linux/audio_manager_linux.cc
@@ -72,11 +72,20 @@ void AudioManagerLinux::UnMuteAll() {
bool AudioManagerLinux::CanShowAudioInputSettings() {
scoped_ptr<base::Environment> env(base::Environment::Create());
- base::nix::DesktopEnvironment desktop = base::nix::GetDesktopEnvironment(
- env.get());
- return (desktop == base::nix::DESKTOP_ENVIRONMENT_GNOME ||
- desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
- desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4);
+
+ switch (base::nix::GetDesktopEnvironment(env.get())) {
+ case base::nix::DESKTOP_ENVIRONMENT_GNOME:
+ case base::nix::DESKTOP_ENVIRONMENT_KDE3:
+ case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+ return true;
+ case base::nix::DESKTOP_ENVIRONMENT_OTHER:
+ case base::nix::DESKTOP_ENVIRONMENT_UNITY:
+ case base::nix::DESKTOP_ENVIRONMENT_XFCE:
+ return false;
+ }
+ // Unless GetDesktopEnvironment() badly misbehaves, this should never happen.
+ NOTREACHED();
+ return false;
}
void AudioManagerLinux::ShowAudioInputSettings() {
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc
index 52b24e6..b323246 100644
--- a/net/proxy/proxy_config_service_linux.cc
+++ b/net/proxy/proxy_config_service_linux.cc
@@ -1572,6 +1572,7 @@ ProxyConfigServiceLinux::Delegate::Delegate(base::Environment* env_var_getter)
// Figure out which SettingGetterImpl to use, if any.
switch (base::nix::GetDesktopEnvironment(env_var_getter)) {
case base::nix::DESKTOP_ENVIRONMENT_GNOME:
+ case base::nix::DESKTOP_ENVIRONMENT_UNITY:
#if defined(USE_GIO)
{
scoped_ptr<SettingGetterImplGSettings> gs_getter(