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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 LOG(ERROR) << "AppPack downloaded extension " << id << " but got bad " | 471 LOG(ERROR) << "AppPack downloaded extension " << id << " but got bad " |
472 << "version: " << version; | 472 << "version: " << version; |
473 base::Delete(path, true /* recursive */); | 473 base::Delete(path, true /* recursive */); |
474 return; | 474 return; |
475 } | 475 } |
476 | 476 |
477 std::string basename = id + "-" + version + kCRXFileExtension; | 477 std::string basename = id + "-" + version + kCRXFileExtension; |
478 base::FilePath cache_dir(kAppPackCacheDir); | 478 base::FilePath cache_dir(kAppPackCacheDir); |
479 base::FilePath cached_crx_path = cache_dir.Append(basename); | 479 base::FilePath cached_crx_path = cache_dir.Append(basename); |
480 | 480 |
481 if (file_util::PathExists(cached_crx_path)) { | 481 if (base::PathExists(cached_crx_path)) { |
482 LOG(WARNING) << "AppPack downloaded a crx whose filename will overwrite " | 482 LOG(WARNING) << "AppPack downloaded a crx whose filename will overwrite " |
483 << "an existing cached crx."; | 483 << "an existing cached crx."; |
484 base::Delete(cached_crx_path, true /* recursive */); | 484 base::Delete(cached_crx_path, true /* recursive */); |
485 } | 485 } |
486 | 486 |
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!"; |
(...skipping 66 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 |