| 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 #ifndef CHROME_BROWSER_ICON_LOADER_H_ | 5 #ifndef CHROME_BROWSER_ICON_LOADER_H_ |
| 6 #define CHROME_BROWSER_ICON_LOADER_H_ | 6 #define CHROME_BROWSER_ICON_LOADER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // | 33 // |
| 34 // A facility to read a file containing an icon asynchronously in the IO | 34 // A facility to read a file containing an icon asynchronously in the IO |
| 35 // thread. Returns the icon in the form of an SkBitmap. | 35 // thread. Returns the icon in the form of an SkBitmap. |
| 36 // | 36 // |
| 37 //////////////////////////////////////////////////////////////////////////////// | 37 //////////////////////////////////////////////////////////////////////////////// |
| 38 class IconLoader : public base::RefCountedThreadSafe<IconLoader> { | 38 class IconLoader : public base::RefCountedThreadSafe<IconLoader> { |
| 39 public: | 39 public: |
| 40 enum IconSize { | 40 enum IconSize { |
| 41 SMALL = 0, // 16x16 | 41 SMALL = 0, // 16x16 |
| 42 NORMAL, // 32x32 | 42 NORMAL, // 32x32 |
| 43 LARGE | 43 LARGE, // Windows: 32x32, Linux: 48x48, Mac: Unsupported |
| 44 ALL, // All sizes available |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 class Delegate { | 47 class Delegate { |
| 47 public: | 48 public: |
| 48 // Invoked when an icon has been read. |source| is the IconLoader. If the | 49 // Invoked when an icon has been read. |source| is the IconLoader. If the |
| 49 // icon has been successfully loaded, result is non-null. This method must | 50 // icon has been successfully loaded, result is non-null. This method must |
| 50 // return true if it is taking ownership of the returned bitmap. | 51 // return true if it is taking ownership of the returned bitmap. |
| 51 virtual bool OnImageLoaded(IconLoader* source, gfx::Image* result) = 0; | 52 virtual bool OnImageLoaded(IconLoader* source, gfx::Image* result) = 0; |
| 52 | 53 |
| 53 protected: | 54 protected: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // on the main thread. | 86 // on the main thread. |
| 86 void ParseIcon(); | 87 void ParseIcon(); |
| 87 FilePath filename_; | 88 FilePath filename_; |
| 88 std::string icon_data_; | 89 std::string icon_data_; |
| 89 #endif | 90 #endif |
| 90 | 91 |
| 91 DISALLOW_COPY_AND_ASSIGN(IconLoader); | 92 DISALLOW_COPY_AND_ASSIGN(IconLoader); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 #endif // CHROME_BROWSER_ICON_LOADER_H_ | 95 #endif // CHROME_BROWSER_ICON_LOADER_H_ |
| OLD | NEW |