diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-17 23:40:17 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-17 23:40:17 +0000 |
commit | 9e6c9bde9a6014b1cb703d064acfb5c07462f272 (patch) | |
tree | 4c7103c1eb326ca189008bb86a6e8b8558f2d666 /chrome | |
parent | 30a10dcfc0b5935a43557719cb19767419d4de13 (diff) | |
download | chromium_src-9e6c9bde9a6014b1cb703d064acfb5c07462f272.zip chromium_src-9e6c9bde9a6014b1cb703d064acfb5c07462f272.tar.gz chromium_src-9e6c9bde9a6014b1cb703d064acfb5c07462f272.tar.bz2 |
Linux: Detect Unity as a desktop environment.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10735034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
5 files changed, 19 insertions, 7 deletions
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 |