Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chrome/browser/icon_loader_win.cc

Issue 10378009: Get rid of Image::Image(SkBitmap*) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: k Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/gfx/icon_util.h" 14 #include "ui/gfx/icon_util.h"
14 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
15 16
16 void IconLoader::ReadIcon() { 17 void IconLoader::ReadIcon() {
17 int size = 0; 18 int size = 0;
18 switch (icon_size_) { 19 switch (icon_size_) {
19 case IconLoader::SMALL: 20 case IconLoader::SMALL:
20 size = SHGFI_SMALLICON; 21 size = SHGFI_SMALLICON;
21 break; 22 break;
22 case IconLoader::NORMAL: 23 case IconLoader::NORMAL:
23 size = 0; 24 size = 0;
24 break; 25 break;
25 case IconLoader::LARGE: 26 case IconLoader::LARGE:
26 size = SHGFI_LARGEICON; 27 size = SHGFI_LARGEICON;
27 break; 28 break;
28 default: 29 default:
29 NOTREACHED(); 30 NOTREACHED();
30 } 31 }
31 SHFILEINFO file_info = { 0 }; 32 SHFILEINFO file_info = { 0 };
32 if (!SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info, 33 if (!SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info,
33 sizeof(SHFILEINFO), 34 sizeof(SHFILEINFO),
34 SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) 35 SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES))
35 return; 36 return;
36 37
37 image_.reset(new gfx::Image( 38 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(
38 IconUtil::CreateSkBitmapFromHICON(file_info.hIcon))); 39 file_info.hIcon));
40 image_.reset(new gfx::Image(*bitmap));
39 DestroyIcon(file_info.hIcon); 41 DestroyIcon(file_info.hIcon);
40 target_message_loop_->PostTask(FROM_HERE, 42 target_message_loop_->PostTask(FROM_HERE,
41 base::Bind(&IconLoader::NotifyDelegate, this)); 43 base::Bind(&IconLoader::NotifyDelegate, this));
42 } 44 }
OLDNEW
« no previous file with comments | « chrome/browser/icon_loader_linux.cc ('k') | chrome/browser/profiles/gaia_info_update_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698