diff options
author | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-13 20:25:33 +0000 |
---|---|---|
committer | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-13 20:25:33 +0000 |
commit | 79ccf65145690b1516784414da14a78eee70a3ff (patch) | |
tree | 9c7246fe5e590ddb67728fe5c7309c1ffc29f5cf /chrome | |
parent | 2ee06eadbc549e52d630b21ef6e08100e54e5618 (diff) | |
download | chromium_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')
5 files changed, 54 insertions, 17 deletions
diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc index 79bad76..aaefdb2 100644 --- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc +++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc @@ -25,6 +25,7 @@ #include "chrome/browser/ui/views/browser_dialogs.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "chrome/installer/launcher_support/chrome_launcher_support.h" #include "chrome/installer/util/util_constants.h" #include "content/public/browser/browser_thread.h" #include "grit/chromium_strings.h" @@ -398,8 +399,10 @@ void CheckAppListTaskbarShortcutOnFileThread(const FilePath& user_data_dir, IDS_APP_LIST_SHORTCUT_NAME); const FilePath shortcut_path(user_data_dir.Append(shortcut_name) .AddExtension(installer::kLnkExt)); - const bool should_show = CommandLine::ForCurrentProcess()->HasSwitch( - switches::kShowAppListShortcut); + const bool should_show = + CommandLine::ForCurrentProcess()->HasSwitch( + switches::kShowAppListShortcut) || + chrome_launcher_support::IsAppLauncherPresent(); // This will not reshow a shortcut if it has been unpinned manually by the // user, as that will not delete the shortcut file. diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 397bddb..010f405 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -2631,6 +2631,7 @@ ], 'dependencies': [ 'installer_util_strings', + 'launcher_support', '../google_update/google_update.gyp:google_update', '../third_party/iaccessible2/iaccessible2.gyp:iaccessible2', '../third_party/isimpledom/isimpledom.gyp:isimpledom', 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_ diff --git a/chrome/installer/util/chrome_app_host_operations.cc b/chrome/installer/util/chrome_app_host_operations.cc index 73b4056..56ab023 100644 --- a/chrome/installer/util/chrome_app_host_operations.cc +++ b/chrome/installer/util/chrome_app_host_operations.cc @@ -139,11 +139,7 @@ void ChromeAppHostOperations::AddDefaultShortcutProperties( if (!properties->has_app_id()) { std::vector<string16> components; - string16 suffix; - ShellUtil::GetUserSpecificRegistrySuffix(&suffix); - string16 base_app_id(dist->GetBaseAppId()); - base_app_id.append(suffix); - components.push_back(base_app_id); + components.push_back(dist->GetBaseAppId()); properties->set_app_id(ShellUtil::BuildAppModelId(components)); } } |