Commit 84379e5c authored by huangs@chromium.org's avatar huangs@chromium.org

App Launcher dr=1: limit to Chrome, and stop using ChromeAppHostDistribution to set it.

This CL does 2 things:

1. The setting of App Launcher dr=1 is now only used for GOOGLE_CHROME_BUILD.

2. Refactoring: In r273321, we extracted AppRegistrationData from BrowserDistribution,
and make it part of BrowserDistribution by composition. In this CL, we
use this new flexibility, and cut the dependence of app_list_service_win.cc
on ChromeAppHostDistribution by just giving it the AppRegistrationData part
it needs.

The required const kAppLauncherGuid now lives in chrome_launcher_support.

BUG=297647

Review URL: https://codereview.chromium.org/374413004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284605 0039d316-1c4b-4281-b951-d872f2087c98
parent c6f0cf64
......@@ -36,12 +36,17 @@
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/install_util.h"
#include "content/public/browser/browser_thread.h"
#include "ui/app_list/views/app_list_view.h"
#include "ui/base/win/shell.h"
#if defined(GOOGLE_CHROME_BUILD)
#include "chrome/installer/launcher_support/chrome_launcher_support.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/updating_app_registration_data.h"
#endif // GOOGLE_CHROME_BUILD
// static
AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) {
if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH)
......@@ -122,6 +127,7 @@ base::string16 GetAppModelId() {
return ShellIntegration::GetAppListAppModelIdForProfile(initial_profile_path);
}
#if defined(GOOGLE_CHROME_BUILD)
void SetDidRunForNDayActiveStats() {
DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
base::FilePath exe_path;
......@@ -140,14 +146,13 @@ void SetDidRunForNDayActiveStats() {
BrowserDistribution::CHROME_BINARIES);
if (chrome_binaries_dist &&
InstallUtil::IsMultiInstall(chrome_binaries_dist, system_install)) {
BrowserDistribution* app_launcher_dist =
BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_APP_HOST);
UpdatingAppRegistrationData app_launcher_reg_data(
chrome_launcher_support::kAppLauncherGuid);
GoogleUpdateSettings::UpdateDidRunStateForApp(
app_launcher_dist->GetAppRegistrationData(),
true /* did_run */);
app_launcher_reg_data, true /* did_run */);
}
}
#endif // GOOGLE_CHROME_BUILD
// The start menu shortcut is created on first run by users that are
// upgrading. The desktop and taskbar shortcuts are created the first time the
......@@ -260,8 +265,11 @@ AppListServiceWin::~AppListServiceWin() {
void AppListServiceWin::ShowForProfile(Profile* requested_profile) {
AppListServiceViews::ShowForProfile(requested_profile);
#if defined(GOOGLE_CHROME_BUILD)
content::BrowserThread::PostBlockingPoolTask(
FROM_HERE, base::Bind(SetDidRunForNDayActiveStats));
#endif // GOOGLE_CHROME_BUILD
}
void AppListServiceWin::OnLoadProfileForWarmup(Profile* initial_profile) {
......
......@@ -29,9 +29,6 @@ const wchar_t kGoogleRegClientStateKey[] =
const wchar_t kGoogleRegClientsKey[] = L"Software\\Google\\Update\\Clients";
const wchar_t kRegVersionField[] = L"pv";
// Copied from binaries_installer_internal.cc
const wchar_t kAppHostAppId[] = L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}";
// Copied from chrome_appid.cc.
const wchar_t kBinariesAppGuid[] = L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}";
......@@ -86,7 +83,7 @@ bool IsProductInstalled(InstallationLevel level, const wchar_t* app_guid) {
bool IsAppLauncherEnabledAtLevel(InstallationLevel level) {
base::string16 uninstall_arguments;
if (GetClientStateValue(level,
kAppHostAppId,
kAppLauncherGuid,
kUninstallArgumentsField,
&uninstall_arguments)) {
return CommandLine::FromString(L"dummy.exe " + uninstall_arguments)
......@@ -134,13 +131,15 @@ base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path,
} // namespace
const wchar_t kAppLauncherGuid[] = L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}";
void UninstallLegacyAppLauncher(InstallationLevel level) {
base::FilePath setup_exe(GetSetupExeFromRegistry(level, kAppHostAppId));
base::FilePath setup_exe(GetSetupExeFromRegistry(level, kAppLauncherGuid));
if (setup_exe.empty())
return;
base::string16 uninstall_arguments;
if (GetClientStateValue(level,
kAppHostAppId,
kAppLauncherGuid,
kUninstallArgumentsField,
&uninstall_arguments)) {
CommandLine uninstall_cmd = CommandLine::FromString(
......@@ -170,7 +169,7 @@ base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) {
base::FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) {
return FindExeRelativeToSetupExe(
GetSetupExeFromRegistry(level, kAppHostAppId), kChromeAppHostExe);
GetSetupExeFromRegistry(level, kAppLauncherGuid), kChromeAppHostExe);
}
base::FilePath GetChromeSxSPathForInstallationLevel(InstallationLevel level) {
......
......@@ -22,6 +22,9 @@ enum InstallationState {
INSTALLED_AT_SYSTEM_LEVEL,
};
// The app GUID for Chrome App Launcher.
extern const wchar_t kAppLauncherGuid[];
// Returns the path to an existing setup.exe at the specified level, if it can
// be found via Omaha client state.
base::FilePath GetSetupExeForInstallationLevel(InstallationLevel level);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment