| 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..5d3be4f996f752ceca65d02803d9d66c4a0180d6 100644
|
| --- a/components/arc/intent_helper/arc_intent_helper_bridge.cc
|
| +++ b/components/arc/intent_helper/arc_intent_helper_bridge.cc
|
| @@ -12,6 +12,7 @@
|
| #include "ash/common/wallpaper/wallpaper_delegate.h"
|
| #include "ash/common/wm_shell.h"
|
| #include "ash/shell.h"
|
| +#include "base/command_line.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "components/arc/intent_helper/activity_icon_loader.h"
|
| #include "components/arc/intent_helper/link_handler_model_impl.h"
|
| @@ -126,6 +127,49 @@ ArcIntentHelperBridge::FilterOutIntentHelper(
|
| return handlers_filtered;
|
| }
|
|
|
| +// static
|
| +mojom::IntentHelperInstance*
|
| +ArcIntentHelperBridge::GetIntentHelperInstanceWithErrorCode(
|
| + int min_instance_version,
|
| + GetResult* out_error_code) {
|
| + ArcBridgeService* bridge_service = ArcBridgeService::Get();
|
| + if (!bridge_service) {
|
| + if (!ArcBridgeService::GetEnabled(base::CommandLine::ForCurrentProcess())) {
|
| + VLOG(2) << "ARC bridge is not supported.";
|
| + if (out_error_code)
|
| + *out_error_code = GetResult::FAILED_ARC_NOT_SUPPORTED;
|
| + } else {
|
| + VLOG(2) << "ARC bridge is not ready.";
|
| + if (out_error_code)
|
| + *out_error_code = GetResult::FAILED_ARC_NOT_READY;
|
| + }
|
| + 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;
|
| +}
|
| +
|
| +// static
|
| +mojom::IntentHelperInstance* ArcIntentHelperBridge::GetIntentHelperInstance(
|
| + int min_instance_version) {
|
| + return GetIntentHelperInstanceWithErrorCode(min_instance_version, nullptr);
|
| +}
|
| +
|
| void ArcIntentHelperBridge::OnIntentFiltersUpdated(
|
| mojo::Array<mojom::IntentFilterPtr> filters) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|