Commit 483ecf8e authored by James Cook's avatar James Cook Committed by Commit Bot

Reland: lacros: Move lacros app id prefix to a shared constants file

There are some build hacks that compile ozone/wayland into the stock
chromeos build. Those hacks caused the original CL to pass GN check
for the CQ linux, chromeos and lacros bots, but fail gn check on the
on chromeos code search bot.

I'm trying to remove the hacks with crrev.com/c/2432137 but it may
take some time to validate and get reviewed.

For now, add nogncheck to the include. I've verified locally that the
codesearch config builds correctly and passes gn check.

Original CL description:
The ID prefix is shared between the Wayland client code in Lacros and
the Wayland server code in ash, so share the constant.

Bug: 1095360
Change-Id: Ied9c879e3aef8224e1d6c5f871a42cfe0745e614
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2427546Reviewed-by: default avatarAntonio Gomes (GMT-4) <tonikitoo@igalia.com>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#810277}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2433024
Cr-Commit-Position: refs/heads/master@{#811286}
parent 3a043e8a
......@@ -15,6 +15,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_paths.h"
#include "chromeos/crosapi/cpp/crosapi_constants.h"
#include "chromeos/crosapi/mojom/crosapi.mojom.h"
#include "components/exo/shell_surface_util.h"
#include "components/metrics/metrics_pref_names.h"
......@@ -114,9 +115,6 @@ bool IsLacrosWindow(const aura::Window* window) {
const std::string* app_id = exo::GetShellApplicationId(window);
if (!app_id)
return false;
// TODO(jamescook): Move this constant to //chromeos/crosapi/cpp and share it
// with //ui/ozone/wayland.
const char kLacrosAppIdPrefix[] = "org.chromium.lacros";
return base::StartsWith(*app_id, kLacrosAppIdPrefix);
}
......
......@@ -14,6 +14,8 @@ component("cpp") {
"bitmap.h",
"bitmap_util.cc",
"bitmap_util.h",
"crosapi_constants.cc",
"crosapi_constants.h",
]
configs += [ ":crosapi_implementation" ]
deps = [
......
// 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 "chromeos/crosapi/cpp/crosapi_constants.h"
namespace crosapi {
// The prefix for a Wayland app id for a Lacros browser window. The full ID is
// suffixed with a serialized unguessable token unique to each window. The
// trailing "." is intentional.
const char kLacrosAppIdPrefix[] = "org.chromium.lacros.";
} // namespace crosapi
// 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.
#ifndef CHROMEOS_CROSAPI_CPP_CROSAPI_CONSTANTS_H_
#define CHROMEOS_CROSAPI_CPP_CROSAPI_CONSTANTS_H_
#include "base/component_export.h"
namespace crosapi {
COMPONENT_EXPORT(CROSAPI) extern const char kLacrosAppIdPrefix[];
} // namespace crosapi
#endif // CHROMEOS_CROSAPI_CPP_CROSAPI_CONSTANTS_H_
......@@ -4,6 +4,7 @@
visibility = [ "//ui/ozone/*" ]
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/linux/gtk/gtk.gni")
import("//build/config/linux/pkg_config.gni")
import("//gpu/vulkan/features.gni")
......@@ -212,6 +213,11 @@ source_set("wayland") {
]
}
# TODO(crbug.com/1052397): Rename chromeos_is_browser_only to is_lacros.
if (chromeos_is_browser_only) {
deps += [ "//chromeos/crosapi/cpp" ]
}
defines = [ "OZONE_IMPLEMENTATION" ]
if (use_wayland_gbm) {
......
include_rules = [
# For Lacros.
"+chromeos/crosapi/cpp/crosapi_constants.h",
]
......@@ -24,6 +24,12 @@
#include "ui/platform_window/extensions/wayland_extension.h"
#include "ui/platform_window/wm/wm_drop_handler.h"
#if BUILDFLAG(IS_LACROS)
// TODO(jamescook): The nogncheck is to work around false-positive failures on
// the code search bot. Remove after https://crrev.com/c/2432137 lands.
#include "chromeos/crosapi/cpp/crosapi_constants.h" // nogncheck
#endif
namespace ui {
WaylandToplevelWindow::WaylandToplevelWindow(PlatformWindowDelegate* delegate,
......@@ -338,7 +344,8 @@ bool WaylandToplevelWindow::OnInitialize(
PlatformWindowInitProperties properties) {
#if BUILDFLAG(IS_LACROS)
auto token = base::UnguessableToken::Create();
window_unique_id_ = "org.chromium.lacros." + token.ToString();
window_unique_id_ =
std::string(crosapi::kLacrosAppIdPrefix) + token.ToString();
#else
wm_class_class_ = properties.wm_class_class;
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment