OLD | NEW |
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 // 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 // 3. The gfx::Image pointer passed to the callback may be NULL if decoding | 78 // 3. The gfx::Image pointer passed to the callback may be NULL if decoding |
79 // failed. | 79 // failed. |
80 base::CancelableTaskTracker::TaskId LoadIcon( | 80 base::CancelableTaskTracker::TaskId LoadIcon( |
81 const base::FilePath& file_name, | 81 const base::FilePath& file_name, |
82 IconLoader::IconSize size, | 82 IconLoader::IconSize size, |
83 const IconRequestCallback& callback, | 83 const IconRequestCallback& callback, |
84 base::CancelableTaskTracker* tracker); | 84 base::CancelableTaskTracker* tracker); |
85 | 85 |
86 // IconLoader::Delegate interface. | 86 // IconLoader::Delegate interface. |
87 virtual bool OnGroupLoaded(IconLoader* loader, | 87 virtual bool OnGroupLoaded(IconLoader* loader, |
88 const IconGroupID& group) OVERRIDE; | 88 const IconGroupID& group) override; |
89 virtual bool OnImageLoaded(IconLoader* loader, | 89 virtual bool OnImageLoaded(IconLoader* loader, |
90 gfx::Image* result, | 90 gfx::Image* result, |
91 const IconGroupID& group) OVERRIDE; | 91 const IconGroupID& group) override; |
92 | 92 |
93 private: | 93 private: |
94 struct CacheKey { | 94 struct CacheKey { |
95 CacheKey(const IconGroupID& group, IconLoader::IconSize size); | 95 CacheKey(const IconGroupID& group, IconLoader::IconSize size); |
96 | 96 |
97 // Used as a key in the map below, so we need this comparator. | 97 // Used as a key in the map below, so we need this comparator. |
98 bool operator<(const CacheKey &other) const; | 98 bool operator<(const CacheKey &other) const; |
99 | 99 |
100 IconGroupID group; | 100 IconGroupID group; |
101 IconLoader::IconSize size; | 101 IconLoader::IconSize size; |
(...skipping 10 matching lines...) Expand all Loading... |
112 | 112 |
113 // Asynchronous requests that have not yet been completed. | 113 // Asynchronous requests that have not yet been completed. |
114 struct ClientRequest; | 114 struct ClientRequest; |
115 typedef std::map<IconLoader*, ClientRequest> ClientRequests; | 115 typedef std::map<IconLoader*, ClientRequest> ClientRequests; |
116 ClientRequests requests_; | 116 ClientRequests requests_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(IconManager); | 118 DISALLOW_COPY_AND_ASSIGN(IconManager); |
119 }; | 119 }; |
120 | 120 |
121 #endif // CHROME_BROWSER_ICON_MANAGER_H_ | 121 #endif // CHROME_BROWSER_ICON_MANAGER_H_ |
OLD | NEW |