Workaround to remove command line flag on ChromeOS.
When bookmarks experiment is enabled existing code will add a command line flag that will allow opt-out to be shown on a chrome:flags page.
On Chrome OS at time of login if they see command line flag from any experiment they restart browser. It creates delay and user will see a black screen for a couple seconds. It happens on every login, not only the first one.
I talked to CrOS devs and they strongly discourage from using command line flags.
So for Chrome OS only do not add flag to command line but still keep it in a flag_storage. Use flag storage when need to check if flag is set.

BUG=

Review URL: https://codereview.chromium.org/578333003

Cr-Commit-Position: refs/heads/master@{#296504}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index f8633a9..def3760 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -2023,7 +2023,8 @@
   *result = flags_storage->GetFlags();
 }
 
-bool SkipConditionalExperiment(const Experiment& experiment) {
+bool SkipConditionalExperiment(const Experiment& experiment,
+                               FlagsStorage* flags_storage) {
   if (experiment.internal_name ==
       std::string("enhanced-bookmarks-experiment")) {
 #if defined(OS_ANDROID)
@@ -2036,7 +2037,7 @@
     if (command_line->HasSwitch(switches::kEnhancedBookmarksExperiment))
       return false;
 
-    return !IsEnhancedBookmarksExperimentEnabled();
+    return !IsEnhancedBookmarksExperimentEnabled(flags_storage);
 #endif
   }
 
@@ -2178,7 +2179,7 @@
 
   for (size_t i = 0; i < num_experiments; ++i) {
     const Experiment& experiment = experiments[i];
-    if (SkipConditionalExperiment(experiment))
+    if (SkipConditionalExperiment(experiment, flags_storage))
       continue;
 
     base::DictionaryValue* data = new base::DictionaryValue();
@@ -2375,6 +2376,14 @@
       continue;
     }
 
+#if defined(OS_CHROMEOS)
+    // On Chrome OS setting command line flag may make browser to restart on
+    // user login. As this flag eventually will be set to a significant number
+    // of users skip manual-enhanced-bookmarks to avoid restart.
+    if (experiment_name == "manual-enhanced-bookmarks")
+      continue;
+#endif
+
     const std::pair<std::string, std::string>&
         switch_and_value_pair = name_to_switch_it->second;