OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/updater/local_extension_cache.h" | 5 #include "chrome/browser/extensions/updater/local_extension_cache.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 weak_ptr_factory_.GetWeakPtr(), | 299 weak_ptr_factory_.GetWeakPtr(), |
300 cache_dir_, | 300 cache_dir_, |
301 callback)); | 301 callback)); |
302 } | 302 } |
303 | 303 |
304 // static | 304 // static |
305 void LocalExtensionCache::BackendCheckCacheContents( | 305 void LocalExtensionCache::BackendCheckCacheContents( |
306 base::WeakPtr<LocalExtensionCache> local_cache, | 306 base::WeakPtr<LocalExtensionCache> local_cache, |
307 const base::FilePath& cache_dir, | 307 const base::FilePath& cache_dir, |
308 const base::Closure& callback) { | 308 const base::Closure& callback) { |
309 scoped_ptr<CacheMap> cache_content(new CacheMap); | 309 std::unique_ptr<CacheMap> cache_content(new CacheMap); |
310 BackendCheckCacheContentsInternal(cache_dir, cache_content.get()); | 310 BackendCheckCacheContentsInternal(cache_dir, cache_content.get()); |
311 content::BrowserThread::PostTask( | 311 content::BrowserThread::PostTask( |
312 content::BrowserThread::UI, | 312 content::BrowserThread::UI, |
313 FROM_HERE, | 313 FROM_HERE, |
314 base::Bind(&LocalExtensionCache::OnCacheContentsChecked, | 314 base::Bind(&LocalExtensionCache::OnCacheContentsChecked, |
315 local_cache, | 315 local_cache, |
316 base::Passed(&cache_content), | 316 base::Passed(&cache_content), |
317 callback)); | 317 callback)); |
318 } | 318 } |
319 | 319 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 458 |
459 InsertCacheEntry( | 459 InsertCacheEntry( |
460 *cache_content, id, | 460 *cache_content, id, |
461 CacheItemInfo(version, expected_hash, info.GetLastModifiedTime(), | 461 CacheItemInfo(version, expected_hash, info.GetLastModifiedTime(), |
462 info.GetSize(), path), | 462 info.GetSize(), path), |
463 true); | 463 true); |
464 } | 464 } |
465 } | 465 } |
466 | 466 |
467 void LocalExtensionCache::OnCacheContentsChecked( | 467 void LocalExtensionCache::OnCacheContentsChecked( |
468 scoped_ptr<CacheMap> cache_content, | 468 std::unique_ptr<CacheMap> cache_content, |
469 const base::Closure& callback) { | 469 const base::Closure& callback) { |
470 cache_content->swap(cached_extensions_); | 470 cache_content->swap(cached_extensions_); |
471 state_ = kReady; | 471 state_ = kReady; |
472 callback.Run(); | 472 callback.Run(); |
473 } | 473 } |
474 | 474 |
475 // static | 475 // static |
476 void LocalExtensionCache::BackendMarkFileUsed(const base::FilePath& file_path, | 476 void LocalExtensionCache::BackendMarkFileUsed(const base::FilePath& file_path, |
477 const base::Time& time) { | 477 const base::Time& time) { |
478 base::TouchFile(file_path, time, time); | 478 base::TouchFile(file_path, time, time); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 : version(version), | 613 : version(version), |
614 expected_hash(base::ToLowerASCII(expected_hash)), | 614 expected_hash(base::ToLowerASCII(expected_hash)), |
615 last_used(last_used), | 615 last_used(last_used), |
616 size(size), | 616 size(size), |
617 file_path(file_path) {} | 617 file_path(file_path) {} |
618 | 618 |
619 LocalExtensionCache::CacheItemInfo::~CacheItemInfo() { | 619 LocalExtensionCache::CacheItemInfo::~CacheItemInfo() { |
620 } | 620 } |
621 | 621 |
622 } // namespace extensions | 622 } // namespace extensions |
OLD | NEW |