Chromium Code Reviews| Index: chrome/installer/util/delete_after_reboot_helper.cc |
| diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc |
| index 513cd3c3aa8ada78111db4b467e5fc29cb013a15..b6bdaf9641cc0ea21ac7920c33e2bd83db4309de 100644 |
| --- a/chrome/installer/util/delete_after_reboot_helper.cc |
| +++ b/chrome/installer/util/delete_after_reboot_helper.cc |
| @@ -326,20 +326,25 @@ HRESULT GetPendingMovesValue(std::vector<PendingMove>* pending_moves) { |
| bool MatchPendingDeletePath(const base::FilePath& short_form_needle, |
| const base::FilePath& reg_path) { |
| // Stores the path stored in each entry. |
| - std::wstring match_path(reg_path.value()); |
| + base::string16 match_path(reg_path.value()); |
| // First chomp the prefix since that will mess up GetShortPathName. |
| - std::wstring prefix(L"\\??\\"); |
| - if (base::StartsWith(match_path, prefix, false)) |
| + base::string16 prefix(L"\\??\\"); |
|
grt (UTC plus 2)
2015/07/01 17:55:42
nit: base::StringPiece16 prefix(L"\\??\\"); to avo
|
| + if (base::StartsWith(match_path, prefix, base::CompareCase::SENSITIVE)) |
| match_path = match_path.substr(4); |
|
grt (UTC plus 2)
2015/07/01 17:55:41
nit: 4 -> prefix.size()
|
| // Get the short path name of the entry. |
| base::FilePath short_match_path(GetShortPathName(base::FilePath(match_path))); |
| - // Now compare the paths. If it isn't one we're looking for, add it |
| - // to the list to keep. |
| - return base::StartsWith(short_match_path.value(), short_form_needle.value(), |
| - false); |
| + // Now compare the paths. It's a match if short_form_needle is a |
| + // case-insensitive prefix of short_match_path. |
| + if (short_match_path.value().size() < short_form_needle.value().size()) |
| + return false; |
| + DWORD prefix_len = static_cast<DWORD>(short_form_needle.value().size()); |
|
grt (UTC plus 2)
2015/07/01 17:55:42
base::saturated_cast<DWORD, size_t>()?
|
| + return ::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, |
| + short_match_path.value().data(), prefix_len, |
| + short_form_needle.value().data(), prefix_len) == |
| + CSTR_EQUAL; |
| } |
| // Removes all pending moves for the given |directory| and any contained |