Commit ed716f08 authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Fix Import policies from IE on Windows 10 chrome first run

ImportAutofillFormData, ImportBookmarks, ImportHistory, ImportHomepage,
ImportSavedPasswords, ImportSearchEngine did not work on first run
if the default browser was IE on Windows 10.

Bug: 1003284
Change-Id: If4962497f36c401194ce1acf5e27b30cfa80a0e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825327
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701145}
parent 28f2eb3c
......@@ -47,6 +47,8 @@ void DetectIEProfiles(std::vector<importer::SourceProfile>* profiles) {
}
void DetectEdgeProfiles(std::vector<importer::SourceProfile>* profiles) {
if (!importer::EdgeImporterCanImport())
return;
importer::SourceProfile edge;
edge.importer_name = l10n_util::GetStringUTF16(IDS_IMPORT_FROM_EDGE);
edge.importer_type = importer::TYPE_EDGE;
......@@ -57,10 +59,13 @@ void DetectEdgeProfiles(std::vector<importer::SourceProfile>* profiles) {
void DetectBuiltinWindowsProfiles(
std::vector<importer::SourceProfile>* profiles) {
// Make the assumption on Windows 10 that Edge exists and is probably default.
if (importer::EdgeImporterCanImport())
if (shell_integration::IsIEDefaultBrowser()) {
DetectIEProfiles(profiles);
DetectEdgeProfiles(profiles);
} else {
DetectEdgeProfiles(profiles);
DetectIEProfiles(profiles);
DetectIEProfiles(profiles);
}
}
#endif // defined(OS_WIN)
......
......@@ -92,6 +92,12 @@ DefaultWebClientState GetDefaultBrowser();
// user. This method is very fast so it can be invoked in the UI thread.
bool IsFirefoxDefaultBrowser();
#if defined(OS_WIN)
// Returns true if IE is likely to be the default browser for the current
// user. This method is very fast so it can be invoked in the UI thread.
bool IsIEDefaultBrowser();
#endif
// Attempt to determine if this instance of Chrome is the default client
// application for the given protocol and return the appropriate state.
DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol);
......
......@@ -598,6 +598,14 @@ bool IsFirefoxDefaultBrowser() {
app_cmd == L"FirefoxURL";
}
bool IsIEDefaultBrowser() {
base::string16 app_cmd;
base::win::RegKey key(HKEY_CURRENT_USER, ShellUtil::kRegVistaUrlPrefs,
KEY_READ);
return key.Valid() && key.ReadValue(L"Progid", &app_cmd) == ERROR_SUCCESS &&
app_cmd == L"IE.HTTP";
}
DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol) {
return GetDefaultWebClientStateFromShellUtilDefaultState(
ShellUtil::GetChromeDefaultProtocolClientState(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment