Add about:flags to force color profile

Add an about:flag to force a specific color profile, and add some common
options to this flag. In particular:
  * sRGB, since it's the standard color space
  * Display P3, since it is a common wide gamut profile
  * scRGB Linear, since that will force HDR mode on Windows 10
  * A color spin non-standard gamma space, for testing

Some users who have wide color gamut monitors want the over-saturated
that non-color-correct rendering provided. For these users, on Chrome
61, they must either disable the color correct rendering feature, or
remove their system-installed color profile.

These users who want oversaturated colors on Windows and Linux will have
the option of forcing sRGB as their color profile in about:flags in
Chrome 62 and beyond.

R=hubbe
TBR=holte

Bug: 755747
Change-Id: I80b37432ca42bd0500b443b892bc754727c3f7b7
Reviewed-on: https://chromium-review.googlesource.com/655802
Reviewed-by: ccameron chromium <ccameron@chromium.org>
Reviewed-by: Fredrik Hubinette <hubbe@chromium.org>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#500439}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 1b5c44a..482516a 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -793,6 +793,18 @@
 };
 #endif  // !defined(OS_ANDROID)
 
+const FeatureEntry::Choice kForceColorProfileChoices[] = {
+    {flags_ui::kGenericExperimentChoiceDefault, "", ""},
+    {flag_descriptions::kForceColorProfileSRGB, switches::kForceColorProfile,
+     "srgb"},
+    {flag_descriptions::kForceColorProfileP3, switches::kForceColorProfile,
+     "display-p3-d65"},
+    {flag_descriptions::kForceColorProfileColorSpin,
+     switches::kForceColorProfile, "color-spin-gamma24"},
+    {flag_descriptions::kForceColorProfileHdr, switches::kForceColorProfile,
+     "scrgb-linear"},
+};
+
 const FeatureEntry::Choice kAutoplayPolicyChoices[] = {
     {flags_ui::kGenericExperimentChoiceDefault, "", ""},
     {flag_descriptions::kAutoplayPolicyNoUserGestureRequired,
@@ -3096,6 +3108,10 @@
      flag_descriptions::kColorCorrectRenderingDescription, kOsAll,
      FEATURE_VALUE_TYPE(features::kColorCorrectRendering)},
 
+    {"force-color-profile", flag_descriptions::kForceColorProfileName,
+     flag_descriptions::kForceColorProfileDescription, kOsAll,
+     MULTI_VALUE_TYPE(kForceColorProfileChoices)},
+
 #if defined(OS_CHROMEOS)
     {"quick-unlock-pin-signin", flag_descriptions::kQuickUnlockPinSignin,
      flag_descriptions::kQuickUnlockPinSigninDescription, kOsCrOS,
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 2833633..ec2c14f4 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -115,6 +115,16 @@
 const char kColorCorrectRenderingDescription[] =
     "Enables color correct rendering of web content.";
 
+const char kForceColorProfileSRGB[] = "sRGB";
+const char kForceColorProfileP3[] = "Display P3 D65";
+const char kForceColorProfileColorSpin[] = "Color spin with gamma 2.4";
+const char kForceColorProfileHdr[] = "scRGB linear (HDR where available)";
+
+const char kForceColorProfileName[] = "Force color profile";
+const char kForceColorProfileDescription[] =
+    "Forces Chrome to use a specific color profile instead of the color "
+    "of the window's current monitor, as specified by the operating system.";
+
 const char kCompositedLayerBordersName[] = "Composited render layer borders";
 const char kCompositedLayerBordersDescription[] =
     "Renders a border around composited Render Layers to help debug and study "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 98a4b0e..2399ae42 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -95,6 +95,14 @@
 extern const char kColorCorrectRenderingName[];
 extern const char kColorCorrectRenderingDescription[];
 
+extern const char kForceColorProfileSRGB[];
+extern const char kForceColorProfileP3[];
+extern const char kForceColorProfileColorSpin[];
+extern const char kForceColorProfileHdr[];
+
+extern const char kForceColorProfileName[];
+extern const char kForceColorProfileDescription[];
+
 extern const char kCompositedLayerBordersName[];
 extern const char kCompositedLayerBordersDescription[];
 
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index e073916..9219e44 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -23883,6 +23883,7 @@
   <int value="605150752" label="WebUSB:disabled"/>
   <int value="606288133" label="enable-print-preview-register-promos"/>
   <int value="606512202" label="AutofillCreditCardPopupLayout:enabled"/>
+  <int value="606834606" label="force-color-profile"/>
   <int value="609112512" label="touch-selection-strategy"/>
   <int value="610545308" label="enable-potentially-annoying-security-features"/>
   <int value="624317932" label="print-pdf-as-image"/>
diff --git a/ui/display/display.cc b/ui/display/display.cc
index fd5852e..c0901916 100644
--- a/ui/display/display.cc
+++ b/ui/display/display.cc
@@ -110,6 +110,8 @@
           switches::kForceColorProfile);
   if (value == "srgb") {
     return gfx::ColorSpace::CreateSRGB();
+  } else if (value == "display-p3-d65") {
+    return gfx::ColorSpace::CreateDisplayP3D65();
   } else if (value == "scrgb-linear") {
     return gfx::ColorSpace::CreateSCRGBLinear();
   } else if (value == "extended-srgb") {