Include the AppData file for Chrome and Chromium

Add the two AppData files, one for Chromium and one for Chrome. The Chrome one
will be filled with the information from the common/google-chrome/google-chrome.info
file and should reflect the current channel (stable, beta, devel). On the other
side the Chromium one should be a general one and it will be reused by
distributions that are packaging the Chromium themselves.

For AppData specification please see:
https://people.freedesktop.org/~hughsient/appdata/

BUG=654190

Review-Url: https://codereview.chromium.org/2424093003
Cr-Commit-Position: refs/heads/master@{#455457}
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn
index 406a8a2..95a1d9d 100644
--- a/chrome/installer/linux/BUILD.gn
+++ b/chrome/installer/linux/BUILD.gn
@@ -85,9 +85,15 @@
   ]
 
   if (is_chrome_branded) {
-    sources += [ "common/google-chrome/google-chrome.info" ]
+    sources += [
+      "common/google-chrome/google-chrome.appdata.xml.template",
+      "common/google-chrome/google-chrome.info",
+    ]
   } else {
-    sources += [ "common/chromium-browser/chromium-browser.info" ]
+    sources += [
+      "common/chromium-browser/chromium-browser.appdata.xml",
+      "common/chromium-browser/chromium-browser.info",
+    ]
   }
 
   if (current_cpu == "x86") {
diff --git a/chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml b/chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml
new file mode 100644
index 0000000..1f4e463
--- /dev/null
+++ b/chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml
@@ -0,0 +1,36 @@
+<!-- Copyright 2017 The Chromium Authors -->
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop">
+  <id>chromium-browser.desktop</id>
+  <update_contact>chromium-dev@chromium.org</update_contact>
+  <metadata_license>CC0-1.0</metadata_license>
+  <project_license>BSD-3-Clause and LGPL-2.1+ and Apache-2.0 and IJG and MIT and GPL-2.0+ and ISC and OpenSSL and (MPL-1.1 or GPL-2.0 or LGPL-2.0)</project_license>
+  <name>Chromium Web Browser</name>
+  <summary>The web browser from Chromium project</summary>
+  <description>
+    <p>
+    Chromium is an open-source browser project that aims to build a safer, faster,
+    and more stable way to experience the web.
+    </p>
+    <p>
+    We invite you to join our effort to build a powerful platform for developing a
+    new generation of web applications.
+    </p>
+    <p>
+    Chromium supports Vorbis, Theora, WebM and HTML5 audio and video standards, but
+    does not include the non-free AAC, H.264, MP3 or Adobe Flash code that is found
+    in Chrome.
+    </p>
+  </description>
+  <url type="homepage">https://www.chromium.org/Home</url>
+  <screenshots>
+    <screenshot type="default">
+      <image>https://www.gstatic.com/chrome/appstream/chrome-1.png</image>
+      <caption/>
+    </screenshot>
+  </screenshots>
+  <translation/>
+  <developer_name>The Chromium Authors</developer_name>
+  <url type="bugtracker">https://www.chromium.org/for-testers/bug-reporting-guidelines</url>
+  <url type="help">https://chromium.googlesource.com/chromium/src/+/master/docs/linux_debugging.md</url>
+</component>
diff --git a/chrome/installer/linux/common/google-chrome/google-chrome.appdata.xml.template b/chrome/installer/linux/common/google-chrome/google-chrome.appdata.xml.template
new file mode 100644
index 0000000..1f03817f
--- /dev/null
+++ b/chrome/installer/linux/common/google-chrome/google-chrome.appdata.xml.template
@@ -0,0 +1,26 @@
+<!-- Copyright 2017 The Chromium Authors -->
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop">
+  <id>@@PACKAGE@@.desktop</id>
+  <update_contact>chromium-dev@chromium.org</update_contact>
+  <metadata_license>CC0-1.0</metadata_license>
+  <project_license>Freeware under Google Chrome Terms of Service</project_license>
+  <name>@@MENUNAME@@</name>
+  <summary>The web browser from Google</summary>
+  <description>
+    <p>
+    @@FULLDESC@@
+   </p>
+  </description>
+  <url type="homepage">@@PRODUCTURL@@</url>
+  <screenshots>
+    <screenshot type="default">
+      <image>https://www.gstatic.com/chrome/appstream/chrome-1.png</image>
+      <caption/>
+    </screenshot>
+  </screenshots>
+  <translation/>
+  <developer_name>Google</developer_name>
+  <url type="bugtracker">https://support.google.com/chrome/?p=feedback</url>
+  <url type="help">https://support.google.com/chrome</url>
+</component>
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include
index a8666514..f26a0ae 100644
--- a/chrome/installer/linux/common/installer.include
+++ b/chrome/installer/linux/common/installer.include
@@ -244,6 +244,14 @@
   # desktop integration
   install -m 755 "${BUILDDIR}/xdg-mime" "${STAGEDIR}${INSTALLDIR}/"
   install -m 755 "${BUILDDIR}/xdg-settings" "${STAGEDIR}${INSTALLDIR}/"
+  if [ ${PACKAGE:0:6} = google ]; then
+    process_template "${BUILDDIR}/installer/common/google-chrome/google-chrome.appdata.xml.template" \
+      "${STAGEDIR}/usr/share/appdata/${PACKAGE}.appdata.xml"
+    chmod 644 "${STAGEDIR}/usr/share/appdata/${PACKAGE}.appdata.xml"
+  else
+    install -m 644 "${BUILDDIR}/installer/common/chromium-browser/chromium-browser.appdata.xml" \
+      "${STAGEDIR}/usr/share/appdata/${PACKAGE}.appdata.xml"
+  fi
   process_template "${BUILDDIR}/installer/common/desktop.template" \
     "${STAGEDIR}/usr/share/applications/${PACKAGE}.desktop"
   chmod 644 "${STAGEDIR}/usr/share/applications/${PACKAGE}.desktop"
diff --git a/chrome/installer/linux/rpm/chrome.spec.template b/chrome/installer/linux/rpm/chrome.spec.template
index 08c402c..e878a85 100644
--- a/chrome/installer/linux/rpm/chrome.spec.template
+++ b/chrome/installer/linux/rpm/chrome.spec.template
@@ -89,6 +89,7 @@
 /etc/cron.daily/@@PACKAGE@@
 %ghost %attr(755,root,root) /usr/bin/google-chrome
 /usr/bin/@@USR_BIN_SYMLINK_NAME@@
+/usr/share/appdata/@@PACKAGE@@.appdata.xml
 /usr/share/applications/@@PACKAGE@@.desktop
 /usr/share/gnome-control-center/default-apps/@@PACKAGE@@.xml
 %docdir /usr/share/man/man1