summaryrefslogtreecommitdiffstats
path: root/chrome/installer/launcher_support
diff options
context:
space:
mode:
authorerikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 20:25:33 +0000
committererikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 20:25:33 +0000
commit79ccf65145690b1516784414da14a78eee70a3ff (patch)
tree9c7246fe5e590ddb67728fe5c7309c1ffc29f5cf /chrome/installer/launcher_support
parent2ee06eadbc549e52d630b21ef6e08100e54e5618 (diff)
downloadchromium_src-79ccf65145690b1516784414da14a78eee70a3ff.zip
chromium_src-79ccf65145690b1516784414da14a78eee70a3ff.tar.gz
chromium_src-79ccf65145690b1516784414da14a78eee70a3ff.tar.bz2
Don't user-suffix the launcher App Model ID.
Modify the temporary workaround for enabling the launcher to not delete shortcuts created by the launcher installer. BUG=151626 Review URL: https://chromiumcodereview.appspot.com/11361184 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/launcher_support')
-rw-r--r--chrome/installer/launcher_support/chrome_launcher_support.cc54
-rw-r--r--chrome/installer/launcher_support/chrome_launcher_support.h3
2 files changed, 47 insertions, 10 deletions
diff --git a/chrome/installer/launcher_support/chrome_launcher_support.cc b/chrome/installer/launcher_support/chrome_launcher_support.cc
index 164f6d7..d6ec9d6 100644
--- a/chrome/installer/launcher_support/chrome_launcher_support.cc
+++ b/chrome/installer/launcher_support/chrome_launcher_support.cc
@@ -6,6 +6,8 @@
#include <windows.h>
#include <tchar.h>
+
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
@@ -35,7 +37,9 @@ const wchar_t kBrowserAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
// Copied from util_constants.cc.
const wchar_t kChromeAppHostExe[] = L"app_host.exe";
+const char kChromeAppLauncher[] = "app-launcher";
const wchar_t kChromeExe[] = L"chrome.exe";
+const wchar_t kUninstallArgumentsField[] = L"UninstallArguments";
const wchar_t kUninstallStringField[] = L"UninstallString";
#ifndef OFFICIAL_BUILD
@@ -50,11 +54,12 @@ FilePath GetDevelopmentExe(const wchar_t* exe_file) {
}
#endif
-// Reads the path to setup.exe from the value "UninstallString" within the
-// specified product's "ClientState" registry key. Returns an empty FilePath if
-// an error occurs or the product is not installed at the specified level.
-FilePath GetSetupExeFromRegistry(InstallationLevel level,
- const wchar_t* app_guid) {
+// Reads a string value from the specified product's "ClientState" registry key.
+// Returns true iff the value is present and successfully read.
+bool GetClientStateValue(InstallationLevel level,
+ const wchar_t* app_guid,
+ const wchar_t* value_name,
+ string16* value) {
HKEY root_key = (level == USER_LEVEL_INSTALLATION) ?
HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
string16 subkey(kGoogleRegClientStateKey);
@@ -62,13 +67,37 @@ FilePath GetSetupExeFromRegistry(InstallationLevel level,
base::win::RegKey reg_key;
if (reg_key.Open(root_key, subkey.c_str(),
KEY_QUERY_VALUE) == ERROR_SUCCESS) {
- string16 uninstall;
- if (reg_key.ReadValue(kUninstallStringField, &uninstall) == ERROR_SUCCESS) {
- FilePath setup_exe_path(uninstall);
- if (file_util::PathExists(setup_exe_path))
- return setup_exe_path;
+ if (reg_key.ReadValue(value_name, value) == ERROR_SUCCESS) {
+ return true;
}
}
+ return false;
+}
+
+bool IsAppLauncherEnabledAtLevel(InstallationLevel level) {
+ string16 uninstall_arguments;
+ if (GetClientStateValue(level,
+ kAppHostAppId,
+ kUninstallArgumentsField,
+ &uninstall_arguments)) {
+ return CommandLine::FromString(L"dummy.exe " + uninstall_arguments)
+ .HasSwitch(kChromeAppLauncher) &&
+ !GetAppHostPathForInstallationLevel(level).empty();
+ }
+ return false;
+}
+
+// Reads the path to setup.exe from the value "UninstallString" within the
+// specified product's "ClientState" registry key. Returns an empty FilePath if
+// an error occurs or the product is not installed at the specified level.
+FilePath GetSetupExeFromRegistry(InstallationLevel level,
+ const wchar_t* app_guid) {
+ string16 uninstall;
+ if (GetClientStateValue(level, app_guid, kUninstallStringField, &uninstall)) {
+ FilePath setup_exe_path(uninstall);
+ if (file_util::PathExists(setup_exe_path))
+ return setup_exe_path;
+ }
return FilePath();
}
@@ -149,4 +178,9 @@ bool IsAppHostPresent() {
return !app_host_exe.empty();
}
+bool IsAppLauncherPresent() {
+ return IsAppLauncherEnabledAtLevel(USER_LEVEL_INSTALLATION) ||
+ IsAppLauncherEnabledAtLevel(SYSTEM_LEVEL_INSTALLATION);
+}
+
} // namespace chrome_launcher_support
diff --git a/chrome/installer/launcher_support/chrome_launcher_support.h b/chrome/installer/launcher_support/chrome_launcher_support.h
index bf60825..caca2a5 100644
--- a/chrome/installer/launcher_support/chrome_launcher_support.h
+++ b/chrome/installer/launcher_support/chrome_launcher_support.h
@@ -48,6 +48,9 @@ FilePath GetAnyAppHostPath();
// or in the same directory as the current executable.
bool IsAppHostPresent();
+// Returns true if App Launcher is installed (system-level or user-level).
+bool IsAppLauncherPresent();
+
} // namespace chrome_launcher_support
#endif // CHROME_INSTALLER_LAUNCHER_SUPPORT_CHROME_LAUNCHER_SUPPORT_H_