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 192883004: linux_aura: run IconLoader::ReadIcon on the UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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) 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 <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/message_loop.h" 11 #include "base/message_loop/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 "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/gfx/icon_util.h" 14 #include "ui/gfx/icon_util.h"
15 #include "ui/gfx/image/image_skia.h" 15 #include "ui/gfx/image/image_skia.h"
16 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
17 17
18 // static 18 // static
19 IconGroupID IconLoader::ReadGroupIDFromFilepath( 19 IconGroupID IconLoader::ReadGroupIDFromFilepath(
20 const base::FilePath& filepath) { 20 const base::FilePath& filepath) {
21 if (!IsIconMutableFromFilepath(filepath)) 21 if (!IsIconMutableFromFilepath(filepath))
22 return filepath.Extension(); 22 return filepath.Extension();
23 return filepath.value(); 23 return filepath.value();
24 } 24 }
25 25
26 // static
26 bool IconLoader::IsIconMutableFromFilepath(const base::FilePath& filepath) { 27 bool IconLoader::IsIconMutableFromFilepath(const base::FilePath& filepath) {
27 return filepath.MatchesExtension(L".exe") || 28 return filepath.MatchesExtension(L".exe") ||
28 filepath.MatchesExtension(L".dll") || 29 filepath.MatchesExtension(L".dll") ||
29 filepath.MatchesExtension(L".ico"); 30 filepath.MatchesExtension(L".ico");
30 } 31 }
31 32
33 // static
34 content::BrowserThread::ID IconLoader::ReadIconThreadID() {
35 return content::BrowserThread::FILE;
36 }
37
32 void IconLoader::ReadIcon() { 38 void IconLoader::ReadIcon() {
33 int size = 0; 39 int size = 0;
34 switch (icon_size_) { 40 switch (icon_size_) {
35 case IconLoader::SMALL: 41 case IconLoader::SMALL:
36 size = SHGFI_SMALLICON; 42 size = SHGFI_SMALLICON;
37 break; 43 break;
38 case IconLoader::NORMAL: 44 case IconLoader::NORMAL:
39 size = 0; 45 size = 0;
40 break; 46 break;
41 case IconLoader::LARGE: 47 case IconLoader::LARGE:
(...skipping 16 matching lines...) Expand all
58 image_skia.MakeThreadSafe(); 64 image_skia.MakeThreadSafe();
59 image_.reset(new gfx::Image(image_skia)); 65 image_.reset(new gfx::Image(image_skia));
60 DestroyIcon(file_info.hIcon); 66 DestroyIcon(file_info.hIcon);
61 } 67 }
62 } 68 }
63 69
64 // Always notify the delegate, regardless of success. 70 // Always notify the delegate, regardless of success.
65 target_message_loop_->PostTask(FROM_HERE, 71 target_message_loop_->PostTask(FROM_HERE,
66 base::Bind(&IconLoader::NotifyDelegate, this)); 72 base::Bind(&IconLoader::NotifyDelegate, this));
67 } 73 }
OLDNEW
« chrome/browser/icon_loader_linux.cc ('K') | « chrome/browser/icon_loader_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698