Index: components/arc/intent_helper/activity_icon_loader.cc |
diff --git a/components/arc/intent_helper/activity_icon_loader.cc b/components/arc/intent_helper/activity_icon_loader.cc |
index b0046a482a537f6373ce703747327a15adcfa1d5..bf135a5d3d8454a734fd0b0893423157dd531ca1 100644 |
--- a/components/arc/intent_helper/activity_icon_loader.cc |
+++ b/components/arc/intent_helper/activity_icon_loader.cc |
@@ -28,30 +28,6 @@ const size_t kMaxIconSizeInPx = 200; |
const int kMinInstanceVersion = 3; // see intent_helper.mojom |
-mojom::IntentHelperInstance* GetIntentHelperInstance( |
- ActivityIconLoader::GetResult* out_error_code) { |
- DCHECK(out_error_code); |
- ArcBridgeService* bridge_service = arc::ArcBridgeService::Get(); |
- if (!bridge_service) { |
- VLOG(2) << "ARC bridge is not ready."; |
- *out_error_code = ActivityIconLoader::GetResult::FAILED_ARC_NOT_SUPPORTED; |
- 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."; |
- *out_error_code = ActivityIconLoader::GetResult::FAILED_ARC_NOT_READY; |
- return nullptr; |
- } |
- if (bridge_service->intent_helper()->version() < kMinInstanceVersion) { |
- VLOG(1) << "ARC intent helper instance is too old."; |
- *out_error_code = ActivityIconLoader::GetResult::FAILED_ARC_NOT_SUPPORTED; |
- return nullptr; |
- } |
- return intent_helper_instance; |
-} |
- |
ui::ScaleFactor GetSupportedScaleFactor() { |
std::vector<ui::ScaleFactor> scale_factors = ui::GetSupportedScaleFactors(); |
DCHECK(!scale_factors.empty()); |
@@ -112,13 +88,21 @@ ActivityIconLoader::GetResult ActivityIconLoader::GetActivityIcons( |
return GetResult::SUCCEEDED_SYNC; |
} |
- GetResult error_code = GetResult::FAILED_ARC_NOT_SUPPORTED; |
- mojom::IntentHelperInstance* instance = GetIntentHelperInstance(&error_code); |
+ ArcIntentHelperBridge::GetResult error_code; |
+ mojom::IntentHelperInstance* instance = |
+ ArcIntentHelperBridge::GetIntentHelperInstanceWithErrorCode( |
+ kMinInstanceVersion, &error_code); |
if (!instance) { |
// The mojo channel is not yet ready (or not supported at all). Run the |
// callback with |result| that could be empty. |
cb.Run(std::move(result)); |
- return error_code; |
+ switch (error_code) { |
+ case ArcIntentHelperBridge::GetResult::FAILED_ARC_NOT_READY: |
+ return GetResult(GetResult::FAILED_ARC_NOT_READY); |
+ case ArcIntentHelperBridge::GetResult::FAILED_ARC_NOT_SUPPORTED: |
+ return GetResult(GetResult::FAILED_ARC_NOT_SUPPORTED); |
+ } |
+ NOTREACHED(); |
} |
// Fetch icons from ARC. |