summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-16 04:10:38 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-16 04:10:38 +0000
commit0688d8dc3ed88977a92675dac4d03520d71afc24 (patch)
tree24bb368a1554ccb90194db42fc39c8f7246b32ad /chrome/installer/setup
parentb225e9557f5bca7253d131a9913da4af9cd204e5 (diff)
downloadchromium_src-0688d8dc3ed88977a92675dac4d03520d71afc24.zip
chromium_src-0688d8dc3ed88977a92675dac4d03520d71afc24.tar.gz
chromium_src-0688d8dc3ed88977a92675dac4d03520d71afc24.tar.bz2
Add a limited install extension from webstore command.
chrome/browser/extensions/startup_helper.*: Added a method which does an asynchronous install of an extension. It only handles fixed inputs to limit the surface area of the feature. The callback for LimitedInstallFromWebstore and the "2" are there to help with testing. The core was formed by pulling out common code from InstallFromWebstore. InstallFromWebstore doesn't meet the needs because this command is used for apps (not extensions). chrome/browser/extensions/webstore_standalone_install_browsertest.cc: Made CommandLineWebstoreInstall slightly more general so that it could be used to test the limited install scenario as well. chrome/browser/ui/startup/startup_browser_creator.cc: Handle the command line flag. This location handles flags passed cross-process when a browser instance is already running and another instance is started with the flag. chrome/installer/setup/install_worker.cc: Added the app command to the registry to allow using the limited install switch. This re-uses much of the same code as AddInstallAppCommandWorkItems. chrome/installer/util/installation_validator.* The verification for the new registry entry. chrome/installer/util/installation_validator_unittest.cc: Testing the verification. chrome/common/chrome_switches.*: The command line flag to do the limited install. chrome/installer/util/util_constants.*: The registry key value for the app command. Review URL: https://chromiumcodereview.appspot.com/12226105 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182914 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r--chrome/installer/setup/install_worker.cc67
1 files changed, 54 insertions, 13 deletions
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index 0b337e4..f2696d3 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -221,31 +221,70 @@ string16 GetRegCommandKey(BrowserDistribution* dist,
return cmd_key;
}
-void AddInstallAppCommandWorkItems(const InstallerState& installer_state,
- const InstallationState& machine_state,
- const Version& new_version,
- const Product& product,
- WorkItemList* work_item_list) {
- DCHECK(product.is_chrome_app_host());
- string16 cmd_key(GetRegCommandKey(product.distribution(), kCmdInstallApp));
+// Adds work items to create (or delete if uninstalling) app commands to launch
+// the app with a switch. The following criteria should be true:
+// 1. The switch takes one parameter.
+// 2. The command send pings.
+// 3. The command is web accessible.
+// 4. The command is run as the user.
+void AddCommandWithParameterWorkItems(const InstallerState& installer_state,
+ const InstallationState& machine_state,
+ const Version& new_version,
+ const Product& product,
+ const wchar_t* command_key,
+ const wchar_t* app,
+ const char* command_with_parameter,
+ WorkItemList* work_item_list) {
+ DCHECK(command_key);
+ DCHECK(app);
+ DCHECK(command_with_parameter);
+ DCHECK(work_item_list);
+
+ string16 full_cmd_key(GetRegCommandKey(product.distribution(), command_key));
if (installer_state.operation() == InstallerState::UNINSTALL) {
work_item_list->AddDeleteRegKeyWorkItem(
- installer_state.root_key(), cmd_key)->set_log_message(
- "removing install-application command");
+ installer_state.root_key(), full_cmd_key)->set_log_message(
+ "removing " + WideToASCII(command_key) + " command");
} else {
- CommandLine cmd_line(
- installer_state.target_path().Append(installer::kChromeAppHostExe));
- cmd_line.AppendSwitchASCII(::switches::kInstallFromWebstore, "%1");
+ CommandLine cmd_line(installer_state.target_path().Append(app));
+ cmd_line.AppendSwitchASCII(command_with_parameter, "%1");
AppCommand cmd(cmd_line.GetCommandLineString());
cmd.set_sends_pings(true);
cmd.set_is_web_accessible(true);
cmd.set_is_run_as_user(true);
- cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
+ cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list);
}
}
+void AddInstallAppCommandWorkItems(const InstallerState& installer_state,
+ const InstallationState& machine_state,
+ const Version& new_version,
+ const Product& product,
+ WorkItemList* work_item_list) {
+ DCHECK(product.is_chrome_app_host());
+ AddCommandWithParameterWorkItems(installer_state, machine_state, new_version,
+ product, kCmdInstallApp,
+ installer::kChromeAppHostExe,
+ ::switches::kInstallFromWebstore,
+ work_item_list);
+}
+
+void AddInstallExtensionCommandWorkItem(const InstallerState& installer_state,
+ const InstallationState& machine_state,
+ const FilePath& setup_path,
+ const Version& new_version,
+ const Product& product,
+ WorkItemList* work_item_list) {
+ DCHECK(product.is_chrome());
+ AddCommandWithParameterWorkItems(installer_state, machine_state, new_version,
+ product, kCmdInstallExtension,
+ installer::kChromeExe,
+ ::switches::kLimitedInstallFromWebstore,
+ work_item_list);
+}
+
// Returns the basic CommandLine to setup.exe for a quick-enable operation on
// the binaries. This will unconditionally include --multi-install as well as
// --verbose-logging if the current installation was launched with
@@ -352,6 +391,8 @@ void AddProductSpecificWorkItems(const InstallationState& original_state,
if (p.is_chrome()) {
AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p,
list);
+ AddInstallExtensionCommandWorkItem(installer_state, original_state,
+ setup_path, new_version, p, list);
}
if (p.is_chrome_binaries()) {
AddQueryEULAAcceptanceWorkItems(