[Chrome Colors] Use only one flag for Chrome colors.

Use only one flag for Chrome colors instead of 3 separate flags for RGB
value.

Bug: 930206
Change-Id: I2d917d51941176c14cd7d2313344d1bbcbc7abe8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1532371
Reviewed-by: Gayane Petrosyan <gayane@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Gayane Petrosyan <gayane@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642751}
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 2b4c00c..4dd33763 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -35,6 +35,7 @@
 #include "chrome/browser/ui/browser_finder.h"
 #include "chrome/common/buildflags.h"
 #include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_switches.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/grit/theme_resources.h"
 #include "components/grit/components_scaled_resources.h"
@@ -336,16 +337,17 @@
   // there.
   const base::CommandLine* command_line =
       base::CommandLine::ForCurrentProcess();
-  if (command_line->HasSwitch("install-colors-r") &&
-      command_line->HasSwitch("install-colors-g") &&
-      command_line->HasSwitch("install-colors-b")) {
+  if (command_line->HasSwitch(switches::kInstallAutogeneratedTheme)) {
+    std::string value =
+        command_line->GetSwitchValueASCII(switches::kInstallAutogeneratedTheme);
+    std::vector<std::string> rgb = base::SplitString(
+        value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+    if (rgb.size() != 3)
+      return;
     int r, g, b;
-    base::StringToInt(command_line->GetSwitchValueASCII("install-colors-r"),
-                      &r);
-    base::StringToInt(command_line->GetSwitchValueASCII("install-colors-g"),
-                      &g);
-    base::StringToInt(command_line->GetSwitchValueASCII("install-colors-b"),
-                      &b);
+    base::StringToInt(rgb[0], &r);
+    base::StringToInt(rgb[1], &g);
+    base::StringToInt(rgb[2], &b);
     BuildFromColor(SkColorSetRGB(r, g, b));
   }
 }
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index f7852fa..775e7716 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -362,6 +362,10 @@
 // Causes the browser to launch directly in incognito mode.
 const char kIncognito[]                     = "incognito";
 
+// Installs an autogenerated theme based on the given RGB value.
+// The format is "r,g,b", where r, g, b are a numeric values from 0 to 255.
+const char kInstallAutogeneratedTheme[] = "install-autogenerated-theme";
+
 // Causes Chrome to initiate an installation flow for the given app.
 const char kInstallChromeApp[]              = "install-chrome-app";
 
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 04db70f..b5d6a55 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -115,6 +115,7 @@
 extern const char kForceStackedTabStripLayout[];
 extern const char kHomePage[];
 extern const char kIncognito[];
+extern const char kInstallAutogeneratedTheme[];
 extern const char kInstallChromeApp[];
 extern const char kInstallSupervisedUserWhitelists[];
 extern const char kInstantProcess[];