diff options
Diffstat (limited to 'chromium/fuchsia/base/feedback_registration.cc')
-rw-r--r-- | chromium/fuchsia/base/feedback_registration.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/chromium/fuchsia/base/feedback_registration.cc b/chromium/fuchsia/base/feedback_registration.cc new file mode 100644 index 00000000000..d8bee5ff647 --- /dev/null +++ b/chromium/fuchsia/base/feedback_registration.cc @@ -0,0 +1,30 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "fuchsia/base/feedback_registration.h" + +#include <fuchsia/feedback/cpp/fidl.h> +#include <lib/sys/cpp/component_context.h> + +#include "base/fuchsia/process_context.h" +#include "base/strings/string_piece.h" +#include "components/version_info/version_info.h" + +namespace cr_fuchsia { + +void RegisterCrashReportingFields(base::StringPiece component_url, + base::StringPiece crash_product_name) { + fuchsia::feedback::CrashReportingProduct product_data; + product_data.set_name(crash_product_name.as_string()); + product_data.set_version(version_info::GetVersionNumber()); + // TODO(https://crbug.com/1077428): Use the actual channel when appropriate. + // For now, always set it to the empty string to avoid reporting "missing". + product_data.set_channel(""); + base::ComponentContextForProcess() + ->svc() + ->Connect<fuchsia::feedback::CrashReportingProductRegister>() + ->Upsert(component_url.as_string(), std::move(product_data)); +} + +} // namespace cr_fuchsia |