| 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/icon_loader.h" | 5 #include "chrome/browser/icon_loader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // return the image as-is. | 176 // return the image as-is. |
| 177 case IconLoader::ALL: // fallthrough | 177 case IconLoader::ALL: // fallthrough |
| 178 default: | 178 default: |
| 179 return kDoNotResize; | 179 return kDoNotResize; |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace | 183 } // namespace |
| 184 | 184 |
| 185 // static | 185 // static |
| 186 IconGroupID IconLoader::ReadGroupIDFromFilepath( | 186 IconLoader::IconGroup IconLoader::GroupForFilepath( |
| 187 const base::FilePath& filepath) { | 187 const base::FilePath& file_path) { |
| 188 return base::ToLowerASCII(filepath.Extension()); | 188 return base::ToLowerASCII(file_path.Extension()); |
| 189 } | 189 } |
| 190 | 190 |
| 191 // static | 191 // static |
| 192 bool IconLoader::IsIconMutableFromFilepath(const base::FilePath&) { | |
| 193 return false; | |
| 194 } | |
| 195 | |
| 196 // static | |
| 197 content::BrowserThread::ID IconLoader::ReadIconThreadID() { | 192 content::BrowserThread::ID IconLoader::ReadIconThreadID() { |
| 198 return content::BrowserThread::FILE; | 193 return content::BrowserThread::FILE; |
| 199 } | 194 } |
| 200 | 195 |
| 201 void IconLoader::ReadIcon() { | 196 void IconLoader::ReadIcon() { |
| 202 static base::LazyInstance<IconMapper>::Leaky icon_mapper = | 197 static base::LazyInstance<IconMapper>::Leaky icon_mapper = |
| 203 LAZY_INSTANCE_INITIALIZER; | 198 LAZY_INSTANCE_INITIALIZER; |
| 204 int idr = icon_mapper.Get().Lookup(group_, icon_size_); | 199 int idr = icon_mapper.Get().Lookup(group_, icon_size_); |
| 205 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 200 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 206 gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(), | 201 gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(), |
| 207 IconSizeToDIPSize(icon_size_))); | 202 IconSizeToDIPSize(icon_size_))); |
| 208 image_skia.MakeThreadSafe(); | 203 image_skia.MakeThreadSafe(); |
| 209 image_.reset(new gfx::Image(image_skia)); | 204 image_.reset(new gfx::Image(image_skia)); |
| 210 target_task_runner_->PostTask( | 205 target_task_runner_->PostTask( |
| 211 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); | 206 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); |
| 212 } | 207 } |
| OLD | NEW |