| 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_loader.h" | 5 #include "chrome/browser/icon_loader.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 break; | 27 break; |
| 28 default: | 28 default: |
| 29 NOTREACHED(); | 29 NOTREACHED(); |
| 30 } | 30 } |
| 31 SHFILEINFO file_info = { 0 }; | 31 SHFILEINFO file_info = { 0 }; |
| 32 if (!SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info, | 32 if (!SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info, |
| 33 sizeof(SHFILEINFO), | 33 sizeof(SHFILEINFO), |
| 34 SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) | 34 SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) |
| 35 return; | 35 return; |
| 36 | 36 |
| 37 image_.reset(new gfx::Image( | 37 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON( |
| 38 IconUtil::CreateSkBitmapFromHICON(file_info.hIcon))); | 38 file_info.hIcon)); |
| 39 image_.reset(new gfx::Image(*bitmap)); |
| 39 DestroyIcon(file_info.hIcon); | 40 DestroyIcon(file_info.hIcon); |
| 40 target_message_loop_->PostTask(FROM_HERE, | 41 target_message_loop_->PostTask(FROM_HERE, |
| 41 base::Bind(&IconLoader::NotifyDelegate, this)); | 42 base::Bind(&IconLoader::NotifyDelegate, this)); |
| 42 } | 43 } |
| OLD | NEW |