OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/customization/customization_document.h" | 5 #include "chrome/browser/chromeos/customization/customization_document.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 std::unique_ptr<bool> exists(new bool(false)); | 859 std::unique_ptr<bool> exists(new bool(false)); |
860 | 860 |
861 base::Closure check_file_exists = | 861 base::Closure check_file_exists = |
862 base::Bind(&CheckWallpaperCacheExists, | 862 base::Bind(&CheckWallpaperCacheExists, |
863 GetCustomizedWallpaperDownloadedFileName(), | 863 GetCustomizedWallpaperDownloadedFileName(), |
864 base::Unretained(exists.get())); | 864 base::Unretained(exists.get())); |
865 base::Closure on_checked_closure = base::Bind( | 865 base::Closure on_checked_closure = base::Bind( |
866 &ServicesCustomizationDocument::OnCheckedWallpaperCacheExists, | 866 &ServicesCustomizationDocument::OnCheckedWallpaperCacheExists, |
867 weak_ptr_factory_.GetWeakPtr(), base::Passed(std::move(exists)), | 867 weak_ptr_factory_.GetWeakPtr(), base::Passed(std::move(exists)), |
868 base::Passed(std::move(applying))); | 868 base::Passed(std::move(applying))); |
869 base::PostTaskWithTraitsAndReply(FROM_HERE, | 869 base::PostTaskWithTraitsAndReply( |
870 base::TaskTraits().MayBlock().WithPriority( | 870 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
871 base::TaskPriority::BACKGROUND), | 871 check_file_exists, on_checked_closure); |
872 check_file_exists, on_checked_closure); | |
873 } | 872 } |
874 | 873 |
875 void ServicesCustomizationDocument::OnCheckedWallpaperCacheExists( | 874 void ServicesCustomizationDocument::OnCheckedWallpaperCacheExists( |
876 std::unique_ptr<bool> exists, | 875 std::unique_ptr<bool> exists, |
877 std::unique_ptr<ServicesCustomizationDocument::ApplyingTask> applying) { | 876 std::unique_ptr<ServicesCustomizationDocument::ApplyingTask> applying) { |
878 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 877 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
879 DCHECK(exists); | 878 DCHECK(exists); |
880 DCHECK(applying); | 879 DCHECK(applying); |
881 | 880 |
882 ApplyWallpaper(*exists, std::move(applying)); | 881 ApplyWallpaper(*exists, std::move(applying)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 apply_tasks_success_ += success; | 957 apply_tasks_success_ += success; |
959 | 958 |
960 if (apply_tasks_started_ != apply_tasks_finished_) | 959 if (apply_tasks_started_ != apply_tasks_finished_) |
961 return; | 960 return; |
962 | 961 |
963 if (apply_tasks_success_ == apply_tasks_finished_) | 962 if (apply_tasks_success_ == apply_tasks_finished_) |
964 SetApplied(true); | 963 SetApplied(true); |
965 } | 964 } |
966 | 965 |
967 } // namespace chromeos | 966 } // namespace chromeos |
OLD | NEW |