Add a new way to record Rappor metrics for MIDI permissions.

Rappor metrics for constant permissions were added, but it was based
on old way that may be deprecated soon. This change adds new way to
record metrics that others use.

Also, rappor.xml is updated that was missed in the last change.

BUG=465661
TBR=mlamouri@chromium.org

Review-Url: https://codereview.chromium.org/2038403002
Cr-Commit-Position: refs/heads/master@{#398770}
diff --git a/chrome/browser/permissions/permission_uma_util.cc b/chrome/browser/permissions/permission_uma_util.cc
index 43470736..efbdf5f 100644
--- a/chrome/browser/permissions/permission_uma_util.cc
+++ b/chrome/browser/permissions/permission_uma_util.cc
@@ -195,10 +195,15 @@
           rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
     } else if (permission == PermissionType::MIDI ||
                permission == PermissionType::MIDI_SYSEX) {
+      // TODO(dominickn): remove this deprecated metric - crbug.com/605836.
       rappor::SampleDomainAndRegistryFromGURL(
           rappor_service,
           "ContentSettings.PermissionRequested.Midi.Url",
           requesting_origin);
+      rappor_service->RecordSample(
+          "ContentSettings.PermissionRequested.Midi.Url2",
+          rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
+          rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
     }
   }
 
diff --git a/tools/metrics/rappor/rappor.xml b/tools/metrics/rappor/rappor.xml
index df0cdbc..37f40d7 100644
--- a/tools/metrics/rappor/rappor.xml
+++ b/tools/metrics/rappor/rappor.xml
@@ -742,6 +742,23 @@
   </summary>
 </rappor-metric>
 
+<rappor-metric name="ContentSettings.PermissionRequested.Midi.Url"
+    type="ETLD_PLUS_ONE">
+  <owner>toyoshim@chromium.org</owner>
+  <summary>
+    **DEPRECATED: replaced by ContentSettings.PermissionRequested.Midi.Url2
+    as of M53. The domain that requests using MIDI devices.
+  </summary>
+</rappor-metric>
+
+<rappor-metric name="ContentSettings.PermissionRequested.Midi.Url2"
+    type="LOW_FREQUENCY_ETLD_PLUS_ONE">
+  <owner>toyoshim@chromium.org</owner>
+  <summary>
+    The domain that requests using MIDI devices.
+  </summary>
+</rappor-metric>
+
 <rappor-metric name="ContentSettings.PermissionRequested.Notifications.Url"
     type="ETLD_PLUS_ONE">
   <owner>miguelg@chromium.org</owner>