diff options
author | zturner@chromium.org <zturner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-23 18:52:54 +0000 |
---|---|---|
committer | zturner@chromium.org <zturner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-23 18:52:54 +0000 |
commit | ee5396f60cbf0ff33cf5ca41e755d0ef5660946c (patch) | |
tree | 7adac4c98db9799dc1300636edb7fec2e1b36927 /chrome/installer | |
parent | ad22af288a188fda9ae3da630c001e628b941857 (diff) | |
download | chromium_src-ee5396f60cbf0ff33cf5ca41e755d0ef5660946c.zip chromium_src-ee5396f60cbf0ff33cf5ca41e755d0ef5660946c.tar.gz chromium_src-ee5396f60cbf0ff33cf5ca41e755d0ef5660946c.tar.bz2 |
Automatically register canary GUIDs on install, but don't expose in-browser UI for registration.
This completes the work necessary to enable SxS distributions to be set as the default browser.
BUG=273248
TEST=
1) Uninstall all Chrome products (Canary, Stable, Chromium)
2) Install an official build of Chrome and set it as default browser.
3) Run setup.exe --chrome-sxs to install SxS.
4) Confirm that on startup, no set default infobar prompt is shown.
5) In chrome://settings, confirm that the text "This is a secondary installation..." is seen
6) In Windows "Choose default browser" utility, confirm that "Google Chrome Canary" is displayed and choose it.
7) Restart canary, and confirm that in chrome://settings it says "The default browser is currently Google Chrome."
8) Pin "Google Chrome Canary" tile to Start Screen, and confirm that launching Canary from Start Tile launches in Metro.
9) Run setup.exe --chrome-sxs --uninstall and confirm that the "Change default browser" combo box is displayed.
10) Choose option to change default browser to Firefox and Uninstall.
11) Using regedit, confirm that GUIDS for canary are gone.
12) Refresh settings in Windows Default browser utility, and confirm that Firefox is displayed.
13) In Windows Default Browser utility, set Google Chrome (this is the original, Stable channel installation) as default browser.
14) Run Chrome Stable and confirm in settings that it says "The default browser is currently Google Chrome"
pkasting: chrome/browser/ui/*
grt, gab: chrome/installer/*, chrome/browser/shell_integration_win.cc
jhawkins (optional): chrome/browser/ui/webui/*
Review URL: https://codereview.chromium.org/34053002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230483 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/setup/uninstall.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.cc | 5 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.h | 11 | ||||
-rw-r--r-- | chrome/installer/util/chrome_app_host_distribution.cc | 5 | ||||
-rw-r--r-- | chrome/installer/util/chrome_app_host_distribution.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/chrome_frame_distribution.cc | 5 | ||||
-rw-r--r-- | chrome/installer/util/chrome_frame_distribution.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/chromium_binaries_distribution.cc | 5 | ||||
-rw-r--r-- | chrome/installer/util/chromium_binaries_distribution.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_sxs_distribution.cc | 5 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_sxs_distribution.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/helper.cc | 7 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.cc | 36 |
13 files changed, 63 insertions, 27 deletions
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 473c3bb..460c4905 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -800,7 +800,8 @@ bool DeleteChromeRegistrationKeys(const InstallerState& installer_state, const string16& browser_entry_suffix, InstallStatus* exit_code) { DCHECK(exit_code); - if (!dist->CanSetAsDefault()) { + if (dist->GetDefaultBrowserControlPolicy() == + BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED) { // We should have never set those keys. return true; } diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index b311d59..2456cbd 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -265,8 +265,9 @@ string16 BrowserDistribution::GetVersionKey() { return L"Software\\Chromium"; } -bool BrowserDistribution::CanSetAsDefault() { - return true; +BrowserDistribution::DefaultBrowserControlPolicy + BrowserDistribution::GetDefaultBrowserControlPolicy() { + return DEFAULT_BROWSER_FULL_CONTROL; } bool BrowserDistribution::CanCreateDesktopShortcuts() { diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index 1d11a87..a1ac824 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -40,6 +40,12 @@ class BrowserDistribution { // TODO(calamity): add SUBFOLDER_APPS when refactoring chrome app dir code. }; + enum DefaultBrowserControlPolicy { + DEFAULT_BROWSER_UNSUPPORTED, + DEFAULT_BROWSER_OS_CONTROL_ONLY, + DEFAULT_BROWSER_FULL_CONTROL + }; + virtual ~BrowserDistribution() {} static BrowserDistribution* GetDistribution(); @@ -129,8 +135,9 @@ class BrowserDistribution { virtual string16 GetVersionKey(); - // Returns true if this distribution can be set as the default browser. - virtual bool CanSetAsDefault(); + // Returns an enum specifying the different ways in which this distribution + // is allowed to be set as default. + virtual DefaultBrowserControlPolicy GetDefaultBrowserControlPolicy(); virtual bool CanCreateDesktopShortcuts(); diff --git a/chrome/installer/util/chrome_app_host_distribution.cc b/chrome/installer/util/chrome_app_host_distribution.cc index be0fdf5..9ecf2ab 100644 --- a/chrome/installer/util/chrome_app_host_distribution.cc +++ b/chrome/installer/util/chrome_app_host_distribution.cc @@ -130,8 +130,9 @@ string16 ChromeAppHostDistribution::GetVersionKey() { return key; } -bool ChromeAppHostDistribution::CanSetAsDefault() { - return false; +BrowserDistribution::DefaultBrowserControlPolicy + ChromeAppHostDistribution::GetDefaultBrowserControlPolicy() { + return DEFAULT_BROWSER_UNSUPPORTED; } bool ChromeAppHostDistribution::CanCreateDesktopShortcuts() { diff --git a/chrome/installer/util/chrome_app_host_distribution.h b/chrome/installer/util/chrome_app_host_distribution.h index c0d2abb..567ede7 100644 --- a/chrome/installer/util/chrome_app_host_distribution.h +++ b/chrome/installer/util/chrome_app_host_distribution.h @@ -54,7 +54,7 @@ class ChromeAppHostDistribution : public BrowserDistribution { virtual string16 GetVersionKey() OVERRIDE; - virtual bool CanSetAsDefault() OVERRIDE; + virtual DefaultBrowserControlPolicy GetDefaultBrowserControlPolicy() OVERRIDE; virtual bool CanCreateDesktopShortcuts() OVERRIDE; diff --git a/chrome/installer/util/chrome_frame_distribution.cc b/chrome/installer/util/chrome_frame_distribution.cc index 0b12cc1..58f475b 100644 --- a/chrome/installer/util/chrome_frame_distribution.cc +++ b/chrome/installer/util/chrome_frame_distribution.cc @@ -131,8 +131,9 @@ int ChromeFrameDistribution::GetIconIndex(ShortcutType shortcut_type) { } } -bool ChromeFrameDistribution::CanSetAsDefault() { - return false; +BrowserDistribution::DefaultBrowserControlPolicy + ChromeFrameDistribution::GetDefaultBrowserControlPolicy() { + return DEFAULT_BROWSER_UNSUPPORTED; } bool ChromeFrameDistribution::CanCreateDesktopShortcuts() { diff --git a/chrome/installer/util/chrome_frame_distribution.h b/chrome/installer/util/chrome_frame_distribution.h index 45db56a..0a69bd1 100644 --- a/chrome/installer/util/chrome_frame_distribution.h +++ b/chrome/installer/util/chrome_frame_distribution.h @@ -51,7 +51,7 @@ class ChromeFrameDistribution : public BrowserDistribution { virtual string16 GetIconFilename() OVERRIDE; - virtual bool CanSetAsDefault() OVERRIDE; + virtual DefaultBrowserControlPolicy GetDefaultBrowserControlPolicy() OVERRIDE; virtual bool CanCreateDesktopShortcuts() OVERRIDE; diff --git a/chrome/installer/util/chromium_binaries_distribution.cc b/chrome/installer/util/chromium_binaries_distribution.cc index 62c645b..7e8bdcf 100644 --- a/chrome/installer/util/chromium_binaries_distribution.cc +++ b/chrome/installer/util/chromium_binaries_distribution.cc @@ -100,8 +100,9 @@ string16 ChromiumBinariesDistribution::GetVersionKey() { return string16(L"Software\\").append(kChromiumBinariesName); } -bool ChromiumBinariesDistribution::CanSetAsDefault() { - return false; +BrowserDistribution::DefaultBrowserControlPolicy + ChromiumBinariesDistribution::GetDefaultBrowserControlPolicy() { + return DEFAULT_BROWSER_UNSUPPORTED; } int ChromiumBinariesDistribution::GetIconIndex(ShortcutType shortcut_type) { diff --git a/chrome/installer/util/chromium_binaries_distribution.h b/chrome/installer/util/chromium_binaries_distribution.h index 68de283..6c00669 100644 --- a/chrome/installer/util/chromium_binaries_distribution.h +++ b/chrome/installer/util/chromium_binaries_distribution.h @@ -49,7 +49,7 @@ class ChromiumBinariesDistribution : public BrowserDistribution { virtual string16 GetVersionKey() OVERRIDE; - virtual bool CanSetAsDefault() OVERRIDE; + virtual DefaultBrowserControlPolicy GetDefaultBrowserControlPolicy() OVERRIDE; virtual bool GetChromeChannel(string16* channel) OVERRIDE; diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc index 1925f30..f86e8ff 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.cc +++ b/chrome/installer/util/google_chrome_sxs_distribution.cc @@ -75,8 +75,9 @@ string16 GoogleChromeSxSDistribution::GetUninstallRegPath() { installer::kSxSSuffix); } -bool GoogleChromeSxSDistribution::CanSetAsDefault() { - return false; +BrowserDistribution::DefaultBrowserControlPolicy + GoogleChromeSxSDistribution::GetDefaultBrowserControlPolicy() { + return DEFAULT_BROWSER_OS_CONTROL_ONLY; } int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) { diff --git a/chrome/installer/util/google_chrome_sxs_distribution.h b/chrome/installer/util/google_chrome_sxs_distribution.h index d089196..e069c68 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.h +++ b/chrome/installer/util/google_chrome_sxs_distribution.h @@ -27,7 +27,7 @@ class GoogleChromeSxSDistribution : public GoogleChromeDistribution { virtual string16 GetBrowserProgIdDesc() OVERRIDE; virtual string16 GetInstallSubDir() OVERRIDE; virtual string16 GetUninstallRegPath() OVERRIDE; - virtual bool CanSetAsDefault() OVERRIDE; + virtual DefaultBrowserControlPolicy GetDefaultBrowserControlPolicy() OVERRIDE; virtual bool GetChromeChannel(string16* channel) OVERRIDE; virtual bool GetCommandExecuteImplClsid( string16* handler_class_uuid) OVERRIDE; diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc index bb0f22e..10a2156 100644 --- a/chrome/installer/util/helper.cc +++ b/chrome/installer/util/helper.cc @@ -45,8 +45,11 @@ base::FilePath GetChromeInstallPath(bool system_install, void GetChromeUserDataPaths(BrowserDistribution* dist, std::vector<base::FilePath>* paths) { - const bool has_metro_data = dist->CanSetAsDefault() && - base::win::GetVersion() >= base::win::VERSION_WIN8; + const bool has_metro_data = + base::win::GetVersion() >= base::win::VERSION_WIN8 && + dist->GetDefaultBrowserControlPolicy() != + BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED; + base::FilePath data_dir(GetChromeInstallBasePath(false, dist, kInstallUserDataDir)); if (data_dir.empty()) { diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 19a5feb..f5b8544 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -1695,8 +1695,11 @@ string16 ShellUtil::BuildAppModelId( } ShellUtil::DefaultState ShellUtil::GetChromeDefaultState() { - if (!BrowserDistribution::GetDistribution()->CanSetAsDefault()) + BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); + if (distribution->GetDefaultBrowserControlPolicy() == + BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED) { return NOT_DEFAULT; + } // When we check for default browser we don't necessarily want to count file // type handlers and icons as having changed the default browser status, // since the user may have changed their shell settings to cause HTML files @@ -1712,8 +1715,12 @@ ShellUtil::DefaultState ShellUtil::GetChromeDefaultState() { ShellUtil::DefaultState ShellUtil::GetChromeDefaultProtocolClientState( const string16& protocol) { - if (!BrowserDistribution::GetDistribution()->CanSetAsDefault()) + BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); + if (distribution->GetDefaultBrowserControlPolicy() == + BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED) { return NOT_DEFAULT; + } + if (protocol.empty()) return UNKNOWN_DEFAULT; @@ -1732,8 +1739,11 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist, bool elevate_if_not_admin) { DCHECK(!(shell_change & ShellUtil::SYSTEM_LEVEL) || IsUserAnAdmin()); - if (!dist->CanSetAsDefault()) + BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); + if (distribution->GetDefaultBrowserControlPolicy() != + BrowserDistribution::DEFAULT_BROWSER_FULL_CONTROL) { return false; + } // Windows 8 does not permit making a browser default just like that. // This process needs to be routed through the system's UI. Use @@ -1796,8 +1806,10 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist, bool ShellUtil::ShowMakeChromeDefaultSystemUI(BrowserDistribution* dist, const string16& chrome_exe) { DCHECK_GE(base::win::GetVersion(), base::win::VERSION_WIN8); - if (!dist->CanSetAsDefault()) + if (dist->GetDefaultBrowserControlPolicy() != + BrowserDistribution::DEFAULT_BROWSER_FULL_CONTROL) { return false; + } if (!RegisterChromeBrowser(dist, chrome_exe, string16(), true)) return false; @@ -1822,8 +1834,10 @@ bool ShellUtil::ShowMakeChromeDefaultSystemUI(BrowserDistribution* dist, bool ShellUtil::MakeChromeDefaultProtocolClient(BrowserDistribution* dist, const string16& chrome_exe, const string16& protocol) { - if (!dist->CanSetAsDefault()) + if (dist->GetDefaultBrowserControlPolicy() != + BrowserDistribution::DEFAULT_BROWSER_FULL_CONTROL) { return false; + } if (!RegisterChromeForProtocol(dist, chrome_exe, string16(), protocol, true)) return false; @@ -1869,8 +1883,10 @@ bool ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI( const string16& chrome_exe, const string16& protocol) { DCHECK_GE(base::win::GetVersion(), base::win::VERSION_WIN8); - if (!dist->CanSetAsDefault()) + if (dist->GetDefaultBrowserControlPolicy() != + BrowserDistribution::DEFAULT_BROWSER_FULL_CONTROL) { return false; + } if (!RegisterChromeForProtocol(dist, chrome_exe, string16(), protocol, true)) return false; @@ -1898,8 +1914,10 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, const string16& chrome_exe, const string16& unique_suffix, bool elevate_if_not_admin) { - if (!dist->CanSetAsDefault()) + if (dist->GetDefaultBrowserControlPolicy() == + BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED) { return false; + } CommandLine& command_line = *CommandLine::ForCurrentProcess(); @@ -1988,8 +2006,10 @@ bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist, const string16& unique_suffix, const string16& protocol, bool elevate_if_not_admin) { - if (!dist->CanSetAsDefault()) + if (dist->GetDefaultBrowserControlPolicy() == + BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED) { return false; + } string16 suffix; if (!unique_suffix.empty()) { |