|
11 | 11 |
|
12 | 12 | namespace installer {
|
13 | 13 |
|
| 14 | +namespace { |
| 15 | + |
| 16 | +// This code is copied from `DoPostUninstallOperations` implementation in |
| 17 | +// `chrome/installer/setup/google_chrome_behaviors.cc` with the following |
| 18 | +// changes: |
| 19 | +// |
| 20 | +// - `distribution_data` not appended as Brave does not record histograms. |
| 21 | +// - `kBraveUninstallSurveyUrl` used instead of `kUninstallSurveyUrl` |
| 22 | + |
| 23 | +constexpr base::WStringPiece kBraveUninstallSurveyUrl( |
| 24 | + L"https://brave.com/uninstall-survey?p=brave_uninstall_survey"); |
| 25 | + |
| 26 | +} // namespace |
| 27 | + |
14 | 28 | void DoPostUninstallOperations(const base::Version& version,
|
15 | 29 | const base::FilePath& local_data_path,
|
16 | 30 | const std::wstring& distribution_data) {
|
17 |
| - // Brave browser doesn't launch uninstall survey page. |
| 31 | + // Send the Chrome version and OS version as params to the form. It would be |
| 32 | + // nice to send the locale, too, but I don't see an easy way to get that in |
| 33 | + // the existing code. It's something we can add later, if needed. We depend |
| 34 | + // on installed_version.GetString() not having spaces or other characters that |
| 35 | + // need escaping: 0.2.13.4. Should that change, we will need to escape the |
| 36 | + // string before using it in a URL. |
| 37 | + const base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); |
| 38 | + base::win::OSInfo::VersionNumber version_number = os_info->version_number(); |
| 39 | + std::wstring os_version = |
| 40 | + base::StringPrintf(L"%d.%d.%d", version_number.major, |
| 41 | + version_number.minor, version_number.build); |
| 42 | + |
| 43 | + const std::wstring survey_url = std::wstring(kBraveUninstallSurveyUrl); |
| 44 | +#if DCHECK_IS_ON() |
| 45 | + // The URL is expected to have a query part and not end with '&'. |
| 46 | + const size_t pos = survey_url.find(L'?'); |
| 47 | + DCHECK_NE(pos, std::wstring::npos); |
| 48 | + DCHECK_EQ(survey_url.find(L'?', pos + 1), std::wstring::npos); |
| 49 | + DCHECK_NE(survey_url.back(), L'&'); |
| 50 | +#endif |
| 51 | + auto url = base::StringPrintf(L"%ls&crversion=%ls&os=%ls", survey_url.c_str(), |
| 52 | + base::ASCIIToWide(version.GetString()).c_str(), |
| 53 | + os_version.c_str()); |
| 54 | + if (os_info->version() < base::win::Version::WIN10 || |
| 55 | + !NavigateToUrlWithEdge(url)) { |
| 56 | + NavigateToUrlWithIExplore(url); |
| 57 | + } |
18 | 58 | }
|
19 | 59 |
|
20 | 60 | } // namespace installer
|
0 commit comments