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

Unified Diff: components/arc/intent_helper/activity_icon_loader.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: 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 a0d74f5158f855bc8aced747ed7522e6e715c139..1996b2957809688eeca8f7831da9e7325170955a 100644
--- a/components/arc/intent_helper/activity_icon_loader.cc
+++ b/components/arc/intent_helper/activity_icon_loader.cc
@@ -28,14 +28,27 @@ constexpr size_t kLargeIconSizeInDip = 20;
constexpr size_t kMaxIconSizeInPx = 200;
constexpr char kPngDataUrlPrefix[] = "data:image/png;base64,";
-constexpr int kMinInstanceVersion = 3; // see intent_helper.mojom
-
ui::ScaleFactor GetSupportedScaleFactor() {
std::vector<ui::ScaleFactor> scale_factors = ui::GetSupportedScaleFactors();
DCHECK(!scale_factors.empty());
return scale_factors.back();
}
+// Returns an instance for calling RequestActivityIcons().
+mojom::IntentHelperInstance* GetInstance(
Luis Héctor Chávez 2017/01/06 23:46:28 Can we name this GetInstanceForRequestActivityIcon
Yusuke Sato 2017/01/07 00:25:14 Done.
+ ArcIntentHelperBridge::GetResult* out_error_code) {
+ if (!ArcIntentHelperBridge::IsIntentHelperAvailable(out_error_code))
+ return nullptr;
+ auto* instance = ARC_GET_INSTANCE_FOR_METHOD(
+ ArcServiceManager::Get()->arc_bridge_service()->intent_helper(),
+ RequestActivityIcons);
+ if (!instance && out_error_code) {
+ *out_error_code =
+ ArcIntentHelperBridge::GetResult::FAILED_ARC_NOT_SUPPORTED;
+ }
+ return instance;
+}
+
} // namespace
ActivityIconLoader::Icons::Icons(
@@ -97,8 +110,7 @@ ActivityIconLoader::GetResult ActivityIconLoader::GetActivityIcons(
}
ArcIntentHelperBridge::GetResult error_code;
- auto* instance = ArcIntentHelperBridge::GetIntentHelperInstanceWithErrorCode(
- "RequestActivityIcons", kMinInstanceVersion, &error_code);
+ auto* instance = GetInstance(&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.
« no previous file with comments | « chrome/browser/chromeos/file_manager/arc_file_tasks.cc ('k') | components/arc/intent_helper/arc_intent_helper_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698