| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } else { | 532 } else { |
| 533 StartFileFetch(); | 533 StartFileFetch(); |
| 534 } | 534 } |
| 535 } | 535 } |
| 536 } | 536 } |
| 537 | 537 |
| 538 // static | 538 // static |
| 539 void ServicesCustomizationDocument::ReadFileInBackground( | 539 void ServicesCustomizationDocument::ReadFileInBackground( |
| 540 base::WeakPtr<ServicesCustomizationDocument> self, | 540 base::WeakPtr<ServicesCustomizationDocument> self, |
| 541 const base::FilePath& file) { | 541 const base::FilePath& file) { |
| 542 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 542 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 543 | 543 |
| 544 std::string manifest; | 544 std::string manifest; |
| 545 if (!base::ReadFileToString(file, &manifest)) { | 545 if (!base::ReadFileToString(file, &manifest)) { |
| 546 manifest.clear(); | 546 manifest.clear(); |
| 547 LOG(ERROR) << "Failed to load services customization manifest from: " | 547 LOG(ERROR) << "Failed to load services customization manifest from: " |
| 548 << file.value(); | 548 << file.value(); |
| 549 } | 549 } |
| 550 | 550 |
| 551 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 551 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 552 base::Bind(&ServicesCustomizationDocument::OnManifesteRead, | 552 base::Bind(&ServicesCustomizationDocument::OnManifesteRead, |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 base::Passed(applying.Pass())); | 867 base::Passed(applying.Pass())); |
| 868 if (!content::BrowserThread::PostBlockingPoolTaskAndReply( | 868 if (!content::BrowserThread::PostBlockingPoolTaskAndReply( |
| 869 FROM_HERE, check_file_exists, on_checked_closure)) { | 869 FROM_HERE, check_file_exists, on_checked_closure)) { |
| 870 LOG(WARNING) << "Failed to start check Wallpaper cache exists."; | 870 LOG(WARNING) << "Failed to start check Wallpaper cache exists."; |
| 871 } | 871 } |
| 872 } | 872 } |
| 873 | 873 |
| 874 void ServicesCustomizationDocument::OnCheckedWallpaperCacheExists( | 874 void ServicesCustomizationDocument::OnCheckedWallpaperCacheExists( |
| 875 scoped_ptr<bool> exists, | 875 scoped_ptr<bool> exists, |
| 876 scoped_ptr<ServicesCustomizationDocument::ApplyingTask> applying) { | 876 scoped_ptr<ServicesCustomizationDocument::ApplyingTask> applying) { |
| 877 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 877 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 878 DCHECK(exists); | 878 DCHECK(exists); |
| 879 DCHECK(applying); | 879 DCHECK(applying); |
| 880 | 880 |
| 881 ApplyWallpaper(*exists, applying.Pass()); | 881 ApplyWallpaper(*exists, applying.Pass()); |
| 882 } | 882 } |
| 883 | 883 |
| 884 void ServicesCustomizationDocument::ApplyWallpaper( | 884 void ServicesCustomizationDocument::ApplyWallpaper( |
| 885 bool default_wallpaper_file_exists, | 885 bool default_wallpaper_file_exists, |
| 886 scoped_ptr<ServicesCustomizationDocument::ApplyingTask> applying) { | 886 scoped_ptr<ServicesCustomizationDocument::ApplyingTask> applying) { |
| 887 GURL wallpaper_url; | 887 GURL wallpaper_url; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 apply_tasks_success_ += success; | 957 apply_tasks_success_ += success; |
| 958 | 958 |
| 959 if (apply_tasks_started_ != apply_tasks_finished_) | 959 if (apply_tasks_started_ != apply_tasks_finished_) |
| 960 return; | 960 return; |
| 961 | 961 |
| 962 if (apply_tasks_success_ == apply_tasks_finished_) | 962 if (apply_tasks_success_ == apply_tasks_finished_) |
| 963 SetApplied(true); | 963 SetApplied(true); |
| 964 } | 964 } |
| 965 | 965 |
| 966 } // namespace chromeos | 966 } // namespace chromeos |
| OLD | NEW |