| OLD | NEW |
| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 ui::ScaleFactor scale_factor) const; | 192 ui::ScaleFactor scale_factor) const; |
| 193 // Constructs path to default app icon for specific scale factor. This path | 193 // Constructs path to default app icon for specific scale factor. This path |
| 194 // is used to resolve icon if no icon is available at |GetIconPath|. | 194 // is used to resolve icon if no icon is available at |GetIconPath|. |
| 195 base::FilePath MaybeGetIconPathForDefaultApp( | 195 base::FilePath MaybeGetIconPathForDefaultApp( |
| 196 const std::string& app_id, | 196 const std::string& app_id, |
| 197 ui::ScaleFactor scale_factor) const; | 197 ui::ScaleFactor scale_factor) const; |
| 198 | 198 |
| 199 // Sets last launched time for the requested app. | 199 // Sets last launched time for the requested app. |
| 200 void SetLastLaunchTime(const std::string& app_id, const base::Time& time); | 200 void SetLastLaunchTime(const std::string& app_id, const base::Time& time); |
| 201 | 201 |
| 202 // Requests to load an app icon for specific scale factor. If the app or Arc | 202 // Requests to load an app icon for specific scale factor. If the app or ARC |
| 203 // bridge service is not ready, then defer this request until the app gets | 203 // bridge service is not ready, then defer this request until the app gets |
| 204 // available. Once new icon is installed notifies an observer | 204 // available. Once new icon is installed notifies an observer |
| 205 // OnAppIconUpdated. | 205 // OnAppIconUpdated. |
| 206 void RequestIcon(const std::string& app_id, ui::ScaleFactor scale_factor); | 206 void RequestIcon(const std::string& app_id, ui::ScaleFactor scale_factor); |
| 207 | 207 |
| 208 // Sets notification enabled flag for given value. If the app or Arc bridge | 208 // Sets notification enabled flag for given value. If the app or ARC bridge |
| 209 // service is not ready, then defer this request until the app gets | 209 // service is not ready, then defer this request until the app gets |
| 210 // available. Once new value is set notifies an observer | 210 // available. Once new value is set notifies an observer |
| 211 // OnNotificationsEnabledChanged. | 211 // OnNotificationsEnabledChanged. |
| 212 void SetNotificationsEnabled(const std::string& app_id, bool enabled); | 212 void SetNotificationsEnabled(const std::string& app_id, bool enabled); |
| 213 | 213 |
| 214 // Returns true if app is registered. | 214 // Returns true if app is registered. |
| 215 bool IsRegistered(const std::string& app_id) const; | 215 bool IsRegistered(const std::string& app_id) const; |
| 216 // Returns true if app is a default app. | 216 // Returns true if app is a default app. |
| 217 bool IsDefault(const std::string& app_id) const; | 217 bool IsDefault(const std::string& app_id) const; |
| 218 // Returns true if app is an OEM app. | 218 // Returns true if app is an OEM app. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 void AddOrUpdatePackagePrefs(PrefService* prefs, | 322 void AddOrUpdatePackagePrefs(PrefService* prefs, |
| 323 const arc::mojom::ArcPackageInfo& package); | 323 const arc::mojom::ArcPackageInfo& package); |
| 324 // Removes given package from local pref. | 324 // Removes given package from local pref. |
| 325 void RemovePackageFromPrefs(PrefService* prefs, | 325 void RemovePackageFromPrefs(PrefService* prefs, |
| 326 const std::string& package_name); | 326 const std::string& package_name); |
| 327 | 327 |
| 328 void DisableAllApps(); | 328 void DisableAllApps(); |
| 329 void RemoveAllApps(); | 329 void RemoveAllApps(); |
| 330 std::vector<std::string> GetAppIdsNoArcEnabledCheck() const; | 330 std::vector<std::string> GetAppIdsNoArcEnabledCheck() const; |
| 331 // Enumerates apps from preferences and notifies listeners about available | 331 // Enumerates apps from preferences and notifies listeners about available |
| 332 // apps while Arc is not started yet. All apps in this case have disabled | 332 // apps while ARC is not started yet. All apps in this case have disabled |
| 333 // state. | 333 // state. |
| 334 void NotifyRegisteredApps(); | 334 void NotifyRegisteredApps(); |
| 335 base::Time GetInstallTime(const std::string& app_id) const; | 335 base::Time GetInstallTime(const std::string& app_id) const; |
| 336 | 336 |
| 337 // Installs an icon to file system in the special folder of the profile | 337 // Installs an icon to file system in the special folder of the profile |
| 338 // directory. | 338 // directory. |
| 339 void InstallIcon(const std::string& app_id, | 339 void InstallIcon(const std::string& app_id, |
| 340 ui::ScaleFactor scale_factor, | 340 ui::ScaleFactor scale_factor, |
| 341 const std::vector<uint8_t>& contentPng); | 341 const std::vector<uint8_t>& contentPng); |
| 342 void OnIconInstalled(const std::string& app_id, | 342 void OnIconInstalled(const std::string& app_id, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // Contains number of ARC packages that are currently installing. | 388 // Contains number of ARC packages that are currently installing. |
| 389 int installing_packages_count_ = 0; | 389 int installing_packages_count_ = 0; |
| 390 // Keeps deferred icon load requests. Each app may contain several requests | 390 // Keeps deferred icon load requests. Each app may contain several requests |
| 391 // for different scale factor. Scale factor is defined by specific bit | 391 // for different scale factor. Scale factor is defined by specific bit |
| 392 // position. | 392 // position. |
| 393 std::map<std::string, uint32_t> request_icon_deferred_; | 393 std::map<std::string, uint32_t> request_icon_deferred_; |
| 394 // True if this preference has been initialized once. | 394 // True if this preference has been initialized once. |
| 395 bool is_initialized_ = false; | 395 bool is_initialized_ = false; |
| 396 // True if apps were restored. | 396 // True if apps were restored. |
| 397 bool apps_restored_ = false; | 397 bool apps_restored_ = false; |
| 398 // True is Arc package list has been refreshed once. | 398 // True is ARC package list has been refreshed once. |
| 399 bool package_list_initial_refreshed_ = false; | 399 bool package_list_initial_refreshed_ = false; |
| 400 // Play Store does not have publicly available observers for default app | 400 // Play Store does not have publicly available observers for default app |
| 401 // installations. This timeout is for validating default app availability. | 401 // installations. This timeout is for validating default app availability. |
| 402 // Default apps should be either already installed or their installations | 402 // Default apps should be either already installed or their installations |
| 403 // should be started soon after initial app list refresh. | 403 // should be started soon after initial app list refresh. |
| 404 base::OneShotTimer detect_default_app_availability_timeout_; | 404 base::OneShotTimer detect_default_app_availability_timeout_; |
| 405 // Set of currently installing default apps_. | 405 // Set of currently installing default apps_. |
| 406 std::unordered_set<std::string> default_apps_installations_; | 406 std::unordered_set<std::string> default_apps_installations_; |
| 407 | 407 |
| 408 arc::ArcPackageSyncableService* sync_service_ = nullptr; | 408 arc::ArcPackageSyncableService* sync_service_ = nullptr; |
| 409 | 409 |
| 410 mojo::Binding<arc::mojom::AppHost> binding_; | 410 mojo::Binding<arc::mojom::AppHost> binding_; |
| 411 | 411 |
| 412 bool default_apps_ready_ = false; | 412 bool default_apps_ready_ = false; |
| 413 ArcDefaultAppList default_apps_; | 413 ArcDefaultAppList default_apps_; |
| 414 base::Closure default_apps_ready_callback_; | 414 base::Closure default_apps_ready_callback_; |
| 415 int last_shown_batch_installation_revision_ = -1; | 415 int last_shown_batch_installation_revision_ = -1; |
| 416 int current_batch_installation_revision_ = 0; | 416 int current_batch_installation_revision_ = 0; |
| 417 | 417 |
| 418 base::WeakPtrFactory<ArcAppListPrefs> weak_ptr_factory_; | 418 base::WeakPtrFactory<ArcAppListPrefs> weak_ptr_factory_; |
| 419 | 419 |
| 420 DISALLOW_COPY_AND_ASSIGN(ArcAppListPrefs); | 420 DISALLOW_COPY_AND_ASSIGN(ArcAppListPrefs); |
| 421 }; | 421 }; |
| 422 | 422 |
| 423 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ | 423 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ |
| OLD | NEW |