Chromium Code Reviews| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 if (!file_util::DirectoryExists(dir)) { | 270 if (!file_util::DirectoryExists(dir)) { |
| 271 // Create it now. | 271 // Create it now. |
| 272 if (!file_util::CreateDirectory(dir)) | 272 if (!file_util::CreateDirectory(dir)) |
| 273 LOG(ERROR) << "Failed to create AppPack directory at " << dir.value(); | 273 LOG(ERROR) << "Failed to create AppPack directory at " << dir.value(); |
| 274 // Nothing else to do. | 274 // Nothing else to do. |
| 275 return; | 275 return; |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Enumerate all the files in the cache |dir|, including directories | 278 // Enumerate all the files in the cache |dir|, including directories |
| 279 // and symlinks. Each unrecognized file will be erased. | 279 // and symlinks. Each unrecognized file will be erased. |
| 280 FileEnumerator::FileType types = static_cast<FileEnumerator::FileType>( | 280 int types = |
| 281 FileEnumerator::FILES | FileEnumerator::DIRECTORIES | | 281 FileEnumerator::FILES | FileEnumerator::DIRECTORIES | |
|
jar (doing other things)
2012/08/06 18:27:02
nit: push one or more elements of line 281/282 ont
Haruki Sato
2012/08/06 23:22:18
Done.
| |
| 282 FileEnumerator::SHOW_SYM_LINKS); | 282 FileEnumerator::SHOW_SYM_LINKS; |
| 283 FileEnumerator enumerator(dir, false /* recursive */, types); | 283 FileEnumerator enumerator(dir, false /* recursive */, types); |
| 284 | 284 |
| 285 for (FilePath path = enumerator.Next(); | 285 for (FilePath path = enumerator.Next(); |
| 286 !path.empty(); path = enumerator.Next()) { | 286 !path.empty(); path = enumerator.Next()) { |
| 287 FileEnumerator::FindInfo info; | 287 FileEnumerator::FindInfo info; |
| 288 enumerator.GetFindInfo(&info); | 288 enumerator.GetFindInfo(&info); |
| 289 std::string basename = path.BaseName().value(); | 289 std::string basename = path.BaseName().value(); |
| 290 | 290 |
| 291 if (FileEnumerator::IsDirectory(info) || FileEnumerator::IsLink(info)) { | 291 if (FileEnumerator::IsDirectory(info) || FileEnumerator::IsLink(info)) { |
| 292 LOG(ERROR) << "Erasing bad file in AppPack directory: " << basename; | 292 LOG(ERROR) << "Erasing bad file in AppPack directory: " << basename; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 } | 587 } |
| 588 } | 588 } |
| 589 | 589 |
| 590 void AppPackUpdater::SetUpdateChecked(const std::string& id) { | 590 void AppPackUpdater::SetUpdateChecked(const std::string& id) { |
| 591 PolicyEntryMap::iterator entry = app_pack_extensions_.find(id); | 591 PolicyEntryMap::iterator entry = app_pack_extensions_.find(id); |
| 592 if (entry != app_pack_extensions_.end()) | 592 if (entry != app_pack_extensions_.end()) |
| 593 entry->second.update_checked = true; | 593 entry->second.update_checked = true; |
| 594 } | 594 } |
| 595 | 595 |
| 596 } // namespace policy | 596 } // namespace policy |
| OLD | NEW |