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 // 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // thread. The return value is the 'request_id' that will be passed to the | 78 // 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. | 79 // client in the callback. Note: this does *not* check the cache. |
80 // | 80 // |
81 // WATCH OUT: The returned bitmap pointer may be NULL if decoding failed. | 81 // WATCH OUT: The returned bitmap pointer may be NULL if decoding failed. |
82 Handle LoadIcon(const FilePath& file_name, | 82 Handle LoadIcon(const FilePath& file_name, |
83 IconLoader::IconSize size, | 83 IconLoader::IconSize size, |
84 CancelableRequestConsumerBase* consumer, | 84 CancelableRequestConsumerBase* consumer, |
85 const IconRequestCallback& callback); | 85 const IconRequestCallback& callback); |
86 | 86 |
87 // IconLoader::Delegate interface. | 87 // IconLoader::Delegate interface. |
88 virtual bool OnImageLoaded(IconLoader* source, gfx::Image* result); | 88 virtual bool OnImageLoaded(IconLoader* source, gfx::Image* result) OVERRIDE; |
89 | 89 |
90 // Get the identifying string for the given file. The implementation | 90 // Get the identifying string for the given file. The implementation |
91 // is in icon_manager_[platform].cc. | 91 // is in icon_manager_[platform].cc. |
92 static IconGroupID GetGroupIDFromFilepath(const FilePath& path); | 92 static IconGroupID GetGroupIDFromFilepath(const FilePath& path); |
93 | 93 |
94 private: | 94 private: |
95 struct CacheKey { | 95 struct CacheKey { |
96 CacheKey(const IconGroupID& group, IconLoader::IconSize size); | 96 CacheKey(const IconGroupID& group, IconLoader::IconSize size); |
97 | 97 |
98 // Used as a key in the map below, so we need this comparator. | 98 // Used as a key in the map below, so we need this comparator. |
(...skipping 10 matching lines...) Expand all Loading... |
109 | 109 |
110 // Asynchronous requests that have not yet been completed. | 110 // Asynchronous requests that have not yet been completed. |
111 struct ClientRequest; | 111 struct ClientRequest; |
112 typedef std::map<IconLoader*, ClientRequest> ClientRequests; | 112 typedef std::map<IconLoader*, ClientRequest> ClientRequests; |
113 ClientRequests requests_; | 113 ClientRequests requests_; |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(IconManager); | 115 DISALLOW_COPY_AND_ASSIGN(IconManager); |
116 }; | 116 }; |
117 | 117 |
118 #endif // CHROME_BROWSER_ICON_MANAGER_H_ | 118 #endif // CHROME_BROWSER_ICON_MANAGER_H_ |
OLD | NEW |