Commit 6b84d337 authored by nancylingwang's avatar nancylingwang Committed by Commit Bot

Remove the old icon loading mojom interfaces.

The ARC side has used the new icon request mojom interfaces, so the old
icon request mojom interfaces in the Chromium side can be removed.

BUG=1083331

Change-Id: I8421d58c035564ca6e9b944775bec85a11f4d5c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2346093Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarLong Cheng <lgcheng@google.com>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808974}
parent 10f895cf
......@@ -300,21 +300,8 @@ void ApkWebAppService::OnPackageInstalled(
// artifact. Install it.
auto* instance = ARC_GET_INSTANCE_FOR_METHOD(
arc_app_list_prefs_->app_connection_holder(), GetPackageIcon);
if (!instance) {
// TODO(crbug.com/1083331): Remove the RequestPackageIcon related code,
// when the ARC change is rolled in Chrome OS.
ARC_GET_INSTANCE_FOR_METHOD(arc_app_list_prefs_->app_connection_holder(),
RequestPackageIcon);
if (!instance)
return;
instance->RequestPackageIcon(
package_info.package_name, kDefaultIconSize, /*normalize=*/false,
base::BindOnce(
&ApkWebAppService::OnGetWebAppIcon, weak_ptr_factory_.GetWeakPtr(),
package_info.package_name, package_info.web_app_info.Clone()));
if (!instance)
return;
}
instance->GetPackageIcon(
package_info.package_name, kDefaultIconSize, /*normalize=*/false,
......@@ -452,16 +439,6 @@ void ApkWebAppService::OnWebAppUninstalled(const web_app::AppId& web_app_id) {
}
}
void ApkWebAppService::OnGetWebAppIcon(
const std::string& package_name,
arc::mojom::WebAppInfoPtr web_app_info,
const std::vector<uint8_t>& icon_png_data) {
arc::mojom::RawIconPngDataPtr icon = arc::mojom::RawIconPngData::New();
icon->is_adaptive_icon = false;
icon->icon_png_data = std::vector<uint8_t>(icon_png_data);
OnDidGetWebAppIcon(package_name, std::move(web_app_info), std::move(icon));
}
void ApkWebAppService::OnDidGetWebAppIcon(
const std::string& package_name,
arc::mojom::WebAppInfoPtr web_app_info,
......
......@@ -94,11 +94,6 @@ class ApkWebAppService : public KeyedService,
// web_app::AppRegistrarObserver overrides.
void OnWebAppUninstalled(const web_app::AppId& web_app_id) override;
// TODO(crbug.com/1083331): Remove this function, when the ARC change is
// rolled in Chrome OS.
void OnGetWebAppIcon(const std::string& package_name,
arc::mojom::WebAppInfoPtr web_app_info,
const std::vector<uint8_t>& icon_png_data);
void OnDidGetWebAppIcon(const std::string& package_name,
arc::mojom::WebAppInfoPtr web_app_info,
arc::mojom::RawIconPngDataPtr icon);
......
......@@ -556,41 +556,17 @@ void ArcAppListPrefs::SendIconRequest(const std::string& app_id,
if (app_info.icon_resource_id.empty()) {
auto* app_instance =
ARC_GET_INSTANCE_FOR_METHOD(app_connection_holder(), GetAppIcon);
if (!app_instance) {
// TODO(crbug.com/1083331): Remove the RequestAppIcon related change, when
// the ARC change is rolled in Chrome OS.
app_instance =
ARC_GET_INSTANCE_FOR_METHOD(app_connection_holder(), RequestAppIcon);
if (app_instance) {
auto callback =
base::BindOnce(&ArcAppListPrefs::OnGetIcon,
weak_ptr_factory_.GetWeakPtr(), app_id, descriptor);
app_instance->RequestAppIcon(app_info.package_name, app_info.activity,
descriptor.GetSizeInPixels(),
std::move(callback));
}
if (!app_instance)
return; // Error is logged in macro.
}
app_instance->GetAppIcon(app_info.package_name, app_info.activity,
descriptor.GetSizeInPixels(), std::move(callback));
} else {
auto* app_instance = ARC_GET_INSTANCE_FOR_METHOD(app_connection_holder(),
GetAppShortcutIcon);
if (!app_instance) {
// TODO(crbug.com/1083331): Remove the RequestAppIcon related change, when
// the ARC change is rolled in Chrome OS.
app_instance = ARC_GET_INSTANCE_FOR_METHOD(app_connection_holder(),
RequestShortcutIcon);
if (app_instance) {
auto callback =
base::BindOnce(&ArcAppListPrefs::OnGetIcon,
weak_ptr_factory_.GetWeakPtr(), app_id, descriptor);
app_instance->RequestAppIcon(app_info.package_name, app_info.activity,
descriptor.GetSizeInPixels(),
std::move(callback));
}
if (!app_instance)
return; // Error is logged in macro.
}
app_instance->GetAppShortcutIcon(app_info.icon_resource_id,
descriptor.GetSizeInPixels(),
std::move(callback));
......@@ -1673,18 +1649,6 @@ void ArcAppListPrefs::OnPackageRemoved(const std::string& package_name) {
observer.OnPackageRemoved(package_name, true);
}
void ArcAppListPrefs::OnGetIcon(const std::string& app_id,
const ArcAppIconDescriptor& descriptor,
const std::vector<uint8_t>& icon_png_data) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
arc::mojom::RawIconPngDataPtr icon = arc::mojom::RawIconPngData::New();
icon->is_adaptive_icon = false;
icon->icon_png_data =
std::vector<uint8_t>(icon_png_data.begin(), icon_png_data.end());
OnIcon(app_id, descriptor, std::move(icon));
}
void ArcAppListPrefs::OnIcon(const std::string& app_id,
const ArcAppIconDescriptor& descriptor,
arc::mojom::RawIconPngDataPtr icon) {
......
......@@ -396,11 +396,6 @@ class ArcAppListPrefs : public KeyedService,
void OnUninstallShortcut(const std::string& package_name,
const std::string& intent_uri) override;
void OnPackageRemoved(const std::string& package_name) override;
// TODO(crbug.com/1083331): Remove this function, when the ARC change is
// rolled in Chrome OS.
void OnGetIcon(const std::string& app_id,
const ArcAppIconDescriptor& descriptor,
const std::vector<uint8_t>& icon_png_data);
void OnIcon(const std::string& app_id,
const ArcAppIconDescriptor& descriptor,
arc::mojom::RawIconPngDataPtr icon);
......
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