Commit 422d1749 authored by James Cook's avatar James Cook Committed by Commit Bot

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

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

Bug: none
Change-Id: If62550c447670e553a854ce1092cfd3d7d9aacff
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-Commit-Position: refs/heads/master@{#810277}
parent 836d76c7
......@@ -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,10 @@
#include "ui/platform_window/extensions/wayland_extension.h"
#include "ui/platform_window/wm/wm_drop_handler.h"
#if BUILDFLAG(IS_LACROS)
#include "chromeos/crosapi/cpp/crosapi_constants.h"
#endif
namespace ui {
WaylandToplevelWindow::WaylandToplevelWindow(PlatformWindowDelegate* delegate,
......@@ -338,7 +342,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