OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #if defined(GOOGLE_CHROME_BUILD) |
| 6 |
| 7 #include "base/strings/string_util.h" |
| 8 #include "chrome/installer/util/app_launcher_installer_util.h" |
| 9 |
| 10 namespace installer { |
| 11 namespace app_launcher_installer { |
| 12 |
| 13 namespace { |
| 14 |
| 15 const wchar_t kModSeparator[] = L"-"; |
| 16 const wchar_t kModAppHostWithSeparator[] = L"-apphost-"; |
| 17 const wchar_t kModAppLauncherWithSeparator[] = L"-applauncher-"; |
| 18 |
| 19 } // namespace |
| 20 |
| 21 // To remove "-test" from "-abc-test-efg", we: |
| 22 // (1) add sentinel "-" to the end to form "-abc-test-efg-", |
| 23 // (2) search for "-test" + "-" = "-test-", |
| 24 // (3) if found, replace substring with "-" to get "-abc-efg-", |
| 25 // (4) remove trialing "-" to get "-abc-efg". |
| 26 void RemoveDeprecatedModifiers(base::string16* value) { |
| 27 value->push_back(kModSeparator[0]); // Add sentinel. |
| 28 ReplaceFirstSubstringAfterOffset( |
| 29 value, 0, kModAppHostWithSeparator, kModSeparator); |
| 30 ReplaceFirstSubstringAfterOffset( |
| 31 value, 0, kModAppLauncherWithSeparator, kModSeparator); |
| 32 value->pop_back(); // Remove sentinel. |
| 33 } |
| 34 |
| 35 } // namespace app_launcher_installer |
| 36 } // namespace installer |
| 37 |
| 38 #endif // defined(GOOGLE_CHROME_BUILD) |
OLD | NEW |