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/policy/app_pack_updater.h" | 5 #include "chrome/browser/chromeos/policy/app_pack_updater.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 if (!file_util::DirectoryExists(cache_dir)) { | 487 if (!file_util::DirectoryExists(cache_dir)) { |
488 LOG(ERROR) << "AppPack cache directory does not exist, creating now: " | 488 LOG(ERROR) << "AppPack cache directory does not exist, creating now: " |
489 << cache_dir.value(); | 489 << cache_dir.value(); |
490 if (!file_util::CreateDirectory(cache_dir)) { | 490 if (!file_util::CreateDirectory(cache_dir)) { |
491 LOG(ERROR) << "Failed to create the AppPack cache dir!"; | 491 LOG(ERROR) << "Failed to create the AppPack cache dir!"; |
492 base::Delete(path, true /* recursive */); | 492 base::Delete(path, true /* recursive */); |
493 return; | 493 return; |
494 } | 494 } |
495 } | 495 } |
496 | 496 |
497 if (!file_util::Move(path, cached_crx_path)) { | 497 if (!base::Move(path, cached_crx_path)) { |
498 LOG(ERROR) << "Failed to move AppPack crx from " << path.value() | 498 LOG(ERROR) << "Failed to move AppPack crx from " << path.value() |
499 << " to " << cached_crx_path.value(); | 499 << " to " << cached_crx_path.value(); |
500 base::Delete(path, true /* recursive */); | 500 base::Delete(path, true /* recursive */); |
501 return; | 501 return; |
502 } | 502 } |
503 | 503 |
504 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 504 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
505 base::Bind(&AppPackUpdater::OnCacheEntryInstalled, | 505 base::Bind(&AppPackUpdater::OnCacheEntryInstalled, |
506 app_pack_updater, | 506 app_pack_updater, |
507 std::string(id), | 507 std::string(id), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 void AppPackUpdater::SetScreenSaverPath(const base::FilePath& path) { | 558 void AppPackUpdater::SetScreenSaverPath(const base::FilePath& path) { |
559 // Don't invoke the callback if the path isn't changing. | 559 // Don't invoke the callback if the path isn't changing. |
560 if (path != screen_saver_path_) { | 560 if (path != screen_saver_path_) { |
561 screen_saver_path_ = path; | 561 screen_saver_path_ = path; |
562 if (!screen_saver_update_callback_.is_null()) | 562 if (!screen_saver_update_callback_.is_null()) |
563 screen_saver_update_callback_.Run(screen_saver_path_); | 563 screen_saver_update_callback_.Run(screen_saver_path_); |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 } // namespace policy | 567 } // namespace policy |
OLD | NEW |