| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/icon_manager.h" | 5 #include "chrome/browser/icon_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 struct IconManager::ClientRequest { | 29 struct IconManager::ClientRequest { |
| 30 IconRequestCallback callback; | 30 IconRequestCallback callback; |
| 31 base::FilePath file_path; | 31 base::FilePath file_path; |
| 32 IconLoader::IconSize size; | 32 IconLoader::IconSize size; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 IconManager::IconManager() { | 35 IconManager::IconManager() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 IconManager::~IconManager() { | 38 IconManager::~IconManager() { |
| 39 STLDeleteValues(&icon_cache_); | 39 base::STLDeleteValues(&icon_cache_); |
| 40 } | 40 } |
| 41 | 41 |
| 42 gfx::Image* IconManager::LookupIconFromFilepath(const base::FilePath& file_name, | 42 gfx::Image* IconManager::LookupIconFromFilepath(const base::FilePath& file_name, |
| 43 IconLoader::IconSize size) { | 43 IconLoader::IconSize size) { |
| 44 GroupMap::iterator it = group_cache_.find(file_name); | 44 GroupMap::iterator it = group_cache_.find(file_name); |
| 45 if (it != group_cache_.end()) | 45 if (it != group_cache_.end()) |
| 46 return LookupIconFromGroup(it->second, size); | 46 return LookupIconFromGroup(it->second, size); |
| 47 | 47 |
| 48 return NULL; | 48 return NULL; |
| 49 } | 49 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 IconManager::CacheKey::CacheKey(const IconGroupID& group, | 140 IconManager::CacheKey::CacheKey(const IconGroupID& group, |
| 141 IconLoader::IconSize size) | 141 IconLoader::IconSize size) |
| 142 : group(group), | 142 : group(group), |
| 143 size(size) { | 143 size(size) { |
| 144 } | 144 } |
| 145 | 145 |
| 146 bool IconManager::CacheKey::operator<(const CacheKey &other) const { | 146 bool IconManager::CacheKey::operator<(const CacheKey &other) const { |
| 147 return std::tie(group, size) < std::tie(other.group, other.size); | 147 return std::tie(group, size) < std::tie(other.group, other.size); |
| 148 } | 148 } |
| OLD | NEW |