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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_
6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return app_instance_holder_; 237 return app_instance_holder_;
238 } 238 }
239 239
240 bool package_list_initial_refreshed() const { 240 bool package_list_initial_refreshed() const {
241 return package_list_initial_refreshed_; 241 return package_list_initial_refreshed_;
242 } 242 }
243 243
244 std::unordered_set<std::string> GetAppsForPackage( 244 std::unordered_set<std::string> GetAppsForPackage(
245 const std::string& package_name) const; 245 const std::string& package_name) const;
246 246
247 bool IsIconRequestRecorded(const std::string& app_id,
khmel 2017/03/15 01:16:56 nit: as commented above please move this to privat
lgcheng 2017/03/15 19:59:31 Done.
248 ui::ScaleFactor scale_factor) const;
249
247 void SetDefaltAppsReadyCallback(base::Closure callback); 250 void SetDefaltAppsReadyCallback(base::Closure callback);
248 void SimulateDefaultAppAvailabilityTimeoutForTesting(); 251 void SimulateDefaultAppAvailabilityTimeoutForTesting();
249 252
250 private: 253 private:
251 friend class ChromeLauncherControllerImplTest; 254 friend class ChromeLauncherControllerImplTest;
255 friend class ArcAppModelBuilderTest;
252 256
253 // See the Create methods. 257 // See the Create methods.
254 ArcAppListPrefs( 258 ArcAppListPrefs(
255 Profile* profile, 259 Profile* profile,
256 arc::InstanceHolder<arc::mojom::AppInstance>* app_instance_holder); 260 arc::InstanceHolder<arc::mojom::AppInstance>* app_instance_holder);
257 261
258 // arc::InstanceHolder<arc::mojom::AppInstance>::Observer: 262 // arc::InstanceHolder<arc::mojom::AppInstance>::Observer:
259 void OnInstanceReady() override; 263 void OnInstanceReady() override;
260 void OnInstanceClosed() override; 264 void OnInstanceClosed() override;
261 265
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // Detects that default apps either exist or installation session is started. 366 // Detects that default apps either exist or installation session is started.
363 void DetectDefaultAppAvailability(); 367 void DetectDefaultAppAvailability();
364 368
365 // Performs data clean up for removed package. 369 // Performs data clean up for removed package.
366 void HandlePackageRemoved(const std::string& package_name); 370 void HandlePackageRemoved(const std::string& package_name);
367 371
368 // Sets timeout to wait for default app installed or installation started if 372 // Sets timeout to wait for default app installed or installation started if
369 // some default app is not available yet. 373 // some default app is not available yet.
370 void MaybeSetDefaultAppLoadingTimeout(); 374 void MaybeSetDefaultAppLoadingTimeout();
371 375
376 // Remove the IconRequestRecord associated with app_id.
377 void MaybeRemoveIconRequestRecord(const std::string& app_id);
378
379 void ClearIconRequestRecord();
380
372 Profile* const profile_; 381 Profile* const profile_;
373 382
374 // Owned by the BrowserContext. 383 // Owned by the BrowserContext.
375 PrefService* const prefs_; 384 PrefService* const prefs_;
376 385
377 arc::InstanceHolder<arc::mojom::AppInstance>* const app_instance_holder_; 386 arc::InstanceHolder<arc::mojom::AppInstance>* const app_instance_holder_;
378 387
379 // List of observers. 388 // List of observers.
380 base::ObserverList<Observer> observer_list_; 389 base::ObserverList<Observer> observer_list_;
381 // Keeps root folder where ARC app icons for different scale factor are 390 // Keeps root folder where ARC app icons for different scale factor are
382 // stored. 391 // stored.
383 base::FilePath base_path_; 392 base::FilePath base_path_;
384 // Contains set of ARC apps that are currently ready. 393 // Contains set of ARC apps that are currently ready.
385 std::unordered_set<std::string> ready_apps_; 394 std::unordered_set<std::string> ready_apps_;
386 // Contains set of ARC apps that are currently tracked. 395 // Contains set of ARC apps that are currently tracked.
387 std::unordered_set<std::string> tracked_apps_; 396 std::unordered_set<std::string> tracked_apps_;
388 // Contains number of ARC packages that are currently installing. 397 // Contains number of ARC packages that are currently installing.
389 int installing_packages_count_ = 0; 398 int installing_packages_count_ = 0;
390 // Keeps deferred icon load requests. Each app may contain several requests 399 // Keeps deferred icon load requests. Each app may contain several requests
391 // for different scale factor. Scale factor is defined by specific bit 400 // for different scale factor. Scale factor is defined by specific bit
392 // position. 401 // position.
393 std::map<std::string, uint32_t> request_icon_deferred_; 402 std::map<std::string, uint32_t> request_icon_deferred_;
403 // Keeps record of icon request sent to Android. In each user session, one
404 // request per app per scale_factor is allowed once. Arc is disabled or the
405 // app is uninstalled the record will be erased.
406 std::map<std::string, uint32_t> request_icon_record_;
khmel 2017/03/15 01:16:56 Can we use request_icon_deferred_ for this purpose
lgcheng 2017/03/15 19:59:31 Done.
394 // True if this preference has been initialized once. 407 // True if this preference has been initialized once.
395 bool is_initialized_ = false; 408 bool is_initialized_ = false;
396 // True if apps were restored. 409 // True if apps were restored.
397 bool apps_restored_ = false; 410 bool apps_restored_ = false;
398 // True is ARC package list has been refreshed once. 411 // True is ARC package list has been refreshed once.
399 bool package_list_initial_refreshed_ = false; 412 bool package_list_initial_refreshed_ = false;
400 // Play Store does not have publicly available observers for default app 413 // Play Store does not have publicly available observers for default app
401 // installations. This timeout is for validating default app availability. 414 // installations. This timeout is for validating default app availability.
402 // Default apps should be either already installed or their installations 415 // Default apps should be either already installed or their installations
403 // should be started soon after initial app list refresh. 416 // should be started soon after initial app list refresh.
(...skipping 10 matching lines...) Expand all
414 base::Closure default_apps_ready_callback_; 427 base::Closure default_apps_ready_callback_;
415 int last_shown_batch_installation_revision_ = -1; 428 int last_shown_batch_installation_revision_ = -1;
416 int current_batch_installation_revision_ = 0; 429 int current_batch_installation_revision_ = 0;
417 430
418 base::WeakPtrFactory<ArcAppListPrefs> weak_ptr_factory_; 431 base::WeakPtrFactory<ArcAppListPrefs> weak_ptr_factory_;
419 432
420 DISALLOW_COPY_AND_ASSIGN(ArcAppListPrefs); 433 DISALLOW_COPY_AND_ASSIGN(ArcAppListPrefs);
421 }; 434 };
422 435
423 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ 436 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698