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 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 const bool removed = apps->Remove(app_id, nullptr); | 899 const bool removed = apps->Remove(app_id, nullptr); |
900 DCHECK(removed); | 900 DCHECK(removed); |
901 | 901 |
902 DCHECK(tracked_apps_.count(app_id)); | 902 DCHECK(tracked_apps_.count(app_id)); |
903 for (auto& observer : observer_list_) | 903 for (auto& observer : observer_list_) |
904 observer.OnAppRemoved(app_id); | 904 observer.OnAppRemoved(app_id); |
905 tracked_apps_.erase(app_id); | 905 tracked_apps_.erase(app_id); |
906 | 906 |
907 // Remove local data on file system. | 907 // Remove local data on file system. |
908 base::PostTaskWithTraits( | 908 base::PostTaskWithTraits( |
909 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 909 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
910 base::TaskPriority::BACKGROUND), | |
911 base::Bind(&DeleteAppFolderFromFileThread, app_path)); | 910 base::Bind(&DeleteAppFolderFromFileThread, app_path)); |
912 } | 911 } |
913 | 912 |
914 void ArcAppListPrefs::AddOrUpdatePackagePrefs( | 913 void ArcAppListPrefs::AddOrUpdatePackagePrefs( |
915 PrefService* prefs, const arc::mojom::ArcPackageInfo& package) { | 914 PrefService* prefs, const arc::mojom::ArcPackageInfo& package) { |
916 DCHECK(IsArcAndroidEnabledForProfile(profile_)); | 915 DCHECK(IsArcAndroidEnabledForProfile(profile_)); |
917 const std::string& package_name = package.package_name; | 916 const std::string& package_name = package.package_name; |
918 default_apps_.MaybeMarkPackageUninstalled(package_name, false); | 917 default_apps_.MaybeMarkPackageUninstalled(package_name, false); |
919 if (package_name.empty()) { | 918 if (package_name.empty()) { |
920 VLOG(2) << "Package name cannot be empty."; | 919 VLOG(2) << "Package name cannot be empty."; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 if (!base::StringToInt64(install_time_str, &install_time_i64)) | 1338 if (!base::StringToInt64(install_time_str, &install_time_i64)) |
1340 return base::Time(); | 1339 return base::Time(); |
1341 return base::Time::FromInternalValue(install_time_i64); | 1340 return base::Time::FromInternalValue(install_time_i64); |
1342 } | 1341 } |
1343 | 1342 |
1344 void ArcAppListPrefs::InstallIcon(const std::string& app_id, | 1343 void ArcAppListPrefs::InstallIcon(const std::string& app_id, |
1345 ui::ScaleFactor scale_factor, | 1344 ui::ScaleFactor scale_factor, |
1346 const std::vector<uint8_t>& content_png) { | 1345 const std::vector<uint8_t>& content_png) { |
1347 base::FilePath icon_path = GetIconPath(app_id, scale_factor); | 1346 base::FilePath icon_path = GetIconPath(app_id, scale_factor); |
1348 base::PostTaskWithTraitsAndReplyWithResult( | 1347 base::PostTaskWithTraitsAndReplyWithResult( |
1349 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 1348 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
1350 base::TaskPriority::BACKGROUND), | |
1351 base::Bind(&InstallIconFromFileThread, app_id, scale_factor, icon_path, | 1349 base::Bind(&InstallIconFromFileThread, app_id, scale_factor, icon_path, |
1352 content_png), | 1350 content_png), |
1353 base::Bind(&ArcAppListPrefs::OnIconInstalled, | 1351 base::Bind(&ArcAppListPrefs::OnIconInstalled, |
1354 weak_ptr_factory_.GetWeakPtr(), app_id, scale_factor)); | 1352 weak_ptr_factory_.GetWeakPtr(), app_id, scale_factor)); |
1355 } | 1353 } |
1356 | 1354 |
1357 void ArcAppListPrefs::OnIconInstalled(const std::string& app_id, | 1355 void ArcAppListPrefs::OnIconInstalled(const std::string& app_id, |
1358 ui::ScaleFactor scale_factor, | 1356 ui::ScaleFactor scale_factor, |
1359 bool install_succeed) { | 1357 bool install_succeed) { |
1360 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 1358 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 int64_t last_backup_android_id, | 1434 int64_t last_backup_android_id, |
1437 int64_t last_backup_time, | 1435 int64_t last_backup_time, |
1438 bool should_sync, | 1436 bool should_sync, |
1439 bool system) | 1437 bool system) |
1440 : package_name(package_name), | 1438 : package_name(package_name), |
1441 package_version(package_version), | 1439 package_version(package_version), |
1442 last_backup_android_id(last_backup_android_id), | 1440 last_backup_android_id(last_backup_android_id), |
1443 last_backup_time(last_backup_time), | 1441 last_backup_time(last_backup_time), |
1444 should_sync(should_sync), | 1442 should_sync(should_sync), |
1445 system(system) {} | 1443 system(system) {} |
OLD | NEW |