Index: chrome/installer/util/app_launcher_installer_util.cc |
diff --git a/chrome/installer/util/app_launcher_installer_util.cc b/chrome/installer/util/app_launcher_installer_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c676f027cad315b3779c39053223c9ecca186ae1 |
--- /dev/null |
+++ b/chrome/installer/util/app_launcher_installer_util.cc |
@@ -0,0 +1,38 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#if defined(GOOGLE_CHROME_BUILD) |
+ |
+#include "base/strings/string_util.h" |
+#include "chrome/installer/util/app_launcher_installer_util.h" |
+ |
+namespace installer { |
+namespace app_launcher_installer { |
+ |
+namespace { |
+ |
+const wchar_t kModSeparator[] = L"-"; |
+const wchar_t kModAppHostWithSeparator[] = L"-apphost-"; |
+const wchar_t kModAppLauncherWithSeparator[] = L"-applauncher-"; |
+ |
+} // namespace |
+ |
+// To remove "-test" from "-abc-test-efg", we: |
+// (1) add sentinel "-" to the end to form "-abc-test-efg-", |
+// (2) search for "-test" + "-" = "-test-", |
+// (3) if found, replace substring with "-" to get "-abc-efg-", |
+// (4) remove trialing "-" to get "-abc-efg". |
+void RemoveDeprecatedModifiers(base::string16* value) { |
+ value->push_back(kModSeparator[0]); // Add sentinel. |
+ ReplaceFirstSubstringAfterOffset( |
+ value, 0, kModAppHostWithSeparator, kModSeparator); |
+ ReplaceFirstSubstringAfterOffset( |
+ value, 0, kModAppLauncherWithSeparator, kModSeparator); |
+ value->pop_back(); // Remove sentinel. |
+} |
+ |
+} // namespace app_launcher_installer |
+} // namespace installer |
+ |
+#endif // defined(GOOGLE_CHROME_BUILD) |