Index: chrome/browser/ui/gtk/unity_service.cc |
=================================================================== |
--- chrome/browser/ui/gtk/unity_service.cc (revision 147124) |
+++ chrome/browser/ui/gtk/unity_service.cc (working copy) |
@@ -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 @@ |
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 @@ |
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()); |