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

Unified Diff: components/arc/intent_helper/link_handler_model_impl.cc

Issue 2655233007: Get rid of RefCounted for ActivityIconLoader. (Closed)
Patch Set: 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
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..0844af9eb24f4174e9679cd0ac9ad9e5a71f3340 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,15 +96,18 @@ void LinkHandlerModelImpl::OnUrlHandlerList(
handlers_ = ArcIntentHelperBridge::FilterOutIntentHelper(std::move(handlers));
bool icon_info_notified = false;
- if (icon_loader_) {
+ auto* intent_helper_bridge =
+ ArcServiceManager::GetGlobalService<ArcIntentHelperBridge>();
+ if (intent_helper_bridge) {
std::vector<ActivityIconLoader::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()));
+ const ActivityIconLoader::GetResult result =
+ intent_helper_bridge->icon_loader()->GetActivityIcons(
+ activities, base::Bind(&LinkHandlerModelImpl::NotifyObserver,
+ weak_ptr_factory_.GetWeakPtr()));
icon_info_notified = ActivityIconLoader::HasIconsReadyCallbackRun(result);
}

Powered by Google App Engine
This is Rietveld 408576698