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

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

Issue 10332163: Revert 137075 - Get rid of Image::Image(SkBitmap*) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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"
14 #include "ui/gfx/icon_util.h" 13 #include "ui/gfx/icon_util.h"
15 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
16 15
17 void IconLoader::ReadIcon() { 16 void IconLoader::ReadIcon() {
18 int size = 0; 17 int size = 0;
19 switch (icon_size_) { 18 switch (icon_size_) {
20 case IconLoader::SMALL: 19 case IconLoader::SMALL:
21 size = SHGFI_SMALLICON; 20 size = SHGFI_SMALLICON;
22 break; 21 break;
23 case IconLoader::NORMAL: 22 case IconLoader::NORMAL:
24 size = 0; 23 size = 0;
25 break; 24 break;
26 case IconLoader::LARGE: 25 case IconLoader::LARGE:
27 size = SHGFI_LARGEICON; 26 size = SHGFI_LARGEICON;
28 break; 27 break;
29 default: 28 default:
30 NOTREACHED(); 29 NOTREACHED();
31 } 30 }
32 SHFILEINFO file_info = { 0 }; 31 SHFILEINFO file_info = { 0 };
33 if (!SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info, 32 if (!SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info,
34 sizeof(SHFILEINFO), 33 sizeof(SHFILEINFO),
35 SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) 34 SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES))
36 return; 35 return;
37 36
38 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON( 37 image_.reset(new gfx::Image(
39 file_info.hIcon)); 38 IconUtil::CreateSkBitmapFromHICON(file_info.hIcon)));
40 image_.reset(new gfx::Image(*bitmap));
41 DestroyIcon(file_info.hIcon); 39 DestroyIcon(file_info.hIcon);
42 target_message_loop_->PostTask(FROM_HERE, 40 target_message_loop_->PostTask(FROM_HERE,
43 base::Bind(&IconLoader::NotifyDelegate, this)); 41 base::Bind(&IconLoader::NotifyDelegate, this));
44 } 42 }
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