OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extensions/external_cache.h" | 5 #include "chrome/browser/chromeos/extensions/external_cache.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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // Enumerate all the files in the cache |cache_dir|, including directories | 302 // Enumerate all the files in the cache |cache_dir|, including directories |
303 // and symlinks. Each unrecognized file will be erased. | 303 // and symlinks. Each unrecognized file will be erased. |
304 int types = base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES | | 304 int types = base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES | |
305 base::FileEnumerator::SHOW_SYM_LINKS; | 305 base::FileEnumerator::SHOW_SYM_LINKS; |
306 base::FileEnumerator enumerator(cache_dir, false /* recursive */, types); | 306 base::FileEnumerator enumerator(cache_dir, false /* recursive */, types); |
307 for (base::FilePath path = enumerator.Next(); | 307 for (base::FilePath path = enumerator.Next(); |
308 !path.empty(); path = enumerator.Next()) { | 308 !path.empty(); path = enumerator.Next()) { |
309 base::FileEnumerator::FileInfo info = enumerator.GetInfo(); | 309 base::FileEnumerator::FileInfo info = enumerator.GetInfo(); |
310 std::string basename = path.BaseName().value(); | 310 std::string basename = path.BaseName().value(); |
311 | 311 |
312 if (info.IsDirectory() || file_util::IsLink(info.GetName())) { | 312 if (info.IsDirectory() || base::IsLink(info.GetName())) { |
313 LOG(ERROR) << "Erasing bad file in ExternalCache directory: " << basename; | 313 LOG(ERROR) << "Erasing bad file in ExternalCache directory: " << basename; |
314 base::DeleteFile(path, true /* recursive */); | 314 base::DeleteFile(path, true /* recursive */); |
315 continue; | 315 continue; |
316 } | 316 } |
317 | 317 |
318 // Skip flag file that indicates that cache is ready. | 318 // Skip flag file that indicates that cache is ready. |
319 if (basename == kCacheReadyFlagFileName) | 319 if (basename == kCacheReadyFlagFileName) |
320 continue; | 320 continue; |
321 | 321 |
322 // crx files in the cache are named <extension-id>-<version>.crx. | 322 // crx files in the cache are named <extension-id>-<version>.crx. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 FROM_HERE, | 554 FROM_HERE, |
555 callback); | 555 callback); |
556 } | 556 } |
557 | 557 |
558 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( | 558 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( |
559 const std::string& id) { | 559 const std::string& id) { |
560 return std::string(); | 560 return std::string(); |
561 } | 561 } |
562 | 562 |
563 } // namespace chromeos | 563 } // namespace chromeos |
OLD | NEW |