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

Unified Diff: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc

Issue 2614173002: Use ARC_GET_INSTANCE_FOR_METHOD for getting intent_helper instance (Closed)
Patch Set: review 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 37683d8702f355970cf9a07df527d125da0f0100..e009095994cc86f4b8d982079104ba81c4b53592 100644
--- a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
+++ b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
@@ -27,10 +27,6 @@ namespace arc {
namespace {
-constexpr uint32_t kMinVersionForHandleUrl = 2;
-constexpr uint32_t kMinVersionForRequestUrlHandlerList = 2;
-constexpr uint32_t kMinVersionForAddPreferredPackage = 7;
-
scoped_refptr<ActivityIconLoader> GetIconLoader() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
ArcServiceManager* arc_service_manager = ArcServiceManager::Get();
@@ -182,7 +178,9 @@ ArcNavigationThrottle::HandleRequest() {
return content::NavigationThrottle::PROCEED;
ArcServiceManager* arc_service_manager = ArcServiceManager::Get();
- DCHECK(arc_service_manager);
+ if (!arc_service_manager)
+ return content::NavigationThrottle::PROCEED;
+
scoped_refptr<LocalActivityResolver> local_resolver =
arc_service_manager->activity_resolver();
if (local_resolver->ShouldChromeHandleUrl(url)) {
@@ -191,8 +189,9 @@ ArcNavigationThrottle::HandleRequest() {
return content::NavigationThrottle::PROCEED;
}
- auto* instance = ArcIntentHelperBridge::GetIntentHelperInstance(
- "RequestUrlHandlerList", kMinVersionForRequestUrlHandlerList);
+ auto* instance = ARC_GET_INSTANCE_FOR_METHOD(
+ arc_service_manager->arc_bridge_service()->intent_helper(),
+ RequestUrlHandlerList);
if (!instance)
return content::NavigationThrottle::PROCEED;
instance->RequestUrlHandlerList(
@@ -296,8 +295,13 @@ void ArcNavigationThrottle::OnIntentPickerClosed(
previous_user_action_ = close_reason;
// Make sure that the instance at least supports HandleUrl.
- auto* instance = ArcIntentHelperBridge::GetIntentHelperInstance(
- "HandleUrl", kMinVersionForHandleUrl);
+ auto* arc_service_manager = ArcServiceManager::Get();
+ mojom::IntentHelperInstance* instance = nullptr;
+ if (arc_service_manager) {
+ instance = ARC_GET_INSTANCE_FOR_METHOD(
+ arc_service_manager->arc_bridge_service()->intent_helper(), HandleUrl);
+ }
+
// Since we are selecting an app by its package name, we need to locate it
// on the |handlers| structure before sending the IPC to ARC.
const size_t selected_app_index = GetAppIndex(handlers, selected_app_package);
@@ -323,8 +327,10 @@ void ArcNavigationThrottle::OnIntentPickerClosed(
case CloseReason::ALWAYS_PRESSED: {
// Call AddPreferredPackage if it is supported. Reusing the same
// |instance| is okay.
- if (ArcIntentHelperBridge::GetIntentHelperInstance(
- "AddPreferredPackage", kMinVersionForAddPreferredPackage)) {
+ DCHECK(arc_service_manager);
+ if (ARC_GET_INSTANCE_FOR_METHOD(
+ arc_service_manager->arc_bridge_service()->intent_helper(),
+ AddPreferredPackage)) {
instance->AddPreferredPackage(
handlers[selected_app_index]->package_name);
}

Powered by Google App Engine
This is Rietveld 408576698