Adding metrics comparing Accept-Language with xml:lang and HTML lang
values.

A follow-up Cl for https://crrev.com/c/3513984, as the majority of sites
do not send the Content-Language in the response header.
Instead, sites try to use the html `lang` tag to indicate the document
language.

We are trying to record the values of the language tags to the
Accept-Language header to determine:
* How many page loads have xml:lang or html lang match one of the
accepted languages?
* How many page loads have xml:lang or html lang match the top-most
preferred language?

Why WebLanguageDetectionDetails:
WebLanguageDetectionDetails can easily access html lang and `xml:lang`
attribute value. Also, we can read the Accept-Language from Prefs
efficiently.

Proposal doc:
[Limited to Google employees] https://docs.google.com/document/d/1bDaCMJP9w6VJjlM_5nRO1KxyB2fkV3JRtKkfUS0GJ_Y

Other doc:
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang

Bug: 1304818
Change-Id: I7d6c7c03e0f44405939273d944aa6a21ac515e40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3553383
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: Max Curran <[email protected]>
Reviewed-by: Trevor Perrier <[email protected]>
Reviewed-by: Ali Beyad <[email protected]>
Commit-Queue: Victor Tan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#988628}
diff --git a/components/translate/content/renderer/translate_agent.cc b/components/translate/content/renderer/translate_agent.cc
index d6c0b9b..ef6beef 100644
--- a/components/translate/content/renderer/translate_agent.cc
+++ b/components/translate/content/renderer/translate_agent.cc
@@ -196,6 +196,9 @@
 
   WebLanguageDetectionDetails web_detection_details =
       WebLanguageDetectionDetails::CollectLanguageDetectionDetails(document);
+  WebLanguageDetectionDetails::RecordAcceptLanguageAndXmlHtmlLangMetric(
+      document);
+
   std::string content_language = web_detection_details.content_language.Utf8();
   std::string html_lang = web_detection_details.html_language.Utf8();
   std::string model_detected_language;