diff options
author | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 23:23:52 +0000 |
---|---|---|
committer | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 23:23:52 +0000 |
commit | 45ee09a2bbc5040e9023093defa95319a9cd3886 (patch) | |
tree | 65f9fa2ef7837a454ab8c7605ef1917903c3408c /chrome/installer/setup | |
parent | 6ab7dcee27cd6f87b5f65d8af38080692c468b8e (diff) | |
download | chromium_src-45ee09a2bbc5040e9023093defa95319a9cd3886.zip chromium_src-45ee09a2bbc5040e9023093defa95319a9cd3886.tar.gz chromium_src-45ee09a2bbc5040e9023093defa95319a9cd3886.tar.bz2 |
Introduce --install-dev-chrome switch for setup.exe to install (register+shortcuts) a local build of chrome.exe
Usage: setup.exe --install-dev-chrome=C:\full\path\to\chrome.exe
BUG=155217
Review URL: https://chromiumcodereview.appspot.com/11362092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r-- | chrome/installer/setup/install_worker.cc | 15 | ||||
-rw-r--r-- | chrome/installer/setup/install_worker.h | 4 | ||||
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 52 |
3 files changed, 61 insertions, 10 deletions
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index bf8ab95..f23736c 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -1099,7 +1099,7 @@ void AddInstallWorkItems(const InstallationState& original_state, AddVersionKeyWorkItems(root, product.distribution(), new_version, add_language_identifier, install_list); - AddDelegateExecuteWorkItems(installer_state, src_path, new_version, + AddDelegateExecuteWorkItems(installer_state, target_path, new_version, product, install_list); AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, @@ -1303,7 +1303,7 @@ void AddChromeFrameWorkItems(const InstallationState& original_state, } void AddDelegateExecuteWorkItems(const InstallerState& installer_state, - const FilePath& src_path, + const FilePath& target_path, const Version& new_version, const Product& product, WorkItemList* list) { @@ -1342,12 +1342,8 @@ void AddDelegateExecuteWorkItems(const InstallerState& installer_state, ); // Add work items to register the handler iff it is present. - // TODO(grt): Remove the extra check for the .exe when it is no longer - // possible to build Chrome without the DelegateExecute verb handler. // See also shell_util.cc's GetProgIdEntries. - if (installer_state.operation() != InstallerState::UNINSTALL && - file_util::PathExists(src_path.AppendASCII(new_version.GetString()) - .Append(kDelegateExecuteExe))) { + if (installer_state.operation() != InstallerState::UNINSTALL) { VLOG(1) << "Adding registration items for DelegateExecute verb handler."; // Force COM to flush its cache containing the path to the old handler. @@ -1355,8 +1351,9 @@ void AddDelegateExecuteWorkItems(const InstallerState& installer_state, handler_class_uuid)); // The path to the exe (in the version directory). - FilePath delegate_execute( - installer_state.target_path().AppendASCII(new_version.GetString())); + FilePath delegate_execute(target_path); + if (new_version.IsValid()) + delegate_execute = delegate_execute.AppendASCII(new_version.GetString()); delegate_execute = delegate_execute.Append(kDelegateExecuteExe); // Command-line featuring the quoted path to the exe. diff --git a/chrome/installer/setup/install_worker.h b/chrome/installer/setup/install_worker.h index 5cdba4d..3a64d1e 100644 --- a/chrome/installer/setup/install_worker.h +++ b/chrome/installer/setup/install_worker.h @@ -140,8 +140,10 @@ void AddChromeFrameWorkItems(const InstallationState& original_state, // Called for either installation or uninstallation. This method adds or // removes COM registration for a product's DelegateExecute verb handler. +// If |new_version| is empty, the registrations will point to +// delegate_execute.exe directly in |target_path|. void AddDelegateExecuteWorkItems(const InstallerState& installer_state, - const FilePath& src_path, + const FilePath& target_path, const Version& new_version, const Product& product, WorkItemList* list); diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index c3570e6..ef23d5e 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -1098,6 +1098,54 @@ void ActivateMetroChrome() { << "hr=" << std::hex << hr; } +installer::InstallStatus RegisterDevChrome( + const InstallerState& installer_state, + const CommandLine& cmd_line) { + FilePath chrome_exe( + cmd_line.GetSwitchValuePath(installer::switches::kRegisterDevChrome)); + if (chrome_exe.empty()) + chrome_exe = cmd_line.GetProgram().DirName().Append(installer::kChromeExe); + if (!chrome_exe.IsAbsolute()) + file_util::AbsolutePath(&chrome_exe); + + installer::InstallStatus status = installer::FIRST_INSTALL_SUCCESS; + if (file_util::PathExists(chrome_exe)) { + Product chrome(BrowserDistribution::GetSpecificDistribution( + BrowserDistribution::CHROME_BROWSER)); + + // Create the Start menu shortcut and pin it to the taskbar. + ShellUtil::ChromeShortcutProperties shortcut_properties( + ShellUtil::CURRENT_USER); + shortcut_properties.set_chrome_exe(chrome_exe); + shortcut_properties.set_dual_mode(true); + shortcut_properties.set_pin_to_taskbar(true); + ShellUtil::CreateOrUpdateChromeShortcut( + ShellUtil::SHORTCUT_START_MENU, chrome.distribution(), + shortcut_properties, ShellUtil::SHORTCUT_CREATE_ALWAYS); + + // Register Chrome at user-level and make it default. + scoped_ptr<WorkItemList> delegate_execute_list( + WorkItem::CreateWorkItemList()); + installer::AddDelegateExecuteWorkItems( + installer_state, chrome_exe.DirName(), Version(), chrome, + delegate_execute_list.get()); + delegate_execute_list->Do(); + if (ShellUtil::CanMakeChromeDefaultUnattended()) { + ShellUtil::MakeChromeDefault( + chrome.distribution(), ShellUtil::CURRENT_USER, chrome_exe.value(), + true); + } else { + ShellUtil::ShowMakeChromeDefaultSystemUI(chrome.distribution(), + chrome_exe.value()); + } + } else { + LOG(ERROR) << "Path not found (make sure it is absolute): " + << chrome_exe.value(); + status = installer::INSTALL_FAILED; + } + return status; +} + // This method processes any command line options that make setup.exe do // various tasks other than installation (renaming chrome.exe, showing eula // among others). This function returns true if any such command line option @@ -1189,6 +1237,10 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, << ", system_install:" << installer_state->system_install(); } *exit_code = InstallUtil::GetInstallReturnCode(status); + } else if (cmd_line.HasSwitch(installer::switches::kRegisterDevChrome)) { + installer::InstallStatus status = RegisterDevChrome( + *installer_state, cmd_line); + *exit_code = InstallUtil::GetInstallReturnCode(status); } else if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser)) { installer::InstallStatus status = installer::UNKNOWN_STATUS; const Product* chrome_install = |