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

Unified Diff: components/arc/intent_helper/link_handler_model_impl.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 | « components/arc/intent_helper/link_handler_model_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/intent_helper/link_handler_model_impl.cc
diff --git a/components/arc/intent_helper/link_handler_model_impl.cc b/components/arc/intent_helper/link_handler_model_impl.cc
index 19485e179ffcf22ad22dc6a749b21fe923c4227b..b4c7c7d6bcb9f0b79dddafeb4751ad59b64361d4 100644
--- a/components/arc/intent_helper/link_handler_model_impl.cc
+++ b/components/arc/intent_helper/link_handler_model_impl.cc
@@ -12,7 +12,6 @@
#include "components/arc/arc_service_manager.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "components/google/core/browser/google_util.h"
-#include "url/gurl.h"
#include "url/url_util.h"
namespace arc {
@@ -48,11 +47,9 @@ bool GetQueryValue(const GURL& url,
} // namespace
-LinkHandlerModelImpl::LinkHandlerModelImpl(
- scoped_refptr<ActivityIconLoader> icon_loader)
- : icon_loader_(icon_loader), weak_ptr_factory_(this) {}
+LinkHandlerModelImpl::LinkHandlerModelImpl() : weak_ptr_factory_(this) {}
-LinkHandlerModelImpl::~LinkHandlerModelImpl() {}
+LinkHandlerModelImpl::~LinkHandlerModelImpl() = default;
bool LinkHandlerModelImpl::Init(const GURL& url) {
auto* arc_service_manager = ArcServiceManager::Get();
@@ -99,16 +96,20 @@ void LinkHandlerModelImpl::OnUrlHandlerList(
handlers_ = ArcIntentHelperBridge::FilterOutIntentHelper(std::move(handlers));
bool icon_info_notified = false;
- if (icon_loader_) {
- std::vector<ActivityIconLoader::ActivityName> activities;
+ auto* intent_helper_bridge =
+ ArcServiceManager::GetGlobalService<ArcIntentHelperBridge>();
+ if (intent_helper_bridge) {
+ std::vector<ArcIntentHelperBridge::ActivityName> activities;
for (size_t i = 0; i < handlers_.size(); ++i) {
activities.emplace_back(handlers_[i]->package_name,
handlers_[i]->activity_name);
}
- const ActivityIconLoader::GetResult result = icon_loader_->GetActivityIcons(
- activities, base::Bind(&LinkHandlerModelImpl::NotifyObserver,
- weak_ptr_factory_.GetWeakPtr()));
- icon_info_notified = ActivityIconLoader::HasIconsReadyCallbackRun(result);
+ const ArcIntentHelperBridge::GetResult result =
+ intent_helper_bridge->GetActivityIcons(
+ activities, base::Bind(&LinkHandlerModelImpl::NotifyObserver,
+ weak_ptr_factory_.GetWeakPtr()));
+ icon_info_notified =
+ internal::ActivityIconLoader::HasIconsReadyCallbackRun(result);
}
if (!icon_info_notified) {
@@ -120,7 +121,7 @@ void LinkHandlerModelImpl::OnUrlHandlerList(
}
void LinkHandlerModelImpl::NotifyObserver(
- std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons) {
+ std::unique_ptr<ArcIntentHelperBridge::ActivityToIconsMap> icons) {
if (icons) {
icons_.insert(icons->begin(), icons->end());
icons.reset();
@@ -129,7 +130,7 @@ void LinkHandlerModelImpl::NotifyObserver(
std::vector<ash::LinkHandlerInfo> handlers;
for (size_t i = 0; i < handlers_.size(); ++i) {
gfx::Image icon;
- const ActivityIconLoader::ActivityName activity(
+ const ArcIntentHelperBridge::ActivityName activity(
handlers_[i]->package_name, handlers_[i]->activity_name);
const auto it = icons_.find(activity);
if (it != icons_.end())
« no previous file with comments | « components/arc/intent_helper/link_handler_model_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698