0

[Ash] Delete dead Lacros and mojom code in Desk Template feature

Bug: 354842935
Test: tryjob
Change-Id: Ic610b36e5429441d1e122366338c647a89295065
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6294703
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Di Wu <diwux@google.com>
Cr-Commit-Position: refs/heads/main@{#1424267}
This commit is contained in:
Di Wu
2025-02-24 18:08:45 -08:00
committed by Chromium LUCI CQ
parent 2e293926b9
commit b5d32c0688
11 changed files with 1 additions and 283 deletions

@ -41,8 +41,6 @@ static_library("crosapi") {
"debug_interface_registerer_ash.h",
"desk_profiles_ash.cc",
"desk_profiles_ash.h",
"desk_template_ash.cc",
"desk_template_ash.h",
"device_attributes_ash.cc",
"device_attributes_ash.h",
"device_local_account_extension_service_ash.cc",

@ -24,7 +24,6 @@
#include "chrome/browser/ash/crosapi/content_protection_ash.h"
#include "chrome/browser/ash/crosapi/debug_interface_registerer_ash.h"
#include "chrome/browser/ash/crosapi/desk_profiles_ash.h"
#include "chrome/browser/ash/crosapi/desk_template_ash.h"
#include "chrome/browser/ash/crosapi/device_attributes_ash.h"
#include "chrome/browser/ash/crosapi/device_local_account_extension_service_ash.h"
#include "chrome/browser/ash/crosapi/device_oauth2_token_service_ash.h"
@ -165,7 +164,6 @@ CrosapiAsh::CrosapiAsh()
debug_interface_registerer_ash_(
std::make_unique<DebugInterfaceRegistererAsh>()),
desk_profiles_ash_(std::make_unique<DeskProfilesAsh>()),
desk_template_ash_(std::make_unique<DeskTemplateAsh>()),
device_attributes_ash_(std::make_unique<DeviceAttributesAsh>()),
device_local_account_extension_service_ash_(
std::make_unique<DeviceLocalAccountExtensionServiceAsh>()),
@ -332,11 +330,6 @@ void CrosapiAsh::BindDeskProfileObserver(
desk_profiles_ash_->BindReceiver(std::move(receiver));
}
void CrosapiAsh::BindDeskTemplate(
mojo::PendingReceiver<mojom::DeskTemplate> receiver) {
desk_template_ash_->BindReceiver(std::move(receiver));
}
void CrosapiAsh::BindDeviceAttributes(
mojo::PendingReceiver<mojom::DeviceAttributes> receiver) {
device_attributes_ash_->BindReceiver(std::move(receiver));

@ -53,7 +53,6 @@ class ClipboardHistoryAsh;
class ContentProtectionAsh;
class DebugInterfaceRegistererAsh;
class DeskProfilesAsh;
class DeskTemplateAsh;
class DeviceAttributesAsh;
class DeviceLocalAccountExtensionServiceAsh;
class DeviceOAuth2TokenServiceAsh;
@ -146,8 +145,6 @@ class CrosapiAsh : public mojom::Crosapi {
mojo::PendingReceiver<mojom::DebugInterfaceRegisterer> receiver) override;
void BindDeskProfileObserver(
mojo::PendingReceiver<mojom::DeskProfileObserver> receiver) override;
void BindDeskTemplate(
mojo::PendingReceiver<mojom::DeskTemplate> receiver) override;
void BindDeviceAttributes(
mojo::PendingReceiver<mojom::DeviceAttributes> receiver) override;
void BindDeviceLocalAccountExtensionService(
@ -316,8 +313,6 @@ class CrosapiAsh : public mojom::Crosapi {
DeskProfilesAsh* desk_profiles_ash() { return desk_profiles_ash_.get(); }
DeskTemplateAsh* desk_template_ash() { return desk_template_ash_.get(); }
DeviceAttributesAsh* device_attributes_ash() {
return device_attributes_ash_.get();
}
@ -458,7 +453,6 @@ class CrosapiAsh : public mojom::Crosapi {
std::unique_ptr<ContentProtectionAsh> content_protection_ash_;
std::unique_ptr<DebugInterfaceRegistererAsh> debug_interface_registerer_ash_;
std::unique_ptr<DeskProfilesAsh> desk_profiles_ash_;
std::unique_ptr<DeskTemplateAsh> desk_template_ash_;
std::unique_ptr<DeviceAttributesAsh> device_attributes_ash_;
std::unique_ptr<DeviceLocalAccountExtensionServiceAsh>
device_local_account_extension_service_ash_;

@ -1,35 +0,0 @@
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ash/crosapi/desk_template_ash.h"
namespace crosapi {
DeskTemplateAsh::DeskTemplateAsh() = default;
DeskTemplateAsh::~DeskTemplateAsh() = default;
void DeskTemplateAsh::BindReceiver(
mojo::PendingReceiver<mojom::DeskTemplate> pending_receiver) {
receivers_.Add(this, std::move(pending_receiver));
}
void DeskTemplateAsh::GetFaviconImage(
const GURL& url,
uint64_t lacros_profile_id,
base::OnceCallback<void(const gfx::ImageSkia&)> callback) {
if (remotes_.empty()) {
std::move(callback).Run(gfx::ImageSkia());
return;
}
remotes_.begin()->get()->GetFaviconImage(url, lacros_profile_id,
std::move(callback));
}
void DeskTemplateAsh::AddDeskTemplateClient(
mojo::PendingRemote<mojom::DeskTemplateClient> client) {
remotes_.Add(mojo::Remote<mojom::DeskTemplateClient>(std::move(client)));
}
} // namespace crosapi

@ -1,44 +0,0 @@
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ASH_CROSAPI_DESK_TEMPLATE_ASH_H_
#define CHROME_BROWSER_ASH_CROSAPI_DESK_TEMPLATE_ASH_H_
#include "chromeos/crosapi/mojom/desk_template.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote_set.h"
#include "url/gurl.h"
namespace crosapi {
// Implements the crosapi interface for desk template. Lives in Ash-Chrome
// on the UI thread.
class DeskTemplateAsh : public mojom::DeskTemplate {
public:
DeskTemplateAsh();
DeskTemplateAsh(const DeskTemplateAsh&) = delete;
DeskTemplateAsh& operator=(const DeskTemplateAsh&) = delete;
~DeskTemplateAsh() override;
void BindReceiver(mojo::PendingReceiver<mojom::DeskTemplate> receiver);
void GetFaviconImage(
const GURL& url,
uint64_t lacros_profile_id,
base::OnceCallback<void(const gfx::ImageSkia&)> callback);
// crosapi::mojom::DeskTemplate:
void AddDeskTemplateClient(
mojo::PendingRemote<mojom::DeskTemplateClient> client) override;
private:
mojo::ReceiverSet<mojom::DeskTemplate> receivers_;
// Each separate Lacros process owns its own remote.
mojo::RemoteSet<mojom::DeskTemplateClient> remotes_;
};
} // namespace crosapi
#endif // CHROME_BROWSER_ASH_CROSAPI_DESK_TEMPLATE_ASH_H_

@ -9,7 +9,6 @@
#include "ash/public/cpp/saved_desk_delegate.h"
#include "base/functional/callback_forward.h"
#include "chromeos/crosapi/mojom/desk_template.mojom-forward.h"
namespace aura {
class Window;

@ -21,7 +21,6 @@ mojom("mojom") {
"debug_interface.mojom",
"desk.mojom",
"desk_profiles.mojom",
"desk_template.mojom",
"device_attributes.mojom",
"device_local_account_extension_service.mojom",
"device_oauth2_token_service.mojom",
@ -242,7 +241,6 @@ mojom("mojom") {
traits_headers = [
"//chromeos/crosapi/mojom/cert_database_mojom_traits.h",
"//chromeos/crosapi/mojom/desk_mojom_traits.h",
"//chromeos/crosapi/mojom/desk_template_mojom_traits.h",
"//chromeos/crosapi/mojom/policy_domain_mojom_traits.h",
"//chromeos/crosapi/mojom/policy_namespace_mojom_traits.h",
"//chromeos/crosapi/mojom/ui_constants_mojom_traits.h",
@ -259,7 +257,6 @@ mojom("mojom") {
traits_sources = [
"//chromeos/crosapi/mojom/cert_database_mojom_traits.cc",
"//chromeos/crosapi/mojom/desk_mojom_traits.cc",
"//chromeos/crosapi/mojom/desk_template_mojom_traits.cc",
"//chromeos/crosapi/mojom/policy_domain_mojom_traits.cc",
"//chromeos/crosapi/mojom/policy_namespace_mojom_traits.cc",
"//chromeos/crosapi/mojom/ui_constants_mojom_traits.cc",

@ -22,7 +22,6 @@ import "chromeos/crosapi/mojom/cros_display_config.mojom";
import "chromeos/crosapi/mojom/debug_interface.mojom";
import "chromeos/crosapi/mojom/desk.mojom";
import "chromeos/crosapi/mojom/desk_profiles.mojom";
import "chromeos/crosapi/mojom/desk_template.mojom";
import "chromeos/crosapi/mojom/device_attributes.mojom";
import "chromeos/crosapi/mojom/device_local_account_extension_service.mojom";
import "chromeos/crosapi/mojom/device_oauth2_token_service.mojom";
@ -190,9 +189,7 @@ interface Crosapi {
[MinVersion=122] BindDeskProfileObserver@124(
pending_receiver<DeskProfileObserver> receiver);
// Binds the desk template factory interface.
// Added in M101.
[MinVersion=68] BindDeskTemplate@71(pending_receiver<DeskTemplate> receiver);
// BindDeskTemplate@71 was removed.
// Binds the device attributes service which is used by enterprise extension
// APIs to query information about the device.

@ -1,86 +0,0 @@
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module crosapi.mojom;
import "components/tab_groups/public/mojom/tab_group_types.mojom";
import "ui/base/mojom/window_show_state.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/url.mojom";
import "ui/gfx/image/mojom/image.mojom";
// Structure representing the state of a tab group in a browser instance.
struct TabGroup {
// The title of the tab group
string title;
// The background color of the tab group.
tab_groups.mojom.Color color;
// Whether the group is collapsed.
bool is_collapsed;
// The index of the first tab in this group. This index cannot overlap with
// the indexes of other tab groups associated with the window this group
// belongs with. The start index also cannot be less than the value
// associated with the `first_non_pinned_tab_index`.
uint32 start_index;
// Number of tabs in this group. The sum of this and the start index cannot
// result in an index that is greater than the total number of tabs associated
// with the owning window. The sum of this and the start index also cannot
// result in an index that overlaps with another tab group.
uint32 tab_count;
};
// Additional state of the browser in the single Lacros window for saving in the
// desk template.
struct DeskTemplateState {
// URLs in the tab strip.
array<url.mojom.Url> urls@0;
// Index of the active tab.
uint32 active_index@1;
[MinVersion=2] string? browser_app_name@2;
[MinVersion=3] int64 restore_window_id@3;
// Index of the first non-pinned tab. 0 if no tabs are pinned. This index
// cannot be contained within the range of any tab groups and tab group
// indexes cannot overlap with any index less than this value.
[MinVersion=4] uint32 first_non_pinned_index@4;
// List of tab groups associated with this browser.
[MinVersion=4] array<TabGroup>? groups@5;
// The lacros profile ID for this browser.
[MinVersion=5] uint64 lacros_profile_id@6;
};
// Interface for desk template clients. Implemented by lacros-chrome.
// Next version: 5
// Next method id: 3
interface DeskTemplateClient {
// GetBrowserInformation@0 was removed.
// CreateBrowserWithRestoredData@1 was removed.
// Gets the image of the favicon associated with `url`. Returns an empty
// image if the favicon cannot be found. If `profile_id` is specified, then
// that profile is used to load the favicon, otherwise the main profile is
// used.
[MinVersion=3]
GetFaviconImage@2(url.mojom.Url url, [MinVersion=4] uint64? profile_id)
=> (gfx.mojom.ImageSkia? image);
};
// Interface for desk template. Implemented by ash-chrome.
// Next version: 1
// Next method id: 1
[Uuid="7566edd4-358d-44b6-b71c-9eb87c632271"]
interface DeskTemplate {
// Registers the client that lives in lacros-chrome.
AddDeskTemplateClient@0(pending_remote<DeskTemplateClient> client);
};

@ -1,64 +0,0 @@
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/crosapi/mojom/desk_template_mojom_traits.h"
#include "base/strings/utf_string_conversions.h"
#include "components/tab_groups/tab_group_visual_data.h"
#include "ui/gfx/range/range.h"
namespace mojo {
std::string
StructTraits<crosapi::mojom::TabGroupDataView, tab_groups::TabGroupInfo>::title(
const tab_groups::TabGroupInfo& group_info) {
return base::UTF16ToUTF8(group_info.visual_data.title());
}
tab_groups::TabGroupColorId
StructTraits<crosapi::mojom::TabGroupDataView, tab_groups::TabGroupInfo>::color(
const tab_groups::TabGroupInfo& group_info) {
return group_info.visual_data.color();
}
bool StructTraits<crosapi::mojom::TabGroupDataView, tab_groups::TabGroupInfo>::
is_collapsed(const tab_groups::TabGroupInfo& group_info) {
return group_info.visual_data.is_collapsed();
}
int32_t
StructTraits<crosapi::mojom::TabGroupDataView, tab_groups::TabGroupInfo>::
start_index(const tab_groups::TabGroupInfo& group_info) {
return group_info.tab_range.start();
}
int32_t
StructTraits<crosapi::mojom::TabGroupDataView, tab_groups::TabGroupInfo>::
tab_count(const tab_groups::TabGroupInfo& group_info) {
return group_info.tab_range.length();
}
bool StructTraits<crosapi::mojom::TabGroupDataView, tab_groups::TabGroupInfo>::
Read(crosapi::mojom::TabGroupDataView data,
tab_groups::TabGroupInfo* out_group) {
std::string data_title;
if (!data.ReadTitle(&data_title))
return false;
tab_groups::TabGroupColorId color_id;
if (!EnumTraits<tab_groups::mojom::Color,
tab_groups::TabGroupColorId>::FromMojom(data.color(),
&color_id)) {
return false;
}
out_group->tab_range =
gfx::Range(data.start_index(), data.start_index() + data.tab_count());
out_group->visual_data = tab_groups::TabGroupVisualData(
base::UTF8ToUTF16(data_title), color_id, data.is_collapsed());
return true;
}
} // namespace mojo

@ -1,31 +0,0 @@
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_CROSAPI_MOJOM_DESK_TEMPLATE_MOJOM_TRAITS_H_
#define CHROMEOS_CROSAPI_MOJOM_DESK_TEMPLATE_MOJOM_TRAITS_H_
#include "components/tab_groups/tab_group_color.h"
#include "components/tab_groups/tab_group_info.h"
#include "chromeos/crosapi/mojom/desk_template.mojom.h"
namespace mojo {
template <>
struct StructTraits<crosapi::mojom::TabGroupDataView,
tab_groups::TabGroupInfo> {
static std::string title(const tab_groups::TabGroupInfo& group_info);
static tab_groups::TabGroupColorId color(
const tab_groups::TabGroupInfo& group_info);
static bool is_collapsed(const tab_groups::TabGroupInfo& group_info);
static int32_t start_index(const tab_groups::TabGroupInfo& group_info);
static int32_t tab_count(const tab_groups::TabGroupInfo& tab_count);
static bool Read(crosapi::mojom::TabGroupDataView data,
tab_groups::TabGroupInfo* out_group);
};
} // namespace mojo
#endif // CHROMEOS_CROSAPI_MOJOM_DESK_TEMPLATE_MOJOM_TRAITS_H_