| 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/policy/app_pack_updater.h" | 5 #include "chrome/browser/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/location.h" | 10 #include "base/location.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 int types = FileEnumerator::FILES | FileEnumerator::DIRECTORIES | | 280 int types = FileEnumerator::FILES | FileEnumerator::DIRECTORIES | |
| 281 FileEnumerator::SHOW_SYM_LINKS; | 281 FileEnumerator::SHOW_SYM_LINKS; |
| 282 FileEnumerator enumerator(dir, false /* recursive */, types); | 282 FileEnumerator enumerator(dir, false /* recursive */, types); |
| 283 | 283 |
| 284 for (FilePath path = enumerator.Next(); | 284 for (FilePath path = enumerator.Next(); |
| 285 !path.empty(); path = enumerator.Next()) { | 285 !path.empty(); path = enumerator.Next()) { |
| 286 FileEnumerator::FindInfo info; | 286 FileEnumerator::FindInfo info; |
| 287 enumerator.GetFindInfo(&info); | 287 enumerator.GetFindInfo(&info); |
| 288 std::string basename = path.BaseName().value(); | 288 std::string basename = path.BaseName().value(); |
| 289 | 289 |
| 290 if (FileEnumerator::IsDirectory(info) || FileEnumerator::IsLink(info)) { | 290 if (FileEnumerator::IsDirectory(info) || |
| 291 file_util::IsLink(FileEnumerator::GetFilename(info))) { |
| 291 LOG(ERROR) << "Erasing bad file in AppPack directory: " << basename; | 292 LOG(ERROR) << "Erasing bad file in AppPack directory: " << basename; |
| 292 file_util::Delete(path, true /* recursive */); | 293 file_util::Delete(path, true /* recursive */); |
| 293 continue; | 294 continue; |
| 294 } | 295 } |
| 295 | 296 |
| 296 // crx files in the cache are named <extension-id>-<version>.crx. | 297 // crx files in the cache are named <extension-id>-<version>.crx. |
| 297 std::string id; | 298 std::string id; |
| 298 std::string version; | 299 std::string version; |
| 299 | 300 |
| 300 if (EndsWith(basename, kCRXFileExtension, false /* case-sensitive */)) { | 301 if (EndsWith(basename, kCRXFileExtension, false /* case-sensitive */)) { |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 } | 587 } |
| 587 } | 588 } |
| 588 | 589 |
| 589 void AppPackUpdater::SetUpdateChecked(const std::string& id) { | 590 void AppPackUpdater::SetUpdateChecked(const std::string& id) { |
| 590 PolicyEntryMap::iterator entry = app_pack_extensions_.find(id); | 591 PolicyEntryMap::iterator entry = app_pack_extensions_.find(id); |
| 591 if (entry != app_pack_extensions_.end()) | 592 if (entry != app_pack_extensions_.end()) |
| 592 entry->second.update_checked = true; | 593 entry->second.update_checked = true; |
| 593 } | 594 } |
| 594 | 595 |
| 595 } // namespace policy | 596 } // namespace policy |
| OLD | NEW |