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

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_list_prefs.h

Issue 2749973002: arc: Fix Default icon issue when cached icon file is corrupted. (Closed)
Patch Set: Address Yury's comments. Created 3 years, 9 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: chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
index cc30435a60ca245da93194b22182ee5e2182b738..742dd5b94ddcdba5b1ce4b7e501fa0b246349ad2 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
+++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
@@ -199,11 +199,9 @@ class ArcAppListPrefs
// Sets last launched time for the requested app.
void SetLastLaunchTime(const std::string& app_id, const base::Time& time);
- // Requests to load an app icon for specific scale factor. If the app or ARC
- // bridge service is not ready, then defer this request until the app gets
- // available. Once new icon is installed notifies an observer
- // OnAppIconUpdated.
- void RequestIcon(const std::string& app_id, ui::ScaleFactor scale_factor);
+ // Calls RequestIcon is not request is recorded.
Luis Héctor Chávez 2017/03/15 20:28:51 nit: if no request is recorded?
xiyuan 2017/03/15 20:30:26 nit: not -> no ?
lgcheng 2017/03/15 22:05:34 Done.
+ void MaybeRequestIcon(const std::string& app_id,
+ ui::ScaleFactor scale_factor);
// Sets notification enabled flag for given value. If the app or ARC bridge
// service is not ready, then defer this request until the app gets
@@ -249,6 +247,7 @@ class ArcAppListPrefs
private:
friend class ChromeLauncherControllerImplTest;
+ friend class ArcAppModelBuilderTest;
// See the Create methods.
ArcAppListPrefs(
@@ -343,6 +342,12 @@ class ArcAppListPrefs
ui::ScaleFactor scale_factor,
bool install_succeed);
+ // Requests to load an app icon for specific scale factor. If the app or ARC
+ // bridge service is not ready, then defer this request until the app gets
+ // available. Once new icon is installed notifies an observer
+ // OnAppIconUpdated.
+ void RequestIcon(const std::string& app_id, ui::ScaleFactor scale_factor);
+
// This checks if app is not registered yet and in this case creates
// non-launchable app entry.
void MaybeAddNonLaunchableApp(const base::Optional<std::string>& name,
@@ -369,6 +374,14 @@ class ArcAppListPrefs
// some default app is not available yet.
void MaybeSetDefaultAppLoadingTimeout();
+ bool IsIconRequestRecorded(const std::string& app_id,
+ ui::ScaleFactor scale_factor) const;
+
+ // Remove the IconRequestRecord associated with app_id.
+ void MaybeRemoveIconRequestRecord(const std::string& app_id);
+
+ void ClearIconRequestRecord();
+
Profile* const profile_;
// Owned by the BrowserContext.
@@ -387,10 +400,15 @@ class ArcAppListPrefs
std::unordered_set<std::string> tracked_apps_;
// Contains number of ARC packages that are currently installing.
int installing_packages_count_ = 0;
- // Keeps deferred icon load requests. Each app may contain several requests
- // for different scale factor. Scale factor is defined by specific bit
- // position.
- std::map<std::string, uint32_t> request_icon_deferred_;
+ // Keeps record for icon request. Each app may contain several requests for
+ // different scale factor. Scale factor is defined by specific bit position.
+ // Mainly two usage:
Luis Héctor Chávez 2017/03/15 20:28:51 nit: usages
lgcheng 2017/03/15 22:05:34 Done.
+ // 1. Keeps deferred icon load requests when apps are not ready. Request will
+ // be sent when apps becomes ready.
+ // 2. Keeps record of icon request sent to Android. In each user session, one
+ // request per app per scale_factor is allowed once.
+ // When Arc is disabled or the app is uninstalled the record will be erased.
Luis Héctor Chávez 2017/03/15 20:28:51 nit: ARC. "uninstalled, the record"
lgcheng 2017/03/15 22:05:33 Done.
+ std::map<std::string, uint32_t> request_icon_recorded_;
// True if this preference has been initialized once.
bool is_initialized_ = false;
// True if apps were restored.

Powered by Google App Engine
This is Rietveld 408576698