Add constants and proto for updating Crostini App Registry

This CL adds the vm_tools.apps.ApplicationList proto, for use as an
argument in the also newly added org.chromium.VmApplicationsService
D-Bus service.

Bug: 821662
Change-Id: I05b05f03966eb60dd293cd9d0b46163eb9cc77e5
Reviewed-on: https://chromium-review.googlesource.com/965724
Commit-Ready: Jeffrey Kardatzke <jkardatzke@google.com>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
diff --git a/dbus/service_constants.h b/dbus/service_constants.h
index 5745f32..5f16534 100644
--- a/dbus/service_constants.h
+++ b/dbus/service_constants.h
@@ -25,6 +25,7 @@
 #include "shill/dbus-constants.h"
 #include "smbprovider/dbus-constants.h"
 #include "update_engine/dbus-constants.h"
+#include "vm_applications/dbus-constants.h"
 #include "vm_concierge/dbus-constants.h"
 
 namespace dbus {
diff --git a/dbus/vm_applications/apps.proto b/dbus/vm_applications/apps.proto
new file mode 100644
index 0000000..76c2390
--- /dev/null
+++ b/dbus/vm_applications/apps.proto
@@ -0,0 +1,39 @@
+// Copyright 2018 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+syntax = "proto3";
+option optimize_for = LITE_RUNTIME;
+
+package vm_tools.apps;
+
+// Corresponds to a .desktop file from the Desktop Entry Spec:
+// https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/
+message App {
+  // A "localestring". Entries with a locale should set the |locale| field to
+  // the value inside the [] and the default entry should leave it empty. The
+  // browser is responsible for mapping this to something it can use.
+  message LocaleString {
+    message Entry {
+      string locale = 1;
+      string value = 2;
+    }
+    repeated Entry values = 1;
+  }
+
+  string desktop_file_id = 1;
+
+  // These fields map directly to keys from the Desktop Entry spec.
+  LocaleString name = 2;
+  LocaleString comment = 3;
+  repeated string mime_types = 4;
+  bool no_display = 5;
+  string startup_wm_class = 6;
+}
+
+message ApplicationList {
+  repeated App apps = 1;
+
+  string vm_name = 2;
+  string container_name = 3;
+}
diff --git a/dbus/vm_applications/dbus-constants.h b/dbus/vm_applications/dbus-constants.h
new file mode 100644
index 0000000..469c8e5
--- /dev/null
+++ b/dbus/vm_applications/dbus-constants.h
@@ -0,0 +1,20 @@
+// Copyright 2018 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYSTEM_API_DBUS_VM_APPLICATIONS_DBUS_CONSTANTS_H_
+#define SYSTEM_API_DBUS_VM_APPLICATIONS_DBUS_CONSTANTS_H_
+
+namespace vm_tools {
+namespace apps {
+
+const char kVmApplicationsServiceName[] = "org.chromium.VmApplicationsService";
+const char kVmApplicationsServicePath[] = "/org/chromium/VmApplicationsService";
+const char kVmApplicationsServiceInterface[] = "org.chromium.VmApplicationsService";
+
+const char kVmApplicationsServiceUpdateApplicationListMethod[] = "UpdateApplicationList";
+
+}  // namespace apps
+}  // namespace vm_tools
+
+#endif  // SYSTEM_API_DBUS_VM_APPLICATIONS_DBUS_CONSTANTS_H_
diff --git a/system_api.gyp b/system_api.gyp
index 827a380..7081ce8 100644
--- a/system_api.gyp
+++ b/system_api.gyp
@@ -251,6 +251,29 @@
       ]
     },
     {
+      'target_name': 'system_api-vm_applications-protos-gen',
+      'type': 'none',
+      'variables': {
+        'proto_in_dir': 'dbus/vm_applications',
+        'proto_out_dir': 'include/vm_applications/proto_bindings',
+      },
+      'sources': [
+        '<(proto_in_dir)/apps.proto',
+      ],
+      'includes': ['../../platform2/common-mk/protoc.gypi'],
+    },
+    {
+      'target_name': 'system_api-vm_applications-protos',
+      'type': 'static_library',
+      'standalone_static_library': 1,
+      'dependencies': [
+        'system_api-vm_applications-protos-gen',
+      ],
+      'sources': [
+        '<(SHARED_INTERMEDIATE_DIR)/include/vm_applications/proto_bindings/apps.pb.cc',
+      ]
+    },
+    {
       'target_name': 'ml_service_mojo_bindings',
       'type': 'none',
       'variables': {
diff --git a/system_api.pc b/system_api.pc
index 8592c30..9def4a2 100644
--- a/system_api.pc
+++ b/system_api.pc
@@ -1,4 +1,4 @@
 Name: system_api
 Description: Protobuffers and headers shared by Chromium OS and Chromium.
 Version: 0.1
-Libs: -lsystem_api-power_manager-protos -lsystem_api-cryptohome-protos -lsystem_api-authpolicy-protos -lsystem_api-biod-protos -lsystem_api-protos -lsystem_api-login_manager-protos -lsystem_api-chaps-protos -lsystem_api-smbprovider-protos -lsystem_api-vm_concierge-protos
+Libs: -lsystem_api-power_manager-protos -lsystem_api-cryptohome-protos -lsystem_api-authpolicy-protos -lsystem_api-biod-protos -lsystem_api-protos -lsystem_api-login_manager-protos -lsystem_api-chaps-protos -lsystem_api-smbprovider-protos -lsystem_api-vm_concierge-protos -lsystem_api-vm_applications-protos