OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 NORMAL, // 32x32 | 36 NORMAL, // 32x32 |
37 LARGE | 37 LARGE |
38 }; | 38 }; |
39 | 39 |
40 class Delegate { | 40 class Delegate { |
41 public: | 41 public: |
42 // Invoked when an icon has been read. |source| is the IconLoader. If the | 42 // Invoked when an icon has been read. |source| is the IconLoader. If the |
43 // icon has been successfully loaded, result is non-null. This method must | 43 // icon has been successfully loaded, result is non-null. This method must |
44 // return true if it is taking ownership of the returned bitmap. | 44 // return true if it is taking ownership of the returned bitmap. |
45 virtual bool OnBitmapLoaded(IconLoader* source, SkBitmap* result) = 0; | 45 virtual bool OnBitmapLoaded(IconLoader* source, SkBitmap* result) = 0; |
46 protected: | |
47 ~Delegate() {} | |
48 }; | 46 }; |
49 | 47 |
50 IconLoader(const IconGroupID& group, IconSize size, Delegate* delegate); | 48 IconLoader(const IconGroupID& group, IconSize size, Delegate* delegate); |
51 | 49 |
52 virtual ~IconLoader(); | 50 virtual ~IconLoader(); |
53 | 51 |
54 // Start reading the icon on the file thread. | 52 // Start reading the icon on the file thread. |
55 void Start(); | 53 void Start(); |
56 | 54 |
57 private: | 55 private: |
(...skipping 18 matching lines...) Expand all Loading... |
76 // on the main thread. | 74 // on the main thread. |
77 void ParseIcon(); | 75 void ParseIcon(); |
78 FilePath filename_; | 76 FilePath filename_; |
79 std::string icon_data_; | 77 std::string icon_data_; |
80 #endif | 78 #endif |
81 | 79 |
82 DISALLOW_COPY_AND_ASSIGN(IconLoader); | 80 DISALLOW_COPY_AND_ASSIGN(IconLoader); |
83 }; | 81 }; |
84 | 82 |
85 #endif // CHROME_BROWSER_ICON_LOADER_H_ | 83 #endif // CHROME_BROWSER_ICON_LOADER_H_ |
OLD | NEW |