Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable the post uninstall survey on Windows (uplift to 1.32.x) #11370

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion chromium_src/chrome/installer/setup/brave_behaviors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,50 @@

namespace installer {

namespace {

// This code is copied from `DoPostUninstallOperations` implementation in
// `chrome/installer/setup/google_chrome_behaviors.cc` with the following
// changes:
//
// - `distribution_data` not appended as Brave does not record histograms.
// - `kBraveUninstallSurveyUrl` used instead of `kUninstallSurveyUrl`

constexpr base::WStringPiece kBraveUninstallSurveyUrl(
L"https://brave.com/uninstall-survey/?p=brave_uninstall_survey");

} // namespace

void DoPostUninstallOperations(const base::Version& version,
const base::FilePath& local_data_path,
const std::wstring& distribution_data) {
// Brave browser doesn't launch uninstall survey page.
// Send the Chrome version and OS version as params to the form. It would be
// nice to send the locale, too, but I don't see an easy way to get that in
// the existing code. It's something we can add later, if needed. We depend
// on installed_version.GetString() not having spaces or other characters that
// need escaping: 0.2.13.4. Should that change, we will need to escape the
// string before using it in a URL.
const base::win::OSInfo* os_info = base::win::OSInfo::GetInstance();
base::win::OSInfo::VersionNumber version_number = os_info->version_number();
std::wstring os_version =
base::StringPrintf(L"%d.%d.%d", version_number.major,
version_number.minor, version_number.build);

const std::wstring survey_url = std::wstring(kBraveUninstallSurveyUrl);
#if DCHECK_IS_ON()
// The URL is expected to have a query part and not end with '&'.
const size_t pos = survey_url.find(L'?');
DCHECK_NE(pos, std::wstring::npos);
DCHECK_EQ(survey_url.find(L'?', pos + 1), std::wstring::npos);
DCHECK_NE(survey_url.back(), L'&');
#endif
auto url = base::StringPrintf(L"%ls&crversion=%ls&os=%ls", survey_url.c_str(),
base::ASCIIToWide(version.GetString()).c_str(),
os_version.c_str());
if (os_info->version() < base::win::Version::WIN10 ||
!NavigateToUrlWithEdge(url)) {
NavigateToUrlWithIExplore(url);
}
}

} // namespace installer