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

Unified Diff: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.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
Index: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
index e009095994cc86f4b8d982079104ba81c4b53592..fbe3db02dbf222585d133ea812f3ab5415079f9c 100644
--- a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
+++ b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
@@ -27,12 +27,6 @@ namespace arc {
namespace {
-scoped_refptr<ActivityIconLoader> GetIconLoader() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- ArcServiceManager* arc_service_manager = ArcServiceManager::Get();
- return arc_service_manager ? arc_service_manager->icon_loader() : nullptr;
-}
-
// Compares the host name of the referrer and target URL to decide whether
// the navigation needs to be overriden.
bool ShouldOverrideUrlLoading(const GURL& previous_url,
@@ -247,16 +241,17 @@ void ArcNavigationThrottle::OnAppCandidatesReceived(
if (IsSwapElementsNeeded(handlers, &indices))
std::swap(handlers[indices.first], handlers[indices.second]);
- scoped_refptr<ActivityIconLoader> icon_loader = GetIconLoader();
- if (!icon_loader) {
- LOG(ERROR) << "Cannot get an instance of ActivityIconLoader";
+ auto* intent_helper_bridge =
+ ArcServiceManager::GetGlobalService<ArcIntentHelperBridge>();
+ if (!intent_helper_bridge) {
+ LOG(ERROR) << "Cannot get an instance of ArcIntentHelperBridge";
navigation_handle()->Resume();
return;
}
- std::vector<ActivityIconLoader::ActivityName> activities;
+ std::vector<ArcIntentHelperBridge::ActivityName> activities;
for (const auto& handler : handlers)
activities.emplace_back(handler->package_name, handler->activity_name);
- icon_loader->GetActivityIcons(
+ intent_helper_bridge->GetActivityIcons(
activities,
base::Bind(&ArcNavigationThrottle::OnAppIconsReceived,
weak_ptr_factory_.GetWeakPtr(), base::Passed(&handlers)));
@@ -264,14 +259,14 @@ void ArcNavigationThrottle::OnAppCandidatesReceived(
void ArcNavigationThrottle::OnAppIconsReceived(
std::vector<mojom::IntentHandlerInfoPtr> handlers,
- std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons) {
+ std::unique_ptr<ArcIntentHelperBridge::ActivityToIconsMap> icons) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::vector<AppInfo> app_info;
for (const auto& handler : handlers) {
gfx::Image icon;
- const ActivityIconLoader::ActivityName activity(handler->package_name,
- handler->activity_name);
+ const ArcIntentHelperBridge::ActivityName activity(handler->package_name,
+ handler->activity_name);
const auto it = icons->find(activity);
app_info.emplace_back(

Powered by Google App Engine
This is Rietveld 408576698