| 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 "components/search_provider_logos/logo_cache.h" | 5 #include "components/search_provider_logos/logo_cache.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 LogoCache::~LogoCache() { | 64 LogoCache::~LogoCache() { |
| 65 DCHECK(thread_checker_.CalledOnValidThread()); | 65 DCHECK(thread_checker_.CalledOnValidThread()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void LogoCache::UpdateCachedLogoMetadata(const LogoMetadata& metadata) { | 68 void LogoCache::UpdateCachedLogoMetadata(const LogoMetadata& metadata) { |
| 69 DCHECK(thread_checker_.CalledOnValidThread()); | 69 DCHECK(thread_checker_.CalledOnValidThread()); |
| 70 DCHECK(metadata_); | 70 DCHECK(metadata_); |
| 71 DCHECK_EQ(metadata_->fingerprint, metadata.fingerprint); | 71 DCHECK_EQ(metadata_->fingerprint, metadata.fingerprint); |
| 72 | 72 |
| 73 UpdateMetadata(base::WrapUnique(new LogoMetadata(metadata))); | 73 UpdateMetadata(base::MakeUnique<LogoMetadata>(metadata)); |
| 74 WriteMetadata(); | 74 WriteMetadata(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 const LogoMetadata* LogoCache::GetCachedLogoMetadata() { | 77 const LogoMetadata* LogoCache::GetCachedLogoMetadata() { |
| 78 DCHECK(thread_checker_.CalledOnValidThread()); | 78 DCHECK(thread_checker_.CalledOnValidThread()); |
| 79 ReadMetadataIfNeeded(); | 79 ReadMetadataIfNeeded(); |
| 80 return metadata_.get(); | 80 return metadata_.get(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void LogoCache::SetCachedLogo(const EncodedLogo* logo) { | 83 void LogoCache::SetCachedLogo(const EncodedLogo* logo) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 base::DeleteFile(GetMetadataPath(), false); | 236 base::DeleteFile(GetMetadataPath(), false); |
| 237 } | 237 } |
| 238 | 238 |
| 239 bool LogoCache::EnsureCacheDirectoryExists() { | 239 bool LogoCache::EnsureCacheDirectoryExists() { |
| 240 if (base::DirectoryExists(cache_directory_)) | 240 if (base::DirectoryExists(cache_directory_)) |
| 241 return true; | 241 return true; |
| 242 return base::CreateDirectory(cache_directory_); | 242 return base::CreateDirectory(cache_directory_); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace search_provider_logos | 245 } // namespace search_provider_logos |
| OLD | NEW |