| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "chrome/browser/icon_loader.h" | 53 #include "chrome/browser/icon_loader.h" |
| 54 #include "content/browser/cancelable_request.h" | 54 #include "content/browser/cancelable_request.h" |
| 55 #include "ui/gfx/image.h" | 55 #include "ui/gfx/image.h" |
| 56 | 56 |
| 57 class FilePath; | 57 class FilePath; |
| 58 | 58 |
| 59 class IconManager : public IconLoader::Delegate, | 59 class IconManager : public IconLoader::Delegate, |
| 60 public CancelableRequestProvider { | 60 public CancelableRequestProvider { |
| 61 public: | 61 public: |
| 62 IconManager(); | 62 IconManager(); |
| 63 ~IconManager(); | 63 virtual ~IconManager(); |
| 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; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |