Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5752)

Unified Diff: chrome/installer/util/app_launcher_installer_util.cc

Issue 811283002: [Installer] Cleaning up dead code for App Launcher / App Host installs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanups; handle ChannelInfo to remove '-apphost' and '-applauncher'. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698