Chromium Code Reviews| Index: components/arc/intent_helper/arc_intent_helper_bridge.cc |
| diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.cc b/components/arc/intent_helper/arc_intent_helper_bridge.cc |
| index b502d0cd32dd331fb667f9895b052ed5e9beb363..48744bd540f3d2a8ff71069e3cc6d09a8f462149 100644 |
| --- a/components/arc/intent_helper/arc_intent_helper_bridge.cc |
| +++ b/components/arc/intent_helper/arc_intent_helper_bridge.cc |
| @@ -126,6 +126,36 @@ ArcIntentHelperBridge::FilterOutIntentHelper( |
| return handlers_filtered; |
| } |
| +// static |
| +mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance( |
| + int min_instance_version, |
| + GetResult* out_error_code) { |
| + ArcBridgeService* bridge_service = ArcBridgeService::Get(); |
| + if (!bridge_service) { |
| + VLOG(2) << "ARC bridge is not ready."; |
| + if (out_error_code) |
| + *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; |
|
Luis Héctor Chávez
2016/09/14 20:28:49
Shouldn't this be FAILED_ARC_NOT_READY? Unless Arc
Yusuke Sato
2016/09/14 21:02:25
Good point, fixed. Done.
|
| + return nullptr; |
| + } |
| + mojom::IntentHelperInstance* intent_helper_instance = |
| + bridge_service->intent_helper()->instance(); |
| + if (!intent_helper_instance) { |
| + VLOG(2) << "ARC intent helper instance is not ready."; |
| + if (out_error_code) |
| + *out_error_code = GetResult::FAILED_ARC_NOT_READY; |
| + return nullptr; |
| + } |
| + const int version = bridge_service->intent_helper()->version(); |
| + if (version < min_instance_version) { |
| + VLOG(1) << "ARC intent helper instance is too old. required: " |
| + << min_instance_version << ", actual: " << version; |
| + if (out_error_code) |
| + *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; |
| + return nullptr; |
| + } |
| + return intent_helper_instance; |
| +} |
| + |
| void ArcIntentHelperBridge::OnIntentFiltersUpdated( |
| mojo::Array<mojom::IntentFilterPtr> filters) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |