diff options
author | mdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 01:29:04 +0000 |
---|---|---|
committer | mdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 01:29:04 +0000 |
commit | cdeb0a609ebdef1718708d821f5169ea21eb3ca0 (patch) | |
tree | e7e36d0db2e47758b20be97eaa848f8e08c75c3b | |
parent | 3bca8d06ea7ed8ff38b6a5e014bb4f1a6df61b73 (diff) | |
download | chromium_src-cdeb0a609ebdef1718708d821f5169ea21eb3ca0.zip chromium_src-cdeb0a609ebdef1718708d821f5169ea21eb3ca0.tar.gz chromium_src-cdeb0a609ebdef1718708d821f5169ea21eb3ca0.tar.bz2 |
Linux: allow the desktop file name to be given in an environment variable for development Chromium builds, to avoid conflicting with packaged Chromium.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/159108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21144 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/shell_integration_linux.cc | 19 | ||||
-rwxr-xr-x | chrome/tools/build/linux/chrome-wrapper | 3 |
2 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 2d2cb05..814ceff 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -14,11 +14,22 @@ #include "base/process_util.h" +static const char* GetDesktopName() { #if defined(GOOGLE_CHROME_BUILD) -#define DESKTOP_APP_NAME "google-chrome.desktop" + return "google-chrome.desktop"; #else // CHROMIUM_BUILD -#define DESKTOP_APP_NAME "chromium-browser.desktop" + static const char* name = NULL; + if (!name) { + // Allow $CHROME_DESKTOP to override the built-in value, so that development + // versions can set themselves as the default without interfering with + // non-official, packaged versions using the built-in value. + name = getenv("CHROME_DESKTOP"); + if (!name) + name = "chromium-browser.desktop"; + } + return name; #endif +} // We delegate the difficult of setting the default browser in Linux desktop // environments to a new xdg utility, xdg-settings. We'll have to include a copy @@ -30,7 +41,7 @@ bool ShellIntegration::SetAsDefaultBrowser() { argv.push_back("xdg-settings"); argv.push_back("set"); argv.push_back("default-web-browser"); - argv.push_back(DESKTOP_APP_NAME); + argv.push_back(GetDesktopName()); // xdg-settings internally runs xdg-mime, which uses mv to move newly-created // files on top of originals after making changes to them. In the event that @@ -77,7 +88,7 @@ bool ShellIntegration::IsDefaultBrowser() { // Allow for an optional newline at the end. if (browser.length() > 0 && browser[browser.length() - 1] == '\n') browser.resize(browser.length() - 1); - return !browser.compare(DESKTOP_APP_NAME); + return !browser.compare(GetDesktopName()); } bool ShellIntegration::IsFirefoxDefaultBrowser() { diff --git a/chrome/tools/build/linux/chrome-wrapper b/chrome/tools/build/linux/chrome-wrapper index 7792e9b..72a3e3e 100755 --- a/chrome/tools/build/linux/chrome-wrapper +++ b/chrome/tools/build/linux/chrome-wrapper @@ -7,7 +7,7 @@ # Running Chromium via this script makes it possible to set Chromium as the # default browser directly out of a compile, without needing to package it. -DESKTOP="chromium-browser" +DESKTOP="chromium-devel" TITLE="Chromium" # Check to see if there is a desktop file of the given name @@ -44,6 +44,7 @@ EOF # Let the wrapped binary know that it has been run through the wrapper export CHROME_WRAPPER="`readlink -f "$0"`" +export CHROME_DESKTOP="$DESKTOP.desktop" HERE="`dirname "$CHROME_WRAPPER"`" |