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 @@ ...@@ -36,12 +36,17 @@
#include "chrome/common/chrome_version_info.h" #include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/installer/util/browser_distribution.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 "content/public/browser/browser_thread.h"
#include "ui/app_list/views/app_list_view.h" #include "ui/app_list/views/app_list_view.h"
#include "ui/base/win/shell.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 // static
AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) { AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) {
if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH)
...@@ -122,6 +127,7 @@ base::string16 GetAppModelId() { ...@@ -122,6 +127,7 @@ base::string16 GetAppModelId() {
return ShellIntegration::GetAppListAppModelIdForProfile(initial_profile_path); return ShellIntegration::GetAppListAppModelIdForProfile(initial_profile_path);
} }
#if defined(GOOGLE_CHROME_BUILD)
void SetDidRunForNDayActiveStats() { void SetDidRunForNDayActiveStats() {
DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
base::FilePath exe_path; base::FilePath exe_path;
...@@ -140,14 +146,13 @@ void SetDidRunForNDayActiveStats() { ...@@ -140,14 +146,13 @@ void SetDidRunForNDayActiveStats() {
BrowserDistribution::CHROME_BINARIES); BrowserDistribution::CHROME_BINARIES);
if (chrome_binaries_dist && if (chrome_binaries_dist &&
InstallUtil::IsMultiInstall(chrome_binaries_dist, system_install)) { InstallUtil::IsMultiInstall(chrome_binaries_dist, system_install)) {
BrowserDistribution* app_launcher_dist = UpdatingAppRegistrationData app_launcher_reg_data(
BrowserDistribution::GetSpecificDistribution( chrome_launcher_support::kAppLauncherGuid);
BrowserDistribution::CHROME_APP_HOST);
GoogleUpdateSettings::UpdateDidRunStateForApp( GoogleUpdateSettings::UpdateDidRunStateForApp(
app_launcher_dist->GetAppRegistrationData(), app_launcher_reg_data, true /* did_run */);
true /* did_run */);
} }
} }
#endif // GOOGLE_CHROME_BUILD
// The start menu shortcut is created on first run by users that are // 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 // upgrading. The desktop and taskbar shortcuts are created the first time the
...@@ -260,8 +265,11 @@ AppListServiceWin::~AppListServiceWin() { ...@@ -260,8 +265,11 @@ AppListServiceWin::~AppListServiceWin() {
void AppListServiceWin::ShowForProfile(Profile* requested_profile) { void AppListServiceWin::ShowForProfile(Profile* requested_profile) {
AppListServiceViews::ShowForProfile(requested_profile); AppListServiceViews::ShowForProfile(requested_profile);
#if defined(GOOGLE_CHROME_BUILD)
content::BrowserThread::PostBlockingPoolTask( content::BrowserThread::PostBlockingPoolTask(
FROM_HERE, base::Bind(SetDidRunForNDayActiveStats)); FROM_HERE, base::Bind(SetDidRunForNDayActiveStats));
#endif // GOOGLE_CHROME_BUILD
} }
void AppListServiceWin::OnLoadProfileForWarmup(Profile* initial_profile) { void AppListServiceWin::OnLoadProfileForWarmup(Profile* initial_profile) {
......
...@@ -29,9 +29,6 @@ const wchar_t kGoogleRegClientStateKey[] = ...@@ -29,9 +29,6 @@ const wchar_t kGoogleRegClientStateKey[] =
const wchar_t kGoogleRegClientsKey[] = L"Software\\Google\\Update\\Clients"; const wchar_t kGoogleRegClientsKey[] = L"Software\\Google\\Update\\Clients";
const wchar_t kRegVersionField[] = L"pv"; 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. // Copied from chrome_appid.cc.
const wchar_t kBinariesAppGuid[] = L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; const wchar_t kBinariesAppGuid[] = L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}";
...@@ -86,7 +83,7 @@ bool IsProductInstalled(InstallationLevel level, const wchar_t* app_guid) { ...@@ -86,7 +83,7 @@ bool IsProductInstalled(InstallationLevel level, const wchar_t* app_guid) {
bool IsAppLauncherEnabledAtLevel(InstallationLevel level) { bool IsAppLauncherEnabledAtLevel(InstallationLevel level) {
base::string16 uninstall_arguments; base::string16 uninstall_arguments;
if (GetClientStateValue(level, if (GetClientStateValue(level,
kAppHostAppId, kAppLauncherGuid,
kUninstallArgumentsField, kUninstallArgumentsField,
&uninstall_arguments)) { &uninstall_arguments)) {
return CommandLine::FromString(L"dummy.exe " + uninstall_arguments) return CommandLine::FromString(L"dummy.exe " + uninstall_arguments)
...@@ -134,13 +131,15 @@ base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path, ...@@ -134,13 +131,15 @@ base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path,
} // namespace } // namespace
const wchar_t kAppLauncherGuid[] = L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}";
void UninstallLegacyAppLauncher(InstallationLevel level) { void UninstallLegacyAppLauncher(InstallationLevel level) {
base::FilePath setup_exe(GetSetupExeFromRegistry(level, kAppHostAppId)); base::FilePath setup_exe(GetSetupExeFromRegistry(level, kAppLauncherGuid));
if (setup_exe.empty()) if (setup_exe.empty())
return; return;
base::string16 uninstall_arguments; base::string16 uninstall_arguments;
if (GetClientStateValue(level, if (GetClientStateValue(level,
kAppHostAppId, kAppLauncherGuid,
kUninstallArgumentsField, kUninstallArgumentsField,
&uninstall_arguments)) { &uninstall_arguments)) {
CommandLine uninstall_cmd = CommandLine::FromString( CommandLine uninstall_cmd = CommandLine::FromString(
...@@ -170,7 +169,7 @@ base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) { ...@@ -170,7 +169,7 @@ base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) {
base::FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) { base::FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) {
return FindExeRelativeToSetupExe( return FindExeRelativeToSetupExe(
GetSetupExeFromRegistry(level, kAppHostAppId), kChromeAppHostExe); GetSetupExeFromRegistry(level, kAppLauncherGuid), kChromeAppHostExe);
} }
base::FilePath GetChromeSxSPathForInstallationLevel(InstallationLevel level) { base::FilePath GetChromeSxSPathForInstallationLevel(InstallationLevel level) {
......
...@@ -22,6 +22,9 @@ enum InstallationState { ...@@ -22,6 +22,9 @@ enum InstallationState {
INSTALLED_AT_SYSTEM_LEVEL, 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 // Returns the path to an existing setup.exe at the specified level, if it can
// be found via Omaha client state. // be found via Omaha client state.
base::FilePath GetSetupExeForInstallationLevel(InstallationLevel level); 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