Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4633)

Unified Diff: chrome/browser/task_manager/providers/arc/arc_process_task.cc

Issue 2655233007: Get rid of RefCounted for ActivityIconLoader. (Closed)
Patch Set: address comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/task_manager/providers/arc/arc_process_task.h ('k') | components/arc/arc_service_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/task_manager/providers/arc/arc_process_task.cc
diff --git a/chrome/browser/task_manager/providers/arc/arc_process_task.cc b/chrome/browser/task_manager/providers/arc/arc_process_task.cc
index 6b32713dd621529b5140de183f99e6bec2c4a1bd..13070da2eff9df4c2d7bbaab8b6b98108e243914 100644
--- a/chrome/browser/task_manager/providers/arc/arc_process_task.cc
+++ b/chrome/browser/task_manager/providers/arc/arc_process_task.cc
@@ -12,6 +12,7 @@
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_service_manager.h"
#include "components/arc/common/process.mojom.h"
+#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/child_process_host.h"
#include "ui/base/l10n/l10n_util.h"
@@ -49,14 +50,6 @@ base::string16 MakeTitle(const std::string& process_name,
return title;
}
-scoped_refptr<arc::ActivityIconLoader> GetIconLoader() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- arc::ArcServiceManager* arc_service_manager = arc::ArcServiceManager::Get();
- if (!arc_service_manager)
- return nullptr;
- return arc_service_manager->icon_loader();
-}
-
// An activity name for retrieving the package's default icon without
// specifying an activity name.
constexpr char kEmptyActivityName[] = "";
@@ -88,22 +81,23 @@ ArcProcessTask::ArcProcessTask(base::ProcessId pid,
void ArcProcessTask::StartIconLoading() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_refptr<arc::ActivityIconLoader> icon_loader = GetIconLoader();
- arc::ActivityIconLoader::GetResult result =
- arc::ActivityIconLoader::GetResult::FAILED_ARC_NOT_READY;
- if (icon_loader) {
+ auto* intent_helper_bridge =
+ arc::ArcServiceManager::GetGlobalService<arc::ArcIntentHelperBridge>();
+ arc::ArcIntentHelperBridge::GetResult result =
+ arc::ArcIntentHelperBridge::GetResult::FAILED_ARC_NOT_READY;
+ if (intent_helper_bridge) {
// In some case, the package_name_ does not exists, it would be expected to
// get default process icon. For example, daemon processes in android
// container such like surfaceflinger, debuggerd or installd. Each of them
// would be shown on task manager but does not have a package name.
- std::vector<arc::ActivityIconLoader::ActivityName> activities = {
+ std::vector<arc::ArcIntentHelperBridge::ActivityName> activities = {
{package_name_, kEmptyActivityName}};
- result = icon_loader->GetActivityIcons(
+ result = intent_helper_bridge->GetActivityIcons(
activities, base::Bind(&ArcProcessTask::OnIconLoaded,
weak_ptr_factory_.GetWeakPtr()));
}
- if (result == arc::ActivityIconLoader::GetResult::FAILED_ARC_NOT_READY) {
+ if (result == arc::ArcIntentHelperBridge::GetResult::FAILED_ARC_NOT_READY) {
// Need to retry loading the icon.
arc::ArcServiceManager::Get()
->arc_bridge_service()
@@ -158,7 +152,7 @@ void ArcProcessTask::OnInstanceReady() {
// Instead of calling into StartIconLoading() directly, return to the main
// loop first to make sure other ArcBridgeService observers are notified.
- // Otherwise, arc::ActivityIconLoader::GetActivityIcon() may fail again.
+ // Otherwise, arc::ArcIntentHelperBridge::GetActivityIcon() may fail again.
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
base::Bind(&ArcProcessTask::StartIconLoading,
weak_ptr_factory_.GetWeakPtr()));
@@ -169,7 +163,7 @@ void ArcProcessTask::SetProcessState(arc::mojom::ProcessState process_state) {
}
void ArcProcessTask::OnIconLoaded(
- std::unique_ptr<arc::ActivityIconLoader::ActivityToIconsMap> icons) {
+ std::unique_ptr<arc::ArcIntentHelperBridge::ActivityToIconsMap> icons) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
for (const auto& kv : *icons) {
const gfx::Image& icon = kv.second.icon16;
« no previous file with comments | « chrome/browser/task_manager/providers/arc/arc_process_task.h ('k') | components/arc/arc_service_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698