diff options
-rw-r--r-- | chrome/browser/browser_init.cc | 11 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 4 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 7 | ||||
-rw-r--r-- | chrome/installer/setup/uninstall.cc | 46 | ||||
-rw-r--r-- | chrome/installer/setup/uninstall.h | 5 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.cc | 35 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.h | 11 |
8 files changed, 44 insertions, 76 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index e7e1ae5..1f0f5b1 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -827,17 +827,6 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line, profile, expected_tabs); } - if (command_line.HasSwitch(switches::kInstallExtension)) { - std::wstring path_string = - command_line.GetSwitchValue(switches::kInstallExtension); - FilePath path = FilePath::FromWStringHack(path_string); - profile->GetExtensionsService()->InstallExtension(path); - - // If the chrome process was already running, install the extension without - // popping up another browser window. - silent_launch = !process_startup; - } - if (command_line.HasSwitch(switches::kExplicitlyAllowedPorts)) { std::wstring allowed_ports = command_line.GetSwitchValue(switches::kExplicitlyAllowedPorts); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 978c7c6..e320f82 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -394,10 +394,6 @@ const wchar_t kDisableExtensions[] = L"disable-extensions"; // Frequency in seconds for Extensions auto-update. const wchar_t kExtensionsUpdateFrequency[] = L"extensions-update-frequency"; -// Install the extension specified in the argument. This is for MIME type -// handling so that users can double-click on an extension. -const wchar_t kInstallExtension[] = L"install-extension"; - // Load an extension from the specified directory. const wchar_t kLoadExtension[] = L"load-extension"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 733d706..1d25d7c 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -146,7 +146,6 @@ extern const wchar_t kSdchFilter[]; extern const wchar_t kEnableUserScripts[]; extern const wchar_t kDisableExtensions[]; extern const wchar_t kExtensionsUpdateFrequency[]; -extern const wchar_t kInstallExtension[]; extern const wchar_t kLoadExtension[]; extern const wchar_t kPackExtension[]; extern const wchar_t kPackExtensionKey[]; diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 14dbf5e..8b70a1b 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -281,9 +281,11 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, if (install_status == installer_util::FIRST_INSTALL_SUCCESS) { LOG(INFO) << "First install successful."; // We never want to launch Chrome in system level install mode. - if (!system_level && !installer_util::GetDistroBooleanPreference(prefs, - installer_util::master_preferences::kDoNotLaunchChrome)) + if (!system_level && !installer_util::GetDistroBooleanPreference( + prefs, installer_util::master_preferences::kDoNotLaunchChrome)) installer::LaunchChrome(system_level); + } else if (install_status == installer_util::NEW_VERSION_UPDATED) { + installer_setup::RemoveLegacyRegistryKeys(); } } } @@ -328,6 +330,7 @@ installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line, bool remove_all = !cmd_line.HasSwitch( installer_util::switches::kDoNotRemoveSharedItems); + return installer_setup::UninstallChrome(cmd_line.program(), system_install, remove_all, force, cmd_line, cmd_params); diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 206cf72..978c056 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -279,18 +279,6 @@ bool installer_setup::DeleteChromeRegistrationKeys(HKEY root, html_prog_id.append(browser_entry_suffix); DeleteRegistryKey(key, html_prog_id); - // Delete Software\Classes\ChromeExt, - std::wstring ext_prog_id(ShellUtil::kRegClasses); - file_util::AppendToPath(&ext_prog_id, ShellUtil::kChromeExtProgId); - ext_prog_id.append(browser_entry_suffix); - DeleteRegistryKey(key, ext_prog_id); - - // Delete Software\Classes\.crx, - std::wstring ext_association(ShellUtil::kRegClasses); - ext_association.append(L"\\."); - ext_association.append(chrome::kExtensionFileExtension); - DeleteRegistryKey(key, ext_association); - // Delete Software\Clients\StartMenuInternet\Chromium BrowserDistribution* dist = BrowserDistribution::GetDistribution(); std::wstring set_access_key(ShellUtil::kRegStartMenuInternet); @@ -334,6 +322,40 @@ bool installer_setup::DeleteChromeRegistrationKeys(HKEY root, return true; } +void installer_setup::RemoveLegacyRegistryKeys() { + // We used to register Chrome to handle crx files, but this turned out + // to be not worth the hassle. Remove these old registry entries if + // they exist. See: http://codereview.chromium.org/210007 + +#if defined(GOOGLE_CHROME_BUILD) +const wchar_t kChromeExtProgId[] = L"ChromeExt"; +#else +const wchar_t kChromeExtProgId[] = L"ChromiumExt"; +#endif + + HKEY roots[] = {HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER}; + for (size_t i = 0; i < arraysize(roots); ++i) { + RegKey key(roots[i], L"", KEY_ALL_ACCESS); + + std::wstring suffix; + if (roots[i] == HKEY_LOCAL_MACHINE && + !ShellUtil::GetUserSpecificDefaultBrowserSuffix(&suffix)) + suffix = L""; + + // Delete Software\Classes\ChromeExt, + std::wstring ext_prog_id(ShellUtil::kRegClasses); + file_util::AppendToPath(&ext_prog_id, kChromeExtProgId); + ext_prog_id.append(suffix); + DeleteRegistryKey(key, ext_prog_id); + + // Delete Software\Classes\.crx, + std::wstring ext_association(ShellUtil::kRegClasses); + ext_association.append(L"\\."); + ext_association.append(chrome::kExtensionFileExtension); + DeleteRegistryKey(key, ext_association); + } +} + installer_util::InstallStatus installer_setup::UninstallChrome( const std::wstring& exe_path, bool system_uninstall, bool remove_all, bool force_uninstall, diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h index 1047f90..a2320ad 100644 --- a/chrome/installer/setup/uninstall.h +++ b/chrome/installer/setup/uninstall.h @@ -24,6 +24,11 @@ bool DeleteChromeRegistrationKeys(HKEY root, const std::wstring& browser_entry_suffix, installer_util::InstallStatus& exit_code); +// Removes any legacy registry keys from earlier versions of Chrome that are no +// longer needed. This is used during autoupdate since we don't do full +// uninstalls/reinstalls to update. +void RemoveLegacyRegistryKeys(); + // This function uninstalls Chrome. // // exe_path: Path to the executable (setup.exe) as it will be copied diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index f21aeab..c4705a8 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -59,19 +59,6 @@ class RegistryEntry { entries->push_front(new RegistryEntry( chrome_html_prog_id + ShellUtil::kRegShellOpen, open_cmd)); - // Chrome Extension ProgId - std::wstring ext_prog_id(ShellUtil::kRegClasses); - file_util::AppendToPath(&ext_prog_id, ShellUtil::kChromeExtProgId); - ext_prog_id.append(suffix); - entries->push_front(new RegistryEntry( - ext_prog_id, ShellUtil::kChromeExtProgIdDesc)); - entries->push_front(new RegistryEntry( - ext_prog_id + ShellUtil::kRegDefaultIcon, icon_path)); - std::wstring install_cmd = - ShellUtil::GetChromeInstallExtensionCmd(chrome_exe); - entries->push_front(new RegistryEntry( - ext_prog_id + ShellUtil::kRegShellOpen, install_cmd)); - return true; } @@ -127,11 +114,6 @@ class RegistryEntry { capabilities + L"\\URLAssociations", ShellUtil::kProtocolAssociations[i], html_prog_id)); } - std::wstring ext_prog_id(ShellUtil::kChromeExtProgId); - ext_prog_id.append(suffix); - entries->push_front(new RegistryEntry( - capabilities + L"\\FileAssociations", - chrome::kExtensionFileExtension, ext_prog_id)); FilePath chrome_path(chrome_exe); std::wstring app_path_key(ShellUtil::kAppPathsRegistryKey); @@ -158,14 +140,6 @@ class RegistryEntry { entries->push_front(new RegistryEntry(ext_key, html_prog_id)); } - // .crx file type extension. - std::wstring ext_key(ShellUtil::kRegClasses); - ext_key.append(L"."); - ext_key.append(chrome::kExtensionFileExtension); - std::wstring ext_prog_id(ShellUtil::kChromeExtProgId); - ext_prog_id.append(suffix); - entries->push_front(new RegistryEntry(ext_key, ext_prog_id)); - // Protocols associations. std::wstring chrome_open = ShellUtil::GetChromeShellOpenCmd(chrome_exe); std::wstring chrome_icon = ShellUtil::GetChromeIcon(chrome_exe); @@ -420,11 +394,9 @@ const wchar_t* ShellUtil::kAppPathsRegistryKey = const wchar_t* ShellUtil::kAppPathsRegistryPathName = L"Path"; #if defined(GOOGLE_CHROME_BUILD) -const wchar_t* ShellUtil::kChromeExtProgId = L"ChromeExt"; const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromeHTML"; const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chrome HTML Document"; #else -const wchar_t* ShellUtil::kChromeExtProgId = L"ChromiumExt"; const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromiumHTML"; const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chromium HTML Document"; #endif @@ -435,8 +407,6 @@ const wchar_t* ShellUtil::kProtocolAssociations[] = {L"ftp", L"http", L"https", NULL}; const wchar_t* ShellUtil::kRegUrlProtocol = L"URL Protocol"; -const wchar_t* ShellUtil::kChromeExtProgIdDesc = L"Chrome Extension Installer"; - bool ShellUtil::AdminNeededForRegistryCleanup(const std::wstring& suffix) { bool cleanup_needed = false; std::list<RegistryEntry*> entries; @@ -526,11 +496,6 @@ std::wstring ShellUtil::GetChromeIcon(const std::wstring& chrome_exe) { return chrome_icon; } -std::wstring ShellUtil::GetChromeInstallExtensionCmd( - const std::wstring& chrome_exe) { - return L"\"" + chrome_exe + L"\" --install-extension=\"%1\""; -} - std::wstring ShellUtil::GetChromeShellOpenCmd(const std::wstring& chrome_exe) { return L"\"" + chrome_exe + L"\" -- \"%1\""; } diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index 99f88b8..9514c1f 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h @@ -71,12 +71,6 @@ class ShellUtil { // Registry value name that is needed for ChromeHTML ProgId static const wchar_t* kRegUrlProtocol; - // Name that we give to Chrome extension file association handler ProgId. - static const wchar_t* kChromeExtProgId; - - // Description of Chrome file/URL association handler ProgId. - static const wchar_t* kChromeExtProgIdDesc; - // Checks if we need Admin rights for registry cleanup by checking if any // entry exists in HKLM. static bool AdminNeededForRegistryCleanup(const std::wstring& suffix); @@ -118,11 +112,6 @@ class ShellUtil { // chrome_exe: the full path to chrome.exe static std::wstring GetChromeShellOpenCmd(const std::wstring& chrome_exe); - // This method returns the command to open .crx files using chrome in order - // to install them as extensions. Similar to above method. - static std::wstring GetChromeInstallExtensionCmd( - const std::wstring& chrome_exe); - // Returns the localized name of Chrome shortcut. If |alternate| is true // it returns a second localized text that is better suited for certain // scenarios. |