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

Side by Side Diff: chrome/browser/icon_manager.h

Issue 8068013: Add interface to CancelableRequest that allows use of base::Callback<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dcheck Created 9 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/icon_manager.cc » ('j') | content/browser/cancelable_request.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Class for finding and caching Windows explorer icons. The IconManager 5 // Class for finding and caching Windows explorer icons. The IconManager
6 // lives on the UI thread but performs icon extraction work on the file thread 6 // lives on the UI thread but performs icon extraction work on the file thread
7 // to avoid blocking the UI thread with potentially expensive COM and disk 7 // to avoid blocking the UI thread with potentially expensive COM and disk
8 // operations. 8 // operations.
9 // 9 //
10 // Terminology 10 // Terminology
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 // Synchronous call to examine the internal caches for the icon. Returns the 65 // Synchronous call to examine the internal caches for the icon. Returns the
66 // icon if we have already loaded it, NULL if we don't have it and must load 66 // icon if we have already loaded it, NULL if we don't have it and must load
67 // it via 'LoadIcon'. The returned bitmap is owned by the IconManager and must 67 // it via 'LoadIcon'. The returned bitmap is owned by the IconManager and must
68 // not be free'd by the caller. If the caller needs to modify the icon, it 68 // not be free'd by the caller. If the caller needs to modify the icon, it
69 // must make a copy and modify the copy. 69 // must make a copy and modify the copy.
70 gfx::Image* LookupIcon(const FilePath& file_name, 70 gfx::Image* LookupIcon(const FilePath& file_name,
71 IconLoader::IconSize size); 71 IconLoader::IconSize size);
72 72
73 typedef CancelableRequestProvider::Handle Handle; 73 typedef CancelableRequestProvider::Handle Handle;
74 typedef Callback2<Handle, gfx::Image*>::Type IconRequestCallback; 74 typedef Callback2<Handle, gfx::Image*>::Type OldIconRequestCallback;
brettw 2011/10/01 16:26:12 It looks like you don't use this and you can just
awong 2011/10/03 05:18:39 Done.
75 typedef base::Callback<void(Handle, gfx::Image*)> IconRequestCallback;
75 76
76 // Asynchronous call to lookup and return the icon associated with file. The 77 // Asynchronous call to lookup and return the icon associated with file. The
77 // work is done on the file thread, with the callbacks running on the UI 78 // work is done on the file thread, with the callbacks running on the UI
78 // thread. The return value is the 'request_id' that will be passed to the 79 // thread. The return value is the 'request_id' that will be passed to the
79 // client in the callback. Note: this does *not* check the cache. 80 // client in the callback. Note: this does *not* check the cache.
80 // 81 //
81 // WATCH OUT: The returned bitmap pointer may be NULL if decoding failed. 82 // WATCH OUT: The returned bitmap pointer may be NULL if decoding failed.
82 Handle LoadIcon(const FilePath& file_name, 83 Handle LoadIcon(const FilePath& file_name,
83 IconLoader::IconSize size, 84 IconLoader::IconSize size,
84 CancelableRequestConsumerBase* consumer, 85 CancelableRequestConsumerBase* consumer,
85 IconRequestCallback* callback); 86 const IconRequestCallback& callback);
86 87
87 // IconLoader::Delegate interface. 88 // IconLoader::Delegate interface.
88 virtual bool OnImageLoaded(IconLoader* source, gfx::Image* result); 89 virtual bool OnImageLoaded(IconLoader* source, gfx::Image* result);
89 90
90 // Get the identifying string for the given file. The implementation 91 // Get the identifying string for the given file. The implementation
91 // is in icon_manager_[platform].cc. 92 // is in icon_manager_[platform].cc.
92 static IconGroupID GetGroupIDFromFilepath(const FilePath& path); 93 static IconGroupID GetGroupIDFromFilepath(const FilePath& path);
93 94
94 private: 95 private:
95 struct CacheKey { 96 struct CacheKey {
(...skipping 13 matching lines...) Expand all
109 110
110 // Asynchronous requests that have not yet been completed. 111 // Asynchronous requests that have not yet been completed.
111 struct ClientRequest; 112 struct ClientRequest;
112 typedef std::map<IconLoader*, ClientRequest> ClientRequests; 113 typedef std::map<IconLoader*, ClientRequest> ClientRequests;
113 ClientRequests requests_; 114 ClientRequests requests_;
114 115
115 DISALLOW_COPY_AND_ASSIGN(IconManager); 116 DISALLOW_COPY_AND_ASSIGN(IconManager);
116 }; 117 };
117 118
118 #endif // CHROME_BROWSER_ICON_MANAGER_H_ 119 #endif // CHROME_BROWSER_ICON_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/icon_manager.cc » ('j') | content/browser/cancelable_request.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698