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

Unified Diff: components/arc/intent_helper/activity_icon_loader.h

Issue 2034543003: Retry icon fetching after intent_helper is ready (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 7 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.h
diff --git a/components/arc/intent_helper/activity_icon_loader.h b/components/arc/intent_helper/activity_icon_loader.h
index 41d2ace9640a7a63f950b7199d965c3ce36fb3a2..75611ace67d19ed5c254596ae9d6641b553e2a86 100644
--- a/components/arc/intent_helper/activity_icon_loader.h
+++ b/components/arc/intent_helper/activity_icon_loader.h
@@ -44,6 +44,19 @@ class ActivityIconLoader : public base::RefCounted<ActivityIconLoader> {
std::string activity_name;
};
+ enum class GetResult {
+ // Succeeded. The callback will be called asynchronously.
+ SUCCEEDED_ASYNC,
+ // Succeeded. The callback has already been called synchronously.
+ SUCCEEDED_SYNC,
+ // Failed. The intent_helper instance is not yet ready. This is a temporary
+ // error.
+ FAILED_ARC_NOT_READY,
+ // Failed. Either ARC is not supported at all or intent_helper instance
+ // version is too old.
+ FAILED_ARC_NOT_SUPPORTED,
+ };
+
using ActivityToIconsMap = std::map<ActivityName, Icons>;
using OnIconsReadyCallback =
base::Callback<void(std::unique_ptr<ActivityToIconsMap>)>;
@@ -57,9 +70,8 @@ class ActivityIconLoader : public base::RefCounted<ActivityIconLoader> {
// back exactly once, either synchronously in the GetActivityIcons() when
// all icons were already cached locally, or asynchronously with icons fetched
// from ARC side.
- // Returns true in the former synchronous case, where everything is done.
- bool GetActivityIcons(const std::vector<ActivityName>& activities,
- const OnIconsReadyCallback& cb);
+ GetResult GetActivityIcons(const std::vector<ActivityName>& activities,
+ const OnIconsReadyCallback& cb);
void OnIconsResizedForTesting(const OnIconsReadyCallback& cb,
std::unique_ptr<ActivityToIconsMap> result);

Powered by Google App Engine
This is Rietveld 408576698