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

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_utils.cc

Issue 2347293002: arc: Add InstanceHelper::GetInstanceForMethod() (Closed)
Patch Set: git cl format/lint Created 4 years, 3 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/ui/app_list/arc/arc_app_utils.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.cc b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
index 1589e30f076388ace68bb5a580d978c085ea8c8d..3e401b237edc00298c4828dc1815174c145f57c2 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
@@ -60,21 +60,8 @@ arc::mojom::AppInstance* GetAppInstance(int required_version,
return nullptr;
}
- arc::mojom::AppInstance* app_instance = bridge_service->app()->instance();
- if (!app_instance) {
- VLOG(2) << "Request to " << service_name
- << " when mojom::app_instance is not ready.";
- return nullptr;
- }
-
- int bridge_version = bridge_service->app()->version();
- if (bridge_version < required_version) {
- VLOG(2) << "Request to " << service_name << " when Arc version "
- << bridge_version << " does not support it.";
- return nullptr;
- }
-
- return app_instance;
+ return bridge_service->app()->GetInstanceForVersion(required_version,
+ service_name.c_str());
}
void PrioritizeArcInstanceCallback(bool success) {
@@ -304,16 +291,11 @@ void ShowTalkBackSettings() {
return;
}
- arc::mojom::IntentHelperInstance *intent_helper_instance =
- bridge_service->intent_helper()->instance();
- if (!intent_helper_instance) {
- VLOG(2) << "ARC intent helper instance is not ready";
+ auto* intent_helper_instance =
+ bridge_service->intent_helper()->GetInstanceForVersion(
+ kSendBroadcastMinVersion, "SendBroadcast");
+ if (!intent_helper_instance)
return;
- }
- if (bridge_service->intent_helper()->version() < kSendBroadcastMinVersion) {
- VLOG(2) << "ARC intent helper instance is too old";
- return;
- }
intent_helper_instance->SendBroadcast(
"org.chromium.arc.intent_helper.SHOW_TALKBACK_SETTINGS",

Powered by Google App Engine
This is Rietveld 408576698