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 <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Since we have already chosen the largest applicable image resource, we | 170 // Since we have already chosen the largest applicable image resource, we |
171 // return the image as-is. | 171 // return the image as-is. |
172 case IconLoader::ALL: // fallthrough | 172 case IconLoader::ALL: // fallthrough |
173 default: | 173 default: |
174 return kDoNotResize; | 174 return kDoNotResize; |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 } // namespace | 178 } // namespace |
179 | 179 |
180 void IconLoader::ReadIcon() { | 180 void IconLoader::ReadIcon(const IconGroupID& group) { |
181 static base::LazyInstance<IconMapper>::Leaky icon_mapper = | 181 static base::LazyInstance<IconMapper>::Leaky icon_mapper = |
182 LAZY_INSTANCE_INITIALIZER; | 182 LAZY_INSTANCE_INITIALIZER; |
183 int idr = icon_mapper.Get().Lookup(group_, icon_size_); | 183 int idr = icon_mapper.Get().Lookup(group, icon_size_); |
184 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 184 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
185 gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(), | 185 gfx::ImageSkia image_skia(ResizeImage(*(rb.GetImageNamed(idr)).ToImageSkia(), |
186 IconSizeToDIPSize(icon_size_))); | 186 IconSizeToDIPSize(icon_size_))); |
187 image_skia.MakeThreadSafe(); | 187 image_skia.MakeThreadSafe(); |
188 image_.reset(new gfx::Image(image_skia)); | 188 image_.reset(new gfx::Image(image_skia)); |
189 target_message_loop_->PostTask( | 189 target_message_loop_->PostTask( |
190 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); | 190 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this, group)); |
191 } | 191 } |
OLD | NEW |