Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file contains the definitions of the installer functions that build | 5 // This file contains the definitions of the installer functions that build |
| 6 // the WorkItemList used to install the application. | 6 // the WorkItemList used to install the application. |
| 7 | 7 |
| 8 //Pickup file for readability review. | |
| 9 | |
| 8 #include "chrome/installer/setup/install_worker.h" | 10 #include "chrome/installer/setup/install_worker.h" |
| 9 | 11 |
| 10 #include <oaidl.h> | 12 #include <oaidl.h> |
| 11 #include <shlobj.h> | 13 #include <shlobj.h> |
| 12 #include <time.h> | 14 #include <time.h> |
| 13 | 15 |
| 14 #include <vector> | 16 #include <vector> |
| 15 | 17 |
| 16 #include "base/bind.h" | 18 #include "base/bind.h" |
| 17 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 arraysize(cf_clsid)); | 83 arraysize(cf_clsid)); |
| 82 key_path->append(&cf_clsid[0], len - 1); | 84 key_path->append(&cf_clsid[0], len - 1); |
| 83 } else { | 85 } else { |
| 84 key_path->append(kIELowRightsPolicyOldGuid, | 86 key_path->append(kIELowRightsPolicyOldGuid, |
| 85 arraysize(kIELowRightsPolicyOldGuid)- 1); | 87 arraysize(kIELowRightsPolicyOldGuid)- 1); |
| 86 } | 88 } |
| 87 } | 89 } |
| 88 | 90 |
| 89 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of | 91 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of |
| 90 // products managed by a given package. | 92 // products managed by a given package. |
| 93 // |old_version| can be NULL to indicate no Chrome is currently installed. | |
| 91 void AddRegisterComDllWorkItemsForPackage(const InstallerState& installer_state, | 94 void AddRegisterComDllWorkItemsForPackage(const InstallerState& installer_state, |
| 92 const Version* old_version, | 95 const Version* old_version, |
| 93 const Version& new_version, | 96 const Version& new_version, |
| 94 WorkItemList* work_item_list) { | 97 WorkItemList* work_item_list) { |
| 95 // First collect the list of DLLs to be registered from each product. | 98 // First collect the list of DLLs to be registered from each product. |
| 96 std::vector<FilePath> com_dll_list; | 99 std::vector<FilePath> com_dll_list; |
| 97 installer_state.AddComDllList(&com_dll_list); | 100 installer_state.AddComDllList(&com_dll_list); |
| 98 | 101 |
| 99 // Then, if we got some, attempt to unregister the DLLs from the old | 102 // Then, if we got some, attempt to unregister the DLLs from the old |
| 100 // version directory and then re-register them in the new one. | 103 // version directory and then re-register them in the new one. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 // setup.exe cannot be run again without regenerating the archive, so copy | 166 // setup.exe cannot be run again without regenerating the archive, so copy |
| 164 // it instead in this case to save developer time. | 167 // it instead in this case to save developer time. |
| 165 install_list->AddCopyTreeWorkItem(archive_path.value(), archive_dst.value(), | 168 install_list->AddCopyTreeWorkItem(archive_path.value(), archive_dst.value(), |
| 166 temp_path.value(), WorkItem::ALWAYS); | 169 temp_path.value(), WorkItem::ALWAYS); |
| 167 #endif // COMPONENT_BUILD | 170 #endif // COMPONENT_BUILD |
| 168 } | 171 } |
| 169 } | 172 } |
| 170 | 173 |
| 171 void AddInstallAppCommandWorkItems(const InstallerState& installer_state, | 174 void AddInstallAppCommandWorkItems(const InstallerState& installer_state, |
| 172 const InstallationState& machine_state, | 175 const InstallationState& machine_state, |
| 173 const FilePath* setup_path, | 176 const FilePath& setup_path, |
| 174 const Version* new_version, | 177 const Version& new_version, |
| 175 const Product& product, | 178 const Product& product, |
| 176 WorkItemList* work_item_list) { | 179 WorkItemList* work_item_list) { |
| 177 DCHECK(product.is_chrome_app_host()); | 180 DCHECK(product.is_chrome_app_host()); |
| 178 | 181 |
| 179 string16 cmd_key(product.distribution()->GetVersionKey()); | 182 string16 cmd_key(product.distribution()->GetVersionKey()); |
| 180 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey) | 183 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey) |
| 181 .append(1, L'\\').append(kCmdInstallApp); | 184 .append(1, L'\\').append(kCmdInstallApp); |
| 182 | 185 |
| 183 if (installer_state.operation() != InstallerState::UNINSTALL) { | 186 if (installer_state.operation() == InstallerState::UNINSTALL) { |
| 184 FilePath target_path(installer_state.target_path()); | 187 work_item_list->AddDeleteRegKeyWorkItem( |
| 185 CommandLine cmd_line(target_path.Append(installer::kChromeAppHostExe)); | 188 installer_state.root_key(), cmd_key)->set_log_message( |
| 189 "removing install-application command"); | |
| 190 } else { | |
| 191 CommandLine cmd_line( | |
| 192 installer_state.target_path().Append(installer::kChromeAppHostExe)); | |
| 186 cmd_line.AppendSwitchASCII(::switches::kAppsInstallFromManifestURL, "%1"); | 193 cmd_line.AppendSwitchASCII(::switches::kAppsInstallFromManifestURL, "%1"); |
| 187 | 194 |
| 188 AppCommand cmd(cmd_line.GetCommandLineString()); | 195 AppCommand cmd(cmd_line.GetCommandLineString()); |
| 189 cmd.set_sends_pings(true); | 196 cmd.set_sends_pings(true); |
| 190 cmd.set_is_web_accessible(true); | 197 cmd.set_is_web_accessible(true); |
| 191 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 198 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
| 192 } else { | |
| 193 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | |
| 194 cmd_key)->set_log_message( | |
| 195 "removing install-application command"); | |
| 196 } | 199 } |
| 197 } | 200 } |
| 198 | 201 |
| 199 void AddProductSpecificWorkItems(const InstallationState& original_state, | 202 void AddProductSpecificWorkItems(const InstallationState& original_state, |
| 200 const InstallerState& installer_state, | 203 const InstallerState& installer_state, |
| 201 const FilePath& setup_path, | 204 const FilePath& setup_path, |
| 202 const Version& new_version, | 205 const Version& new_version, |
| 203 WorkItemList* list) { | 206 WorkItemList* list) { |
| 204 const Products& products = installer_state.products(); | 207 const Products& products = installer_state.products(); |
| 205 for (size_t i = 0; i < products.size(); ++i) { | 208 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 206 const Product& p = *products[i]; | 209 ++it) { |
| 210 const Product& p = **it; | |
| 207 if (p.is_chrome_frame()) { | 211 if (p.is_chrome_frame()) { |
| 208 AddChromeFrameWorkItems(original_state, installer_state, setup_path, | 212 AddChromeFrameWorkItems(original_state, installer_state, setup_path, |
| 209 new_version, p, list); | 213 new_version, p, list); |
| 210 } | 214 } |
| 211 if (p.is_chrome_app_host()) { | 215 if (p.is_chrome_app_host()) { |
| 212 AddInstallAppCommandWorkItems(installer_state, original_state, | 216 AddInstallAppCommandWorkItems(installer_state, original_state, |
| 213 &setup_path, &new_version, p, list); | 217 setup_path, new_version, p, list); |
| 214 } | 218 } |
| 215 if (p.is_chrome()) { | 219 if (p.is_chrome()) { |
| 216 AddOsUpgradeWorkItems(installer_state, &setup_path, &new_version, p, | 220 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, |
| 217 list); | 221 list); |
| 218 } | 222 } |
| 219 } | 223 } |
| 220 } | 224 } |
| 221 | 225 |
| 222 // This is called when an MSI installation is run. It may be that a user is | 226 // This is called when an MSI installation is run. It may be that a user is |
| 223 // attempting to install the MSI on top of a non-MSI managed installation. | 227 // attempting to install the MSI on top of a non-MSI managed installation. |
| 224 // If so, try and remove any existing uninstallation shortcuts, as we want the | 228 // If so, try and remove any existing uninstallation shortcuts, as we want the |
| 225 // uninstall to be managed entirely by the MSI machinery (accessible via the | 229 // uninstall to be managed entirely by the MSI machinery (accessible via the |
| 226 // Add/Remove programs dialog). | 230 // Add/Remove programs dialog). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 VLOG(1) << "Deleting old uninstall shortcut (if present): " | 262 VLOG(1) << "Deleting old uninstall shortcut (if present): " |
| 259 << uninstall_link.value(); | 263 << uninstall_link.value(); |
| 260 WorkItem* delete_link = work_item_list->AddDeleteTreeWorkItem( | 264 WorkItem* delete_link = work_item_list->AddDeleteTreeWorkItem( |
| 261 uninstall_link, temp_path); | 265 uninstall_link, temp_path); |
| 262 delete_link->set_ignore_failure(true); | 266 delete_link->set_ignore_failure(true); |
| 263 delete_link->set_log_message( | 267 delete_link->set_log_message( |
| 264 "Failed to delete old uninstall shortcut."); | 268 "Failed to delete old uninstall shortcut."); |
| 265 } | 269 } |
| 266 } | 270 } |
| 267 | 271 |
| 272 // Adds Chrome specific install work items to |install_list|. | |
| 273 // |current_version| can be NULL to indicate no Chrome is currently installed. | |
| 268 void AddChromeWorkItems(const InstallationState& original_state, | 274 void AddChromeWorkItems(const InstallationState& original_state, |
| 269 const InstallerState& installer_state, | 275 const InstallerState& installer_state, |
| 270 const FilePath& setup_path, | 276 const FilePath& setup_path, |
| 271 const FilePath& archive_path, | 277 const FilePath& archive_path, |
| 272 const FilePath& src_path, | 278 const FilePath& src_path, |
| 273 const FilePath& temp_path, | 279 const FilePath& temp_path, |
| 280 const Version* current_version, | |
| 274 const Version& new_version, | 281 const Version& new_version, |
| 275 scoped_ptr<Version>* current_version, | |
| 276 WorkItemList* install_list) { | 282 WorkItemList* install_list) { |
| 277 const FilePath& target_path = installer_state.target_path(); | 283 const FilePath& target_path = installer_state.target_path(); |
| 278 | 284 |
| 279 if (current_version != NULL && current_version->get() != NULL) { | 285 if (current_version) { |
| 280 // Delete the archive from an existing install to save some disk space. We | 286 // Delete the archive from an existing install to save some disk space. We |
| 281 // make this an unconditional work item since there's no need to roll this | 287 // make this an unconditional work item since there's no need to roll this |
| 282 // back; if installation fails we'll be moved to the "-full" channel anyway. | 288 // back; if installation fails we'll be moved to the "-full" channel anyway. |
| 283 FilePath old_installer_dir( | 289 FilePath old_installer_dir( |
| 284 installer_state.GetInstallerDirectory(**current_version)); | 290 installer_state.GetInstallerDirectory(*current_version)); |
| 285 FilePath old_archive(old_installer_dir.Append(installer::kChromeArchive)); | 291 FilePath old_archive(old_installer_dir.Append(installer::kChromeArchive)); |
| 286 // Don't delete the archive that we are actually installing from. | 292 // Don't delete the archive that we are actually installing from. |
| 287 if (archive_path != old_archive) { | 293 if (archive_path != old_archive) { |
| 288 install_list->AddDeleteTreeWorkItem(old_archive, temp_path) | 294 install_list->AddDeleteTreeWorkItem(old_archive, temp_path)-> |
| 289 ->set_ignore_failure(true); | 295 set_ignore_failure(true); |
| 290 } | 296 } |
| 291 } | 297 } |
| 292 | 298 |
| 293 // Delete any new_chrome.exe if present (we will end up creating a new one | 299 // Delete any new_chrome.exe if present (we will end up creating a new one |
| 294 // if required) and then copy chrome.exe | 300 // if required) and then copy chrome.exe |
| 295 FilePath new_chrome_exe(target_path.Append(installer::kChromeNewExe)); | 301 FilePath new_chrome_exe(target_path.Append(installer::kChromeNewExe)); |
| 296 | 302 |
| 297 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); | 303 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); |
| 298 | 304 |
| 299 if (installer_state.IsChromeFrameRunning(original_state)) { | 305 if (installer_state.IsChromeFrameRunning(original_state)) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 temp_path.value(), | 369 temp_path.value(), |
| 364 WorkItem::ALWAYS_MOVE); | 370 WorkItem::ALWAYS_MOVE); |
| 365 #endif // defined(COMPONENT_BUILD) | 371 #endif // defined(COMPONENT_BUILD) |
| 366 | 372 |
| 367 // In the past, we copied rather than moved for system level installs so that | 373 // In the past, we copied rather than moved for system level installs so that |
| 368 // the permissions of %ProgramFiles% would be picked up. Now that |temp_path| | 374 // the permissions of %ProgramFiles% would be picked up. Now that |temp_path| |
| 369 // is in %ProgramFiles% for system level installs (and in %LOCALAPPDATA% | 375 // is in %ProgramFiles% for system level installs (and in %LOCALAPPDATA% |
| 370 // otherwise), there is no need to do this. | 376 // otherwise), there is no need to do this. |
| 371 // Note that we pass true for check_duplicates to avoid failing on in-use | 377 // Note that we pass true for check_duplicates to avoid failing on in-use |
| 372 // repair runs if the current_version is the same as the new_version. | 378 // repair runs if the current_version is the same as the new_version. |
| 373 bool check_for_duplicates = | 379 bool check_for_duplicates = (current_version && |
| 374 (current_version != NULL && current_version->get() != NULL && | 380 current_version->Equals(new_version)); |
| 375 current_version->get()->Equals(new_version)); | |
| 376 install_list->AddMoveTreeWorkItem( | 381 install_list->AddMoveTreeWorkItem( |
| 377 src_path.AppendASCII(new_version.GetString()).value(), | 382 src_path.AppendASCII(new_version.GetString()).value(), |
| 378 target_path.AppendASCII(new_version.GetString()).value(), | 383 target_path.AppendASCII(new_version.GetString()).value(), |
| 379 temp_path.value(), | 384 temp_path.value(), |
| 380 check_for_duplicates ? WorkItem::CHECK_DUPLICATES : | 385 check_for_duplicates ? WorkItem::CHECK_DUPLICATES : |
| 381 WorkItem::ALWAYS_MOVE); | 386 WorkItem::ALWAYS_MOVE); |
| 382 | 387 |
| 383 // Delete any old_chrome.exe if present (ignore failure if it's in use). | 388 // Delete any old_chrome.exe if present (ignore failure if it's in use). |
| 384 install_list->AddDeleteTreeWorkItem( | 389 install_list->AddDeleteTreeWorkItem( |
| 385 target_path.Append(installer::kChromeOldExe), temp_path) | 390 target_path.Append(installer::kChromeOldExe), temp_path)-> |
| 386 ->set_ignore_failure(true); | 391 set_ignore_failure(true); |
| 387 | 392 |
| 388 // Copy installer in install directory and | 393 // Copy installer in install directory and |
| 389 // add shortcut in Control Panel->Add/Remove Programs. | 394 // add shortcut in Control Panel->Add/Remove Programs. |
| 390 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, | 395 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, |
| 391 new_version, install_list); | 396 new_version, install_list); |
| 392 } | 397 } |
| 393 | 398 |
| 394 // Probes COM machinery to get an instance of delegate_execute.exe's | 399 // Probes COM machinery to get an instance of delegate_execute.exe's |
| 395 // CommandExecuteImpl class. This is required so that COM purges its cache of | 400 // CommandExecuteImpl class. This is required so that COM purges its cache of |
| 396 // the path to the binary, which changes on updates. This callback | 401 // the path to the binary, which changes on updates. This callback |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 416 LOG(ERROR) << "Unexpected result creating CommandExecuteImpl; hr=0x" | 421 LOG(ERROR) << "Unexpected result creating CommandExecuteImpl; hr=0x" |
| 417 << std::hex << hr; | 422 << std::hex << hr; |
| 418 } | 423 } |
| 419 } | 424 } |
| 420 | 425 |
| 421 return true; | 426 return true; |
| 422 } | 427 } |
| 423 | 428 |
| 424 void AddGenericQuickEnableWorkItems(const InstallerState& installer_state, | 429 void AddGenericQuickEnableWorkItems(const InstallerState& installer_state, |
| 425 const InstallationState& machine_state, | 430 const InstallationState& machine_state, |
| 426 const FilePath* setup_path, | 431 const FilePath& setup_path, |
| 427 const Version* new_version, | 432 const Version& new_version, |
| 428 WorkItemList* work_item_list, | |
| 429 bool have_child_product, | 433 bool have_child_product, |
| 430 const CommandLine& child_product_switches, | 434 const CommandLine& child_product_switches, |
| 431 const string16& command_id) { | 435 const string16& command_id, |
| 432 DCHECK(setup_path || | 436 WorkItemList* work_item_list) { |
| 433 installer_state.operation() == InstallerState::UNINSTALL); | |
| 434 DCHECK(new_version || | |
| 435 installer_state.operation() == InstallerState::UNINSTALL); | |
| 436 DCHECK(work_item_list); | 437 DCHECK(work_item_list); |
| 437 | 438 |
| 438 const bool system_install = installer_state.system_install(); | 439 const bool system_install = installer_state.system_install(); |
| 439 bool have_chrome_binaries = false; | 440 bool have_chrome_binaries = false; |
| 440 | 441 |
| 441 // STEP 1: Figure out the state of the machine before the operation. | 442 // STEP 1: Figure out the state of the machine before the operation. |
| 442 const ProductState* product_state = NULL; | 443 const ProductState* product_state = NULL; |
| 443 | 444 |
| 444 // Are the Chrome Binaries already on the machine? | 445 // Are the Chrome Binaries already on the machine? |
| 445 product_state = | 446 product_state = machine_state.GetProductState( |
| 446 machine_state.GetProductState(system_install, | 447 system_install, BrowserDistribution::CHROME_BINARIES); |
| 447 BrowserDistribution::CHROME_BINARIES); | |
| 448 if (product_state != NULL && product_state->is_multi_install()) | 448 if (product_state != NULL && product_state->is_multi_install()) |
| 449 have_chrome_binaries = true; | 449 have_chrome_binaries = true; |
| 450 | 450 |
| 451 // STEP 2: Now take into account the current operation. | 451 // STEP 2: Now take into account the current operation. |
| 452 const Product* product = NULL; | 452 const Product* product = NULL; |
| 453 | 453 |
| 454 if (installer_state.operation() == InstallerState::UNINSTALL) { | 454 if (installer_state.operation() == InstallerState::UNINSTALL) { |
| 455 // Forget about multi-install Chrome if it is being uninstalled. | 455 // Forget about multi-install Chrome if it is being uninstalled. |
| 456 product = | 456 product = installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES); |
| 457 installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES); | |
| 458 if (product != NULL && installer_state.is_multi_install()) | 457 if (product != NULL && installer_state.is_multi_install()) |
| 459 have_chrome_binaries = false; | 458 have_chrome_binaries = false; |
| 460 } else { | 459 } else { |
| 461 // Check if we're installing Chrome Binaries | 460 // Check if we're installing Chrome Binaries |
| 462 product = | 461 product = installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES); |
| 463 installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES); | |
| 464 if (product != NULL && installer_state.is_multi_install()) | 462 if (product != NULL && installer_state.is_multi_install()) |
| 465 have_chrome_binaries = true; | 463 have_chrome_binaries = true; |
| 466 } | 464 } |
| 467 | 465 |
| 468 // STEP 3: Decide what to do based on the final state of things. | 466 // STEP 3: Decide what to do based on the final state of things. |
| 469 enum QuickEnableOperation { | 467 enum QuickEnableOperation { |
| 470 DO_NOTHING, | 468 DO_NOTHING, |
| 471 ADD_COMMAND, | 469 ADD_COMMAND, |
| 472 REMOVE_COMMAND | 470 REMOVE_COMMAND |
| 473 } operation = DO_NOTHING; | 471 } operation = DO_NOTHING; |
| 474 FilePath binaries_setup_path; | 472 FilePath binaries_setup_path; |
| 475 | 473 |
| 476 if (have_child_product) { | 474 if (have_child_product) { |
| 477 // Child product is being uninstalled. Unconditionally remove the Quick | 475 // Child product is being uninstalled. Unconditionally remove the Quick |
| 478 // Enable command from the binaries. We do this even if multi-install Chrome | 476 // Enable command from the binaries. We do this even if multi-install Chrome |
| 479 // isn't installed since we don't want them left behind in any case. | 477 // isn't installed since we don't want them left behind in any case. |
| 480 operation = REMOVE_COMMAND; | 478 operation = REMOVE_COMMAND; |
| 481 } else if (have_chrome_binaries) { | 479 } else if (have_chrome_binaries) { |
| 482 // Child product isn't (to be) installed while multi-install Chrome is (to | 480 // Child product isn't (to be) installed while multi-install Chrome is (to |
| 483 // be) installed. Add the Quick Enable command to the binaries. | 481 // be) installed. Add the Quick Enable command to the binaries. |
| 484 operation = ADD_COMMAND; | 482 operation = ADD_COMMAND; |
| 485 // The path to setup.exe contains the version of the Chrome binaries, so it | 483 // The path to setup.exe contains the version of the Chrome binaries, so it |
| 486 // takes a little work to get it right. | 484 // takes a little work to get it right. |
| 487 if (installer_state.operation() == InstallerState::UNINSTALL) { | 485 if (installer_state.operation() == InstallerState::UNINSTALL) { |
| 488 // One or more products are being uninstalled, but not the binaries. Use | 486 // One or more products are being uninstalled, but not the binaries. Use |
| 489 // the path to the currently installed Chrome setup.exe. | 487 // the path to the currently installed Chrome setup.exe. |
| 490 product_state = | 488 product_state = machine_state.GetProductState( |
| 491 machine_state.GetProductState(system_install, | 489 system_install, BrowserDistribution::CHROME_BINARIES); |
| 492 BrowserDistribution::CHROME_BINARIES); | |
| 493 DCHECK(product_state); | 490 DCHECK(product_state); |
| 494 binaries_setup_path = product_state->uninstall_command().GetProgram(); | 491 binaries_setup_path = product_state->uninstall_command().GetProgram(); |
| 495 } else { | 492 } else { |
| 496 // Chrome Binaries are being installed, updated, or otherwise operated on. | 493 // Chrome Binaries are being installed, updated, or otherwise operated on. |
| 497 // Use the path to the given |setup_path| in the normal location of | 494 // Use the path to the given |setup_path| in the normal location of |
| 498 // multi-install Chrome Binaries of the given |version|. | 495 // multi-install Chrome Binaries of the given |version|. |
| 499 DCHECK(installer_state.is_multi_install()); | 496 DCHECK(installer_state.is_multi_install()); |
| 500 binaries_setup_path = | 497 binaries_setup_path = |
| 501 installer_state.GetInstallerDirectory(*new_version).Append( | 498 installer_state.GetInstallerDirectory(new_version).Append( |
| 502 setup_path->BaseName()); | 499 setup_path.BaseName()); |
| 503 } | 500 } |
| 504 } | 501 } |
| 505 | 502 |
| 506 // STEP 4: Take action. | 503 // STEP 4: Take action. |
| 507 if (operation != DO_NOTHING) { | 504 if (operation != DO_NOTHING) { |
| 508 // Get the path to the quick-enable-cf command for the binaries. | 505 // Get the path to the quick-enable-cf command for the binaries. |
| 509 BrowserDistribution* binaries = | 506 BrowserDistribution* binaries = |
| 510 BrowserDistribution::GetSpecificDistribution( | 507 BrowserDistribution::GetSpecificDistribution( |
| 511 BrowserDistribution::CHROME_BINARIES); | 508 BrowserDistribution::CHROME_BINARIES); |
| 512 string16 cmd_key(binaries->GetVersionKey()); | 509 string16 cmd_key(binaries->GetVersionKey()); |
| 513 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey) | 510 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey) |
| 514 .append(1, L'\\').append(command_id); | 511 .append(1, L'\\').append(command_id); |
| 515 | 512 |
| 516 if (operation == ADD_COMMAND) { | 513 if (operation == ADD_COMMAND) { |
| 517 DCHECK(!binaries_setup_path.empty()); | 514 DCHECK(!binaries_setup_path.empty()); |
| 518 CommandLine cmd_line(binaries_setup_path); | 515 CommandLine cmd_line(binaries_setup_path); |
| 519 cmd_line.AppendArguments(child_product_switches, | 516 cmd_line.AppendArguments(child_product_switches, |
| 520 false); // include_program | 517 false); // include_program |
| 521 if (installer_state.verbose_logging()) | 518 if (installer_state.verbose_logging()) |
| 522 cmd_line.AppendSwitch(switches::kVerboseLogging); | 519 cmd_line.AppendSwitch(switches::kVerboseLogging); |
| 523 AppCommand cmd(cmd_line.GetCommandLineString()); | 520 AppCommand cmd(cmd_line.GetCommandLineString()); |
| 524 cmd.set_sends_pings(true); | 521 cmd.set_sends_pings(true); |
| 525 cmd.set_is_web_accessible(true); | 522 cmd.set_is_web_accessible(true); |
| 526 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 523 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
| 527 } else { | 524 } else { |
| 528 DCHECK(operation == REMOVE_COMMAND); | 525 DCHECK(operation == REMOVE_COMMAND); |
| 529 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 526 work_item_list->AddDeleteRegKeyWorkItem( |
| 530 cmd_key)->set_log_message( | 527 installer_state.root_key(), cmd_key)->set_log_message( |
| 531 "removing " + WideToASCII(command_id) + " command"); | 528 "removing " + WideToASCII(command_id) + " command"); |
| 532 } | 529 } |
| 533 } | 530 } |
| 534 } | 531 } |
| 535 | 532 |
| 536 } // namespace | 533 } // namespace |
| 537 | 534 |
| 538 // This method adds work items to create (or update) Chrome uninstall entry in | 535 // This method adds work items to create (or update) Chrome uninstall entry in |
| 539 // either the Control Panel->Add/Remove Programs list or in the Omaha client | 536 // either the Control Panel->Add/Remove Programs list or in the Omaha client |
| 540 // state key if running under an MSI installer. | 537 // state key if running under an MSI installer. |
| 541 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, | 538 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, |
| 542 const FilePath& setup_path, | 539 const FilePath& setup_path, |
| 543 const Version& new_version, | 540 const Version& new_version, |
| 544 WorkItemList* install_list, | 541 const Product& product, |
| 545 const Product& product) { | 542 WorkItemList* install_list) { |
| 546 HKEY reg_root = installer_state.root_key(); | 543 HKEY reg_root = installer_state.root_key(); |
| 547 BrowserDistribution* browser_dist = product.distribution(); | 544 BrowserDistribution* browser_dist = product.distribution(); |
| 548 DCHECK(browser_dist); | 545 DCHECK(browser_dist); |
| 549 | 546 |
| 550 // When we are installed via an MSI, we need to store our uninstall strings | 547 // When we are installed via an MSI, we need to store our uninstall strings |
| 551 // in the Google Update client state key. We do this even for non-MSI | 548 // in the Google Update client state key. We do this even for non-MSI |
| 552 // managed installs to avoid breaking the edge case whereby an MSI-managed | 549 // managed installs to avoid breaking the edge case whereby an MSI-managed |
| 553 // install is updated by a non-msi installer (which would confuse the MSI | 550 // install is updated by a non-msi installer (which would confuse the MSI |
| 554 // machinery if these strings were not also updated). The UninstallString | 551 // machinery if these strings were not also updated). The UninstallString |
| 555 // value placed in the client state key is also used by the mini_installer to | 552 // value placed in the client state key is also used by the mini_installer to |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 708 // Nothing is being installed? Entirely unexpected, so do no harm. | 705 // Nothing is being installed? Entirely unexpected, so do no harm. |
| 709 LOG(ERROR) << "No products found in AddOemInstallWorkItems"; | 706 LOG(ERROR) << "No products found in AddOemInstallWorkItems"; |
| 710 return; | 707 return; |
| 711 } | 708 } |
| 712 const ProductState* source_product = | 709 const ProductState* source_product = |
| 713 original_state.GetNonVersionedProductState(system_install, source_type); | 710 original_state.GetNonVersionedProductState(system_install, source_type); |
| 714 | 711 |
| 715 string16 oem_install; | 712 string16 oem_install; |
| 716 if (source_product->GetOemInstall(&oem_install)) { | 713 if (source_product->GetOemInstall(&oem_install)) { |
| 717 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " | 714 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " |
| 718 << BrowserDistribution::GetSpecificDistribution(source_type) | 715 << BrowserDistribution::GetSpecificDistribution(source_type)-> |
| 719 ->GetAppShortCutName(); | 716 GetAppShortCutName(); |
| 720 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 717 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); |
| 721 // Always overwrite an old value. | 718 // Always overwrite an old value. |
| 722 install_list->AddSetRegValueWorkItem(root_key, multi_key, | 719 install_list->AddSetRegValueWorkItem(root_key, multi_key, |
| 723 google_update::kRegOemInstallField, | 720 google_update::kRegOemInstallField, |
| 724 oem_install, true); | 721 oem_install, true); |
| 725 } else { | 722 } else { |
| 726 // Clear any old value. | 723 // Clear any old value. |
| 727 install_list->AddDeleteRegValueWorkItem( | 724 install_list->AddDeleteRegValueWorkItem( |
| 728 root_key, multi_key, google_update::kRegOemInstallField); | 725 root_key, multi_key, google_update::kRegOemInstallField); |
| 729 } | 726 } |
| 730 } | 727 } |
| 731 } | 728 } |
| 732 | 729 |
| 733 // Mirror eulaaccepted the first time anything is installed multi. There is no | 730 // Mirror eulaaccepted the first time anything is installed multi. There is no |
|
dominich
2012/09/10 15:40:42
nit: single space after period.
1 other places in
gab
2012/09/10 19:14:05
This is grt@'s comment/grammar style, he has been
grt (UTC plus 2)
2012/09/10 19:59:30
Get out of my yard.
dominich
2012/09/10 20:33:46
Challenge accepted!
Use of correct punctuation, s
| |
| 734 // need to update the value on future install/update runs since | 731 // need to update the value on future install/update runs since |
| 735 // GoogleUpdateSettings::SetEULAConsent will modify the value for both the | 732 // GoogleUpdateSettings::SetEULAConsent will modify the value for both the |
| 736 // relevant product and for the binaries. | 733 // relevant product and for the binaries. |
| 737 void AddEulaAcceptedWorkItems(const InstallationState& original_state, | 734 void AddEulaAcceptedWorkItems(const InstallationState& original_state, |
| 738 const InstallerState& installer_state, | 735 const InstallerState& installer_state, |
| 739 WorkItemList* install_list) { | 736 WorkItemList* install_list) { |
| 740 DCHECK(installer_state.is_multi_install()); | 737 DCHECK(installer_state.is_multi_install()); |
| 741 const bool system_install = installer_state.system_install(); | 738 const bool system_install = installer_state.system_install(); |
| 742 if (!original_state.GetProductState(system_install, | 739 if (!original_state.GetProductState(system_install, |
| 743 BrowserDistribution::CHROME_BINARIES)) { | 740 BrowserDistribution::CHROME_BINARIES)) { |
| 744 const HKEY root_key = installer_state.root_key(); | 741 const HKEY root_key = installer_state.root_key(); |
| 745 string16 multi_key( | 742 string16 multi_key( |
| 746 installer_state.multi_package_binaries_distribution()->GetStateKey()); | 743 installer_state.multi_package_binaries_distribution()->GetStateKey()); |
| 747 | 744 |
| 748 // Copy the value from the product with the greatest value. | 745 // Copy the value from the product with the greatest value. |
| 749 bool have_eula_accepted = false; | 746 bool have_eula_accepted = false; |
| 750 BrowserDistribution::Type product_type; | 747 BrowserDistribution::Type product_type; |
| 751 DWORD eula_accepted; | 748 DWORD eula_accepted; |
| 752 const Products& products = installer_state.products(); | 749 const Products& products = installer_state.products(); |
| 753 for (size_t i = 0, count = products.size(); i != count; ++i) { | 750 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 754 if (products[i]->is_chrome_binaries()) | 751 ++it) { |
| 752 const Product& product = **it; | |
| 753 if (product.is_chrome_binaries()) | |
| 755 continue; | 754 continue; |
| 756 DWORD dword_value = 0; | 755 DWORD dword_value = 0; |
| 757 BrowserDistribution::Type this_type = | 756 BrowserDistribution::Type this_type = |
|
dominich
2012/09/10 15:40:42
nit - this fits on one line.
gab
2012/09/10 19:14:05
Done.
| |
| 758 products[i]->distribution()->GetType(); | 757 product.distribution()->GetType(); |
| 759 const ProductState* product_state = | 758 const ProductState* product_state = |
| 760 original_state.GetNonVersionedProductState( | 759 original_state.GetNonVersionedProductState( |
| 761 system_install, this_type); | 760 system_install, this_type); |
| 762 if (product_state->GetEulaAccepted(&dword_value) && | 761 if (product_state->GetEulaAccepted(&dword_value) && |
| 763 (!have_eula_accepted || dword_value > eula_accepted)) { | 762 (!have_eula_accepted || dword_value > eula_accepted)) { |
| 764 have_eula_accepted = true; | 763 have_eula_accepted = true; |
| 765 eula_accepted = dword_value; | 764 eula_accepted = dword_value; |
| 766 product_type = this_type; | 765 product_type = this_type; |
| 767 } | 766 } |
| 768 } | 767 } |
| 769 | 768 |
| 770 if (have_eula_accepted) { | 769 if (have_eula_accepted) { |
| 771 VLOG(1) << "Mirroring eulaaccepted=" << eula_accepted << " from " | 770 VLOG(1) << "Mirroring eulaaccepted=" << eula_accepted << " from " |
| 772 << BrowserDistribution::GetSpecificDistribution(product_type) | 771 << BrowserDistribution::GetSpecificDistribution(product_type)-> |
| 773 ->GetAppShortCutName(); | 772 GetAppShortCutName(); |
| 774 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 773 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); |
| 775 install_list->AddSetRegValueWorkItem( | 774 install_list->AddSetRegValueWorkItem( |
| 776 root_key, multi_key, google_update::kRegEULAAceptedField, | 775 root_key, multi_key, google_update::kRegEULAAceptedField, |
| 777 eula_accepted, true); | 776 eula_accepted, true); |
| 778 } else { | 777 } else { |
| 779 // Clear any old value. | 778 // Clear any old value. |
| 780 install_list->AddDeleteRegValueWorkItem( | 779 install_list->AddDeleteRegValueWorkItem( |
| 781 root_key, multi_key, google_update::kRegEULAAceptedField); | 780 root_key, multi_key, google_update::kRegEULAAceptedField); |
| 782 } | 781 } |
| 783 } | 782 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 823 // if one is already present (although this shouldn't happen). | 822 // if one is already present (although this shouldn't happen). |
| 824 install_list->AddSetRegValueWorkItem(root_key, | 823 install_list->AddSetRegValueWorkItem(root_key, |
| 825 multi_key, | 824 multi_key, |
| 826 google_update::kRegBrandField, | 825 google_update::kRegBrandField, |
| 827 brand, | 826 brand, |
| 828 false); | 827 false); |
| 829 } | 828 } |
| 830 } | 829 } |
| 831 | 830 |
| 832 AddOemInstallWorkItems(original_state, installer_state, install_list); | 831 AddOemInstallWorkItems(original_state, installer_state, install_list); |
| 833 | 832 |
|
dominich
2012/09/10 15:40:42
nit: remove blank lines here and 834
gab
2012/09/10 19:14:05
Done.
| |
| 834 AddEulaAcceptedWorkItems(original_state, installer_state, install_list); | 833 AddEulaAcceptedWorkItems(original_state, installer_state, install_list); |
| 835 | 834 |
| 836 AddUsageStatsWorkItems(original_state, installer_state, install_list); | 835 AddUsageStatsWorkItems(original_state, installer_state, install_list); |
| 837 | 836 |
| 838 // TODO(grt): check for other keys/values we should put in the package's | 837 // TODO(grt): check for other keys/values we should put in the package's |
| 839 // ClientState and/or Clients key. | 838 // ClientState and/or Clients key. |
| 840 } | 839 } |
| 841 | 840 |
| 842 void AddUsageStatsWorkItems(const InstallationState& original_state, | 841 void AddUsageStatsWorkItems(const InstallationState& original_state, |
| 843 const InstallerState& installer_state, | 842 const InstallerState& installer_state, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 883 install_list->AddDeleteRegValueWorkItem( | 882 install_list->AddDeleteRegValueWorkItem( |
| 884 root_key, dist->GetStateMediumKey(), | 883 root_key, dist->GetStateMediumKey(), |
| 885 google_update::kRegUsageStatsField); | 884 google_update::kRegUsageStatsField); |
| 886 // Previous versions of Chrome also wrote a value in HKCU even for | 885 // Previous versions of Chrome also wrote a value in HKCU even for |
| 887 // system-level installs, so clean that up. | 886 // system-level installs, so clean that up. |
| 888 install_list->AddDeleteRegValueWorkItem( | 887 install_list->AddDeleteRegValueWorkItem( |
| 889 HKEY_CURRENT_USER, dist->GetStateKey(), | 888 HKEY_CURRENT_USER, dist->GetStateKey(), |
| 890 google_update::kRegUsageStatsField); | 889 google_update::kRegUsageStatsField); |
| 891 } | 890 } |
| 892 install_list->AddDeleteRegValueWorkItem(root_key, dist->GetStateKey(), | 891 install_list->AddDeleteRegValueWorkItem(root_key, dist->GetStateKey(), |
| 893 google_update::kRegUsageStatsField); | 892 google_update::kRegUsageStatsField); |
|
dominich
2012/09/10 15:40:42
this should be aligned to root_key, or the first t
gab
2012/09/10 19:14:05
Done.
| |
| 894 } | 893 } |
| 895 } | 894 } |
| 896 } | 895 } |
| 897 | 896 |
| 898 // After a successful copying of all the files, this function is called to | |
| 899 // do a few post install tasks: | |
| 900 // - Handle the case of in-use-update by updating "opv" (old version) key or | |
| 901 // deleting it if not required. | |
| 902 // - Register any new dlls and unregister old dlls. | |
| 903 // - If this is an MSI install, ensures that the MSI marker is set, and sets | |
| 904 // it if not. | |
| 905 // If these operations are successful, the function returns true, otherwise | |
| 906 // false. | |
| 907 bool AppendPostInstallTasks(const InstallerState& installer_state, | 897 bool AppendPostInstallTasks(const InstallerState& installer_state, |
| 908 const FilePath& setup_path, | 898 const FilePath& setup_path, |
| 909 const Version* current_version, | 899 const Version* current_version, |
| 910 const Version& new_version, | 900 const Version& new_version, |
| 911 const FilePath& temp_path, | 901 const FilePath& temp_path, |
| 912 WorkItemList* post_install_task_list) { | 902 WorkItemList* post_install_task_list) { |
| 913 DCHECK(post_install_task_list); | 903 DCHECK(post_install_task_list); |
| 914 | 904 |
| 915 HKEY root = installer_state.root_key(); | 905 HKEY root = installer_state.root_key(); |
| 916 const Products& products = installer_state.products(); | 906 const Products& products = installer_state.products(); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 940 rename.AppendSwitch(switches::kSystemLevel); | 930 rename.AppendSwitch(switches::kSystemLevel); |
| 941 | 931 |
| 942 if (installer_state.verbose_logging()) | 932 if (installer_state.verbose_logging()) |
| 943 rename.AppendSwitch(switches::kVerboseLogging); | 933 rename.AppendSwitch(switches::kVerboseLogging); |
| 944 | 934 |
| 945 string16 version_key; | 935 string16 version_key; |
| 946 for (size_t i = 0; i < products.size(); ++i) { | 936 for (size_t i = 0; i < products.size(); ++i) { |
| 947 BrowserDistribution* dist = products[i]->distribution(); | 937 BrowserDistribution* dist = products[i]->distribution(); |
| 948 version_key = dist->GetVersionKey(); | 938 version_key = dist->GetVersionKey(); |
| 949 | 939 |
| 950 if (current_version != NULL) { | 940 if (current_version) { |
| 951 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 941 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, |
| 952 google_update::kRegOldVersionField, | 942 google_update::kRegOldVersionField, |
| 953 ASCIIToWide(current_version->GetString()), true); | 943 ASCIIToWide(current_version->GetString()), true); |
| 954 } | 944 } |
| 955 if (critical_version.IsValid()) { | 945 if (critical_version.IsValid()) { |
| 956 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 946 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, |
| 957 google_update::kRegCriticalVersionField, | 947 google_update::kRegCriticalVersionField, |
| 958 ASCIIToWide(critical_version.GetString()), true); | 948 ASCIIToWide(critical_version.GetString()), true); |
| 959 } else { | 949 } else { |
| 960 in_use_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 950 in_use_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1035 | 1025 |
| 1036 return true; | 1026 return true; |
| 1037 } | 1027 } |
| 1038 | 1028 |
| 1039 void AddInstallWorkItems(const InstallationState& original_state, | 1029 void AddInstallWorkItems(const InstallationState& original_state, |
| 1040 const InstallerState& installer_state, | 1030 const InstallerState& installer_state, |
| 1041 const FilePath& setup_path, | 1031 const FilePath& setup_path, |
| 1042 const FilePath& archive_path, | 1032 const FilePath& archive_path, |
| 1043 const FilePath& src_path, | 1033 const FilePath& src_path, |
| 1044 const FilePath& temp_path, | 1034 const FilePath& temp_path, |
| 1035 const Version* current_version, | |
| 1045 const Version& new_version, | 1036 const Version& new_version, |
| 1046 scoped_ptr<Version>* current_version, | |
| 1047 WorkItemList* install_list) { | 1037 WorkItemList* install_list) { |
| 1048 DCHECK(install_list); | 1038 DCHECK(install_list); |
| 1049 | 1039 |
| 1050 const FilePath& target_path = installer_state.target_path(); | 1040 const FilePath& target_path = installer_state.target_path(); |
| 1051 | 1041 |
| 1052 // A temp directory that work items need and the actual install directory. | 1042 // A temp directory that work items need and the actual install directory. |
| 1053 install_list->AddCreateDirWorkItem(temp_path); | 1043 install_list->AddCreateDirWorkItem(temp_path); |
| 1054 install_list->AddCreateDirWorkItem(target_path); | 1044 install_list->AddCreateDirWorkItem(target_path); |
| 1055 | 1045 |
| 1056 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) || | 1046 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) || |
| 1057 installer_state.FindProduct(BrowserDistribution::CHROME_FRAME) || | 1047 installer_state.FindProduct(BrowserDistribution::CHROME_FRAME) || |
| 1058 installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { | 1048 installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { |
| 1059 AddChromeWorkItems(original_state, | 1049 AddChromeWorkItems(original_state, |
| 1060 installer_state, | 1050 installer_state, |
| 1061 setup_path, | 1051 setup_path, |
| 1062 archive_path, | 1052 archive_path, |
| 1063 src_path, | 1053 src_path, |
| 1064 temp_path, | 1054 temp_path, |
| 1055 current_version, | |
| 1065 new_version, | 1056 new_version, |
| 1066 current_version, | |
| 1067 install_list); | 1057 install_list); |
| 1068 } | 1058 } |
| 1069 | 1059 |
| 1070 if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 1060 if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
| 1071 install_list->AddCopyTreeWorkItem( | 1061 install_list->AddCopyTreeWorkItem( |
| 1072 src_path.Append(installer::kChromeAppHostExe).value(), | 1062 src_path.Append(installer::kChromeAppHostExe).value(), |
| 1073 target_path.Append(installer::kChromeAppHostExe).value(), | 1063 target_path.Append(installer::kChromeAppHostExe).value(), |
| 1074 temp_path.value(), | 1064 temp_path.value(), |
| 1075 WorkItem::ALWAYS, | 1065 WorkItem::ALWAYS, |
| 1076 L""); | 1066 L""); |
| 1077 } | 1067 } |
| 1078 | 1068 |
| 1079 const HKEY root = installer_state.root_key(); | 1069 const HKEY root = installer_state.root_key(); |
| 1080 // Only set "lang" for user-level installs since for system-level, the install | 1070 // Only set "lang" for user-level installs since for system-level, the install |
| 1081 // language may not be related to a given user's runtime language. | 1071 // language may not be related to a given user's runtime language. |
| 1082 const bool add_language_identifier = !installer_state.system_install(); | 1072 const bool add_language_identifier = !installer_state.system_install(); |
| 1083 | 1073 |
| 1084 const Products& products = installer_state.products(); | 1074 const Products& products = installer_state.products(); |
| 1085 for (size_t i = 0; i < products.size(); ++i) { | 1075 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 1086 const Product* product = products[i]; | 1076 ++it) { |
| 1077 const Product& product = **it; | |
| 1087 | 1078 |
| 1088 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version, | 1079 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version, |
| 1089 install_list, *product); | 1080 product, install_list); |
| 1090 | 1081 |
| 1091 AddVersionKeyWorkItems(root, product->distribution(), new_version, | 1082 AddVersionKeyWorkItems(root, product.distribution(), new_version, |
| 1092 add_language_identifier, install_list); | 1083 add_language_identifier, install_list); |
| 1093 | 1084 |
| 1094 AddDelegateExecuteWorkItems(installer_state, src_path, new_version, | 1085 AddDelegateExecuteWorkItems(installer_state, src_path, new_version, |
| 1095 *product, install_list); | 1086 product, install_list); |
| 1096 | 1087 |
| 1097 // TODO(gab): This is only disabled for M22 as the shortcut CL using Active | 1088 // TODO(gab): This is only disabled for M22 as the shortcut CL using Active |
| 1098 // Setup will not make it in M22. | 1089 // Setup will not make it in M22. |
| 1099 #if 0 | 1090 #if 0 |
| 1100 AddActiveSetupWorkItems(installer_state, new_version, *product, | 1091 AddActiveSetupWorkItems(installer_state, new_version, *product, |
| 1101 install_list); | 1092 install_list); |
| 1102 #endif | 1093 #endif |
| 1103 } | 1094 } |
| 1104 | 1095 |
| 1105 // Add any remaining work items that involve special settings for | 1096 // Add any remaining work items that involve special settings for |
| 1106 // each product. | 1097 // each product. |
| 1107 AddProductSpecificWorkItems(original_state, installer_state, setup_path, | 1098 AddProductSpecificWorkItems(original_state, installer_state, setup_path, |
| 1108 new_version, install_list); | 1099 new_version, install_list); |
| 1109 | 1100 |
| 1110 // Copy over brand, usagestats, and other values. | 1101 // Copy over brand, usagestats, and other values. |
| 1111 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); | 1102 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); |
| 1112 | 1103 |
| 1113 AddQuickEnableApplicationHostWorkItems(installer_state, original_state, | 1104 AddQuickEnableApplicationHostWorkItems(installer_state, original_state, |
| 1114 &setup_path, &new_version, | 1105 setup_path, new_version, |
| 1115 install_list); | 1106 install_list); |
| 1116 | 1107 |
| 1117 AddQuickEnableChromeFrameWorkItems(installer_state, original_state, | 1108 AddQuickEnableChromeFrameWorkItems(installer_state, original_state, |
| 1118 &setup_path, &new_version, install_list); | 1109 setup_path, new_version, install_list); |
| 1119 | 1110 |
| 1120 // Append the tasks that run after the installation. | 1111 // Append the tasks that run after the installation. |
| 1121 AppendPostInstallTasks(installer_state, | 1112 AppendPostInstallTasks(installer_state, |
| 1122 setup_path, | 1113 setup_path, |
| 1123 current_version->get(), | 1114 current_version, |
| 1124 new_version, | 1115 new_version, |
| 1125 temp_path, | 1116 temp_path, |
| 1126 install_list); | 1117 install_list); |
| 1127 } | 1118 } |
| 1128 | 1119 |
| 1129 void AddRegisterComDllWorkItems(const FilePath& dll_folder, | 1120 void AddRegisterComDllWorkItems(const FilePath& dll_folder, |
| 1130 const std::vector<FilePath>& dll_list, | 1121 const std::vector<FilePath>& dll_list, |
| 1131 bool system_level, | 1122 bool system_level, |
| 1132 bool do_register, | 1123 bool do_register, |
| 1133 bool ignore_failures, | 1124 bool ignore_failures, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1182 BrowserDistribution* dist = | 1173 BrowserDistribution* dist = |
| 1183 installer_state.multi_package_binaries_distribution(); | 1174 installer_state.multi_package_binaries_distribution(); |
| 1184 if (ready_mode) { | 1175 if (ready_mode) { |
| 1185 // If GCF is being installed in ready mode, we write an entry to the | 1176 // If GCF is being installed in ready mode, we write an entry to the |
| 1186 // multi-install state key. If the value already exists, we will not | 1177 // multi-install state key. If the value already exists, we will not |
| 1187 // overwrite it since the user might have opted out. | 1178 // overwrite it since the user might have opted out. |
| 1188 list->AddCreateRegKeyWorkItem(root, dist->GetStateKey()); | 1179 list->AddCreateRegKeyWorkItem(root, dist->GetStateKey()); |
| 1189 list->AddSetRegValueWorkItem(root, dist->GetStateKey(), | 1180 list->AddSetRegValueWorkItem(root, dist->GetStateKey(), |
| 1190 kChromeFrameReadyModeField, | 1181 kChromeFrameReadyModeField, |
| 1191 static_cast<int64>(is_install ? 1 : 0), // The value we want to set. | 1182 static_cast<int64>(is_install ? 1 : 0), // The value we want to set. |
| 1192 is_install ? false : true); // Overwrite existing value. | 1183 !is_install); // Overwrite existing value. |
| 1193 if (is_install) { | 1184 if (is_install) { |
| 1194 FilePath installer_path(installer_state | 1185 FilePath installer_path(installer_state |
| 1195 .GetInstallerDirectory(new_version).Append(setup_path.BaseName())); | 1186 .GetInstallerDirectory(new_version).Append(setup_path.BaseName())); |
| 1196 | 1187 |
| 1197 CommandLine basic_cl(installer_path); | 1188 CommandLine basic_cl(installer_path); |
| 1198 basic_cl.AppendSwitch(switches::kChromeFrame); | 1189 basic_cl.AppendSwitch(switches::kChromeFrame); |
| 1199 basic_cl.AppendSwitch(switches::kMultiInstall); | 1190 basic_cl.AppendSwitch(switches::kMultiInstall); |
| 1200 | 1191 |
| 1201 if (installer_state.system_install()) | 1192 if (installer_state.system_install()) |
| 1202 basic_cl.AppendSwitch(switches::kSystemLevel); | 1193 basic_cl.AppendSwitch(switches::kSystemLevel); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1277 google_update::kRegCFOptOutCmdField); | 1268 google_update::kRegCFOptOutCmdField); |
| 1278 list->AddDeleteRegValueWorkItem(root, version_key, | 1269 list->AddDeleteRegValueWorkItem(root, version_key, |
| 1279 google_update::kRegCFOptInCmdField); | 1270 google_update::kRegCFOptInCmdField); |
| 1280 } | 1271 } |
| 1281 | 1272 |
| 1282 if (update_chrome_uninstall_command) { | 1273 if (update_chrome_uninstall_command) { |
| 1283 // Chrome is not a part of this installation run, so we have to explicitly | 1274 // Chrome is not a part of this installation run, so we have to explicitly |
| 1284 // check if Chrome is installed, and if so, update its uninstallation | 1275 // check if Chrome is installed, and if so, update its uninstallation |
| 1285 // command lines. | 1276 // command lines. |
| 1286 const ProductState* chrome_state = original_state.GetProductState( | 1277 const ProductState* chrome_state = original_state.GetProductState( |
| 1287 installer_state.system_install(), | 1278 installer_state.system_install(), BrowserDistribution::CHROME_BROWSER); |
| 1288 BrowserDistribution::CHROME_BROWSER); | |
| 1289 if (chrome_state != NULL) { | 1279 if (chrome_state != NULL) { |
| 1290 DCHECK(chrome_state->is_multi_install()); | 1280 DCHECK(chrome_state->is_multi_install()); |
| 1291 Product chrome(BrowserDistribution::GetSpecificDistribution( | 1281 Product chrome(BrowserDistribution::GetSpecificDistribution( |
| 1292 BrowserDistribution::CHROME_BROWSER)); | 1282 BrowserDistribution::CHROME_BROWSER)); |
| 1293 chrome.InitializeFromUninstallCommand(chrome_state->uninstall_command()); | 1283 chrome.InitializeFromUninstallCommand(chrome_state->uninstall_command()); |
| 1294 AddUninstallShortcutWorkItems(installer_state, setup_path, | 1284 AddUninstallShortcutWorkItems(installer_state, setup_path, |
| 1295 chrome_state->version(), list, chrome); | 1285 chrome_state->version(), chrome, list); |
| 1296 } else { | 1286 } else { |
| 1297 NOTREACHED() << "What happened to Chrome?"; | 1287 NOTREACHED() << "What happened to Chrome?"; |
| 1298 } | 1288 } |
| 1299 } | 1289 } |
| 1300 } | 1290 } |
| 1301 | 1291 |
| 1302 void AddDelegateExecuteWorkItems(const InstallerState& installer_state, | 1292 void AddDelegateExecuteWorkItems(const InstallerState& installer_state, |
| 1303 const FilePath& src_path, | 1293 const FilePath& src_path, |
| 1304 const Version& new_version, | 1294 const Version& new_version, |
| 1305 const Product& product, | 1295 const Product& product, |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1490 } | 1480 } |
| 1491 | 1481 |
| 1492 FreeLibrary(ieframe); | 1482 FreeLibrary(ieframe); |
| 1493 } else { | 1483 } else { |
| 1494 VLOG(1) << "Cannot load " << kIEFrameDll; | 1484 VLOG(1) << "Cannot load " << kIEFrameDll; |
| 1495 } | 1485 } |
| 1496 } | 1486 } |
| 1497 | 1487 |
| 1498 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state, | 1488 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state, |
| 1499 const InstallationState& machine_state, | 1489 const InstallationState& machine_state, |
| 1500 const FilePath* setup_path, | 1490 const FilePath& setup_path, |
| 1501 const Version* new_version, | 1491 const Version& new_version, |
| 1502 WorkItemList* work_item_list) { | 1492 WorkItemList* work_item_list) { |
| 1503 DCHECK(setup_path || | |
| 1504 installer_state.operation() == InstallerState::UNINSTALL); | |
| 1505 DCHECK(new_version || | |
| 1506 installer_state.operation() == InstallerState::UNINSTALL); | |
| 1507 DCHECK(work_item_list); | 1493 DCHECK(work_item_list); |
| 1508 | 1494 |
| 1509 const bool system_install = installer_state.system_install(); | 1495 const bool system_install = installer_state.system_install(); |
| 1510 bool have_chrome_frame = false; | 1496 bool have_chrome_frame = false; |
| 1511 | 1497 |
| 1512 // STEP 1: Figure out the state of the machine before the operation. | 1498 // STEP 1: Figure out the state of the machine before the operation. |
| 1513 const ProductState* product_state = NULL; | 1499 const ProductState* product_state = NULL; |
| 1514 | 1500 |
| 1515 // Is Chrome Frame !ready-mode already on the machine? | 1501 // Is Chrome Frame !ready-mode already on the machine? |
| 1516 product_state = | 1502 product_state = machine_state.GetProductState( |
| 1517 machine_state.GetProductState(system_install, | 1503 system_install, BrowserDistribution::CHROME_FRAME); |
| 1518 BrowserDistribution::CHROME_FRAME); | |
| 1519 if (product_state != NULL && | 1504 if (product_state != NULL && |
| 1520 !product_state->uninstall_command().HasSwitch( | 1505 !product_state->uninstall_command().HasSwitch( |
| 1521 switches::kChromeFrameReadyMode)) | 1506 switches::kChromeFrameReadyMode)) |
| 1522 have_chrome_frame = true; | 1507 have_chrome_frame = true; |
| 1523 | 1508 |
| 1524 // STEP 2: Now take into account the current operation. | 1509 // STEP 2: Now take into account the current operation. |
| 1525 const Product* product = NULL; | 1510 const Product* product = NULL; |
| 1526 | 1511 |
| 1527 if (installer_state.operation() == InstallerState::UNINSTALL) { | 1512 if (installer_state.operation() == InstallerState::UNINSTALL) { |
| 1528 // Forget about Chrome Frame if it is being uninstalled. Note that we don't | 1513 // Forget about Chrome Frame if it is being uninstalled. Note that we don't |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1543 CommandLine cmd_line(CommandLine::NO_PROGRAM); | 1528 CommandLine cmd_line(CommandLine::NO_PROGRAM); |
| 1544 cmd_line.AppendSwitch(switches::kMultiInstall); | 1529 cmd_line.AppendSwitch(switches::kMultiInstall); |
| 1545 if (installer_state.system_install()) | 1530 if (installer_state.system_install()) |
| 1546 cmd_line.AppendSwitch(switches::kSystemLevel); | 1531 cmd_line.AppendSwitch(switches::kSystemLevel); |
| 1547 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); | 1532 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); |
| 1548 | 1533 |
| 1549 AddGenericQuickEnableWorkItems(installer_state, | 1534 AddGenericQuickEnableWorkItems(installer_state, |
| 1550 machine_state, | 1535 machine_state, |
| 1551 setup_path, | 1536 setup_path, |
| 1552 new_version, | 1537 new_version, |
| 1553 work_item_list, | |
| 1554 have_chrome_frame, | 1538 have_chrome_frame, |
| 1555 cmd_line, | 1539 cmd_line, |
| 1556 kCmdQuickEnableCf); | 1540 kCmdQuickEnableCf, |
| 1541 work_item_list); | |
| 1557 } | 1542 } |
| 1558 | 1543 |
| 1559 void AddQuickEnableApplicationHostWorkItems( | 1544 void AddQuickEnableApplicationHostWorkItems( |
| 1560 const InstallerState& installer_state, | 1545 const InstallerState& installer_state, |
| 1561 const InstallationState& machine_state, | 1546 const InstallationState& machine_state, |
| 1562 const FilePath* setup_path, | 1547 const FilePath& setup_path, |
| 1563 const Version* new_version, | 1548 const Version& new_version, |
| 1564 WorkItemList* work_item_list) { | 1549 WorkItemList* work_item_list) { |
| 1565 DCHECK(setup_path || | |
| 1566 installer_state.operation() == InstallerState::UNINSTALL); | |
| 1567 DCHECK(new_version || | |
| 1568 installer_state.operation() == InstallerState::UNINSTALL); | |
| 1569 DCHECK(work_item_list); | 1550 DCHECK(work_item_list); |
| 1570 | 1551 |
| 1571 CommandLine cmd_line(CommandLine::NO_PROGRAM); | 1552 CommandLine cmd_line(CommandLine::NO_PROGRAM); |
| 1572 cmd_line.AppendSwitch(switches::kMultiInstall); | 1553 cmd_line.AppendSwitch(switches::kMultiInstall); |
| 1573 cmd_line.AppendSwitch(switches::kChromeAppHost); | 1554 cmd_line.AppendSwitch(switches::kChromeAppHost); |
| 1574 | 1555 |
| 1575 // For system-level binaries there is no way to keep the command state in sync | 1556 // For system-level binaries there is no way to keep the command state in sync |
| 1576 // with the installation/uninstallation of the Application Host (which is | 1557 // with the installation/uninstallation of the Application Host (which is |
| 1577 // always at user-level). | 1558 // always at user-level). |
| 1578 // So we pass false for 'have_child_product' to cause this command to always | 1559 // So we pass false for 'have_child_product' to cause this command to always |
| 1579 // be installed if the Chrome Binaries are installed. | 1560 // be installed if the Chrome Binaries are installed. |
| 1580 AddGenericQuickEnableWorkItems(installer_state, | 1561 AddGenericQuickEnableWorkItems(installer_state, |
| 1581 machine_state, | 1562 machine_state, |
| 1582 setup_path, | 1563 setup_path, |
| 1583 new_version, | 1564 new_version, |
| 1584 work_item_list, | |
| 1585 false, // have_child_product | 1565 false, // have_child_product |
| 1586 cmd_line, | 1566 cmd_line, |
| 1587 kCmdQuickEnableApplicationHost); | 1567 kCmdQuickEnableApplicationHost, |
| 1568 work_item_list); | |
| 1588 } | 1569 } |
| 1589 | 1570 |
| 1590 void AddOsUpgradeWorkItems(const InstallerState& installer_state, | 1571 void AddOsUpgradeWorkItems(const InstallerState& installer_state, |
| 1591 const FilePath* setup_path, | 1572 const FilePath& setup_path, |
| 1592 const Version* new_version, | 1573 const Version& new_version, |
| 1593 const Product& product, | 1574 const Product& product, |
| 1594 WorkItemList* install_list) { | 1575 WorkItemList* install_list) { |
| 1595 const HKEY root_key = installer_state.root_key(); | 1576 const HKEY root_key = installer_state.root_key(); |
| 1596 string16 cmd_key(product.distribution()->GetVersionKey()); | 1577 string16 cmd_key(product.distribution()->GetVersionKey()); |
| 1597 cmd_key.append(1, FilePath::kSeparators[0]) | 1578 cmd_key.append(1, FilePath::kSeparators[0]) |
| 1598 .append(google_update::kRegCommandsKey) | 1579 .append(google_update::kRegCommandsKey) |
| 1599 .append(1, FilePath::kSeparators[0]) | 1580 .append(1, FilePath::kSeparators[0]) |
| 1600 .append(kCmdOnOsUpgrade); | 1581 .append(kCmdOnOsUpgrade); |
| 1601 | 1582 |
| 1602 // This will make Google Update call setup.exe with --on-os-upgrade switch. | 1583 if (installer_state.operation() == InstallerState::UNINSTALL) { |
| 1603 // For Chrome, this leads to HandleOsUpgradeForBrowser() being called. | 1584 install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key)-> |
| 1604 if (installer_state.operation() != InstallerState::UNINSTALL) { | 1585 set_log_message("Removing OS upgrade command"); |
| 1586 } else { | |
| 1587 // Register with Google Update to have setup.exe --on-os-upgrade called on | |
| 1588 // OS upgrade. | |
| 1605 CommandLine cmd_line(installer_state | 1589 CommandLine cmd_line(installer_state |
| 1606 .GetInstallerDirectory(*new_version) | 1590 .GetInstallerDirectory(new_version) |
| 1607 .Append(setup_path->BaseName())); | 1591 .Append(setup_path.BaseName())); |
| 1608 // Add the main option to indicate OS upgrade flow. | 1592 // Add the main option to indicate OS upgrade flow. |
| 1609 cmd_line.AppendSwitch(installer::switches::kOnOsUpgrade); | 1593 cmd_line.AppendSwitch(installer::switches::kOnOsUpgrade); |
| 1610 // Add product-specific options. | 1594 // Add product-specific options. |
| 1611 product.AppendProductFlags(&cmd_line); | 1595 product.AppendProductFlags(&cmd_line); |
| 1612 if (installer_state.system_install()) | 1596 if (installer_state.system_install()) |
| 1613 cmd_line.AppendSwitch(installer::switches::kSystemLevel); | 1597 cmd_line.AppendSwitch(installer::switches::kSystemLevel); |
| 1614 // Log everything for now. | 1598 // Log everything for now. |
| 1615 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); | 1599 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); |
| 1616 | 1600 |
| 1617 AppCommand cmd(cmd_line.GetCommandLineString()); | 1601 AppCommand cmd(cmd_line.GetCommandLineString()); |
| 1618 cmd.set_is_auto_run_on_os_upgrade(true); | 1602 cmd.set_is_auto_run_on_os_upgrade(true); |
| 1619 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); | 1603 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); |
| 1620 } else { | |
| 1621 install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key) | |
| 1622 ->set_log_message("Removing OS upgrade command"); | |
| 1623 } | 1604 } |
| 1624 } | 1605 } |
| 1625 | 1606 |
| 1626 } // namespace installer | 1607 } // namespace installer |
| OLD | NEW |