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

Unified Diff: chrome/browser/ui/gtk/unity_service.cc

Issue 10735034: Linux: Detect Unity as a desktop environment. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 years, 5 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
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());
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.cc ('k') | chrome/browser/ui/webui/options2/advanced_options_utils_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698