Commit f58eed24 authored by Maggie Cai's avatar Maggie Cai Committed by Commit Bot

[IntentHandling] Get the icon url for app service file tasks.

This CL gets the icon urls for the file tasks queried from app service.

BUG=1092784

Test: Manually tested with files app.
Change-Id: I691f09ea9203a419c120caf9caa9d0d80ed22a94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2291562Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#787634}
parent 5247080a
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "chrome/browser/apps/app_service/app_icon_source.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/app_service/launch_utils.h" #include "chrome/browser/apps/app_service/launch_utils.h"
...@@ -80,7 +81,6 @@ void FindAppServiceTasks(Profile* profile, ...@@ -80,7 +81,6 @@ void FindAppServiceTasks(Profile* profile,
std::string task_action_id = std::string task_action_id =
entries.size() == 1 ? kActionIdSend : kActionIdSendMultiple; entries.size() == 1 ? kActionIdSend : kActionIdSendMultiple;
using extensions::api::file_manager_private::Verb; using extensions::api::file_manager_private::Verb;
// TODO(crbug/1092784): Get the icons.
// TODO(crbug/1092784): Support file open with in the future. // TODO(crbug/1092784): Support file open with in the future.
for (auto& app_id_and_activity : app_id_and_activities) { for (auto& app_id_and_activity : app_id_and_activities) {
apps::mojom::AppType app_type = apps::mojom::AppType app_type =
...@@ -90,10 +90,14 @@ void FindAppServiceTasks(Profile* profile, ...@@ -90,10 +90,14 @@ void FindAppServiceTasks(Profile* profile,
app_type == apps::mojom::AppType::kWeb)) { app_type == apps::mojom::AppType::kWeb)) {
continue; continue;
} }
constexpr int kIconSize = 32;
GURL icon_url =
apps::AppIconSource::GetIconURL(app_id_and_activity.app_id, kIconSize);
result_list->push_back(FullTaskDescriptor( result_list->push_back(FullTaskDescriptor(
TaskDescriptor(app_id_and_activity.app_id, GetTaskType(app_type), TaskDescriptor(app_id_and_activity.app_id, GetTaskType(app_type),
task_action_id), task_action_id),
app_id_and_activity.activity_name, Verb::VERB_SHARE_WITH, GURL(), app_id_and_activity.activity_name, Verb::VERB_SHARE_WITH, icon_url,
/* is_default=*/false, /* is_default=*/false,
/* is_generic=*/true, /* is_generic=*/true,
/* is_file_extension_match=*/false)); /* is_file_extension_match=*/false));
......
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