diff options
author | huangs@chromium.org <huangs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 19:33:25 +0000 |
---|---|---|
committer | huangs@chromium.org <huangs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 19:33:25 +0000 |
commit | 84fdfacdb6d60486cec8fcf2c9194d7eff61573e (patch) | |
tree | 03da3fe6fac1dc3c30998e7ad147afe4173167e3 | |
parent | a857720adbefb288556f10cc0134f67445c4837f (diff) | |
download | chromium_src-84fdfacdb6d60486cec8fcf2c9194d7eff61573e.zip chromium_src-84fdfacdb6d60486cec8fcf2c9194d7eff61573e.tar.gz chromium_src-84fdfacdb6d60486cec8fcf2c9194d7eff61573e.tar.bz2 |
Limit App Host installation / usage for platform apps to Google Chome only.
- For Google Chrome:
1. On first install of platform apps, as before, install app_host.exe via the quick-enable-application-host command.
2. App shortcuts (e.g., desktop) point to app_host.exe.
- For Google Canary and Chromium:
1. On first install of platform apps, don't install app_host.exe.
2. When creating (e.g., desktop) point to chrome.exe.
BUG=160479
Review URL: https://chromiumcodereview.appspot.com/11412021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169088 0039d316-1c4b-4281-b951-d872f2087c98
9 files changed, 44 insertions, 11 deletions
diff --git a/chrome/browser/extensions/app_shortcut_manager.cc b/chrome/browser/extensions/app_shortcut_manager.cc index 23795916..40bd4b9 100644 --- a/chrome/browser/extensions/app_shortcut_manager.cc +++ b/chrome/browser/extensions/app_shortcut_manager.cc @@ -22,6 +22,7 @@ #if defined(OS_WIN) #include "chrome/browser/extensions/app_host_installer_win.h" +#include "chrome/installer/util/browser_distribution.h" #endif namespace extensions { @@ -93,11 +94,15 @@ void AppShortcutManager::Observe(int type, details).ptr(); if (extension->is_platform_app()) { #if defined(OS_WIN) - scoped_refptr<Extension> extension_ref(const_cast<Extension*>( - extension)); - extensions::AppHostInstaller::EnsureAppHostInstalled( - base::Bind(&AppShortcutManager::OnAppHostInstallationComplete, - weak_factory_.GetWeakPtr(), extension_ref)); + if (BrowserDistribution::GetDistribution()->AppHostIsSupported()) { + scoped_refptr<Extension> extension_ref(const_cast<Extension*>( + extension)); + extensions::AppHostInstaller::EnsureAppHostInstalled( + base::Bind(&AppShortcutManager::OnAppHostInstallationComplete, + weak_factory_.GetWeakPtr(), extension_ref)); + } else { + UpdateApplicationShortcuts(extension); + } #else UpdateApplicationShortcuts(extension); #endif diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index 352f921..8a4f416 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -17,6 +17,7 @@ #include "base/win/windows_version.h" #include "chrome/common/chrome_switches.h" #include "chrome/installer/launcher_support/chrome_launcher_support.h" +#include "chrome/installer/util/browser_distribution.h" #include "content/public/browser/browser_thread.h" #include "ui/gfx/icon_util.h" @@ -225,12 +226,15 @@ bool CreatePlatformShortcuts( return false; } - FilePath app_host_exe(chrome_launcher_support::GetAnyAppHostPath()); - if (app_host_exe.empty()) - return false; + FilePath target_exe; + if (BrowserDistribution::GetDistribution()->AppHostIsSupported()) + target_exe = chrome_launcher_support::GetAnyAppHostPath(); + else + target_exe = chrome_launcher_support::GetAnyChromePath(); + DCHECK(!target_exe.empty()); // Working directory. - FilePath working_dir(app_host_exe.DirName()); + FilePath working_dir(target_exe.DirName()); CommandLine cmd_line(CommandLine::NO_PROGRAM); cmd_line = ShellIntegration::CommandLineArgsForLauncher(shortcut_info.url, @@ -269,7 +273,7 @@ bool CreatePlatformShortcuts( } base::win::ShortcutProperties shortcut_properties; - shortcut_properties.set_target(app_host_exe); + shortcut_properties.set_target(target_exe); shortcut_properties.set_working_dir(working_dir); shortcut_properties.set_arguments(wide_switches); shortcut_properties.set_description(description); diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 142509e..101cbb3 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -246,6 +246,10 @@ bool BrowserDistribution::GetCommandExecuteImplClsid( return true; } +bool BrowserDistribution::AppHostIsSupported() { + return false; +} + void BrowserDistribution::UpdateInstallStatus(bool system_install, installer::ArchiveType archive_type, installer::InstallStatus install_status) { diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index f6b568d..8525a9d 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -130,11 +130,14 @@ class BrowserDistribution { virtual bool GetChromeChannel(string16* channel); - // Returns true if the distribution includes a DelegateExecute verb handler, + // Returns true if this distribution includes a DelegateExecute verb handler, // and provides the CommandExecuteImpl class UUID if |handler_class_uuid| is // non-NULL. virtual bool GetCommandExecuteImplClsid(string16* handler_class_uuid); + // Returns true if this distribution uses app_host.exe to run platform apps. + virtual bool AppHostIsSupported(); + virtual void UpdateInstallStatus(bool system_install, installer::ArchiveType archive_type, installer::InstallStatus install_status); diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 106c588..d9c4e67 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -549,6 +549,10 @@ bool GoogleChromeDistribution::GetCommandExecuteImplClsid( return true; } +bool GoogleChromeDistribution::AppHostIsSupported() { + return true; +} + // This method checks if we need to change "ap" key in Google Update to try // full installer as fall back method in case incremental installer fails. // - If incremental installer fails we append a magic string ("-full"), if @@ -872,4 +876,5 @@ void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor, GetType())); base::LaunchProcess(cmd, base::LaunchOptions(), NULL); } + #endif diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index 9b57ae8..93f1cf9 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h @@ -79,6 +79,8 @@ class GoogleChromeDistribution : public BrowserDistribution { virtual bool GetCommandExecuteImplClsid( string16* handler_class_uuid) OVERRIDE; + virtual bool AppHostIsSupported() OVERRIDE; + virtual void UpdateInstallStatus( bool system_install, installer::ArchiveType archive_type, diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc index 74d1c35..836cf1f 100644 --- a/chrome/installer/util/google_chrome_distribution_dummy.cc +++ b/chrome/installer/util/google_chrome_distribution_dummy.cc @@ -127,6 +127,11 @@ bool GoogleChromeDistribution::GetCommandExecuteImplClsid( return false; } +bool GoogleChromeDistribution::AppHostIsSupported() { + NOTREACHED(); + return false; +} + void GoogleChromeDistribution::UpdateInstallStatus(bool system_install, installer::ArchiveType archive_type, installer::InstallStatus install_status) { diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc index 118ac3b..157fd74 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.cc +++ b/chrome/installer/util/google_chrome_sxs_distribution.cc @@ -67,6 +67,10 @@ bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid( return false; } +bool GoogleChromeSxSDistribution::AppHostIsSupported() { + return false; +} + string16 GoogleChromeSxSDistribution::ChannelName() { return kChannelName; } diff --git a/chrome/installer/util/google_chrome_sxs_distribution.h b/chrome/installer/util/google_chrome_sxs_distribution.h index ba63355..89ac420 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.h +++ b/chrome/installer/util/google_chrome_sxs_distribution.h @@ -29,6 +29,7 @@ class GoogleChromeSxSDistribution : public GoogleChromeDistribution { virtual bool GetChromeChannel(string16* channel) OVERRIDE; virtual bool GetCommandExecuteImplClsid( string16* handler_class_uuid) OVERRIDE; + virtual bool AppHostIsSupported() OVERRIDE; // returns the channel name for GoogleChromeSxSDistribution static string16 ChannelName(); private: |