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 #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 "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop/message_loop_proxy.h" | 16 #include "base/message_loop/message_loop_proxy.h" |
| 17 #include "content/public/browser/browser_thread.h" |
17 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
18 | 19 |
19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
20 // On Windows, we group files by their extension, with several exceptions: | 21 // On Windows, we group files by their extension, with several exceptions: |
21 // .dll, .exe, .ico. See IconManager.h for explanation. | 22 // .dll, .exe, .ico. See IconManager.h for explanation. |
22 typedef std::wstring IconGroupID; | 23 typedef std::wstring IconGroupID; |
23 #elif defined(OS_POSIX) | 24 #elif defined(OS_POSIX) |
24 // On POSIX, we group files by MIME type. | 25 // On POSIX, we group files by MIME type. |
25 typedef std::string IconGroupID; | 26 typedef std::string IconGroupID; |
26 #endif | 27 #endif |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 71 |
71 virtual ~IconLoader(); | 72 virtual ~IconLoader(); |
72 | 73 |
73 // Get the identifying string for the given file. The implementation | 74 // Get the identifying string for the given file. The implementation |
74 // is in icon_loader_[platform].cc. | 75 // is in icon_loader_[platform].cc. |
75 static IconGroupID ReadGroupIDFromFilepath(const base::FilePath& path); | 76 static IconGroupID ReadGroupIDFromFilepath(const base::FilePath& path); |
76 | 77 |
77 // Some icons (exe's on windows) can change as they're loaded. | 78 // Some icons (exe's on windows) can change as they're loaded. |
78 static bool IsIconMutableFromFilepath(const base::FilePath& path); | 79 static bool IsIconMutableFromFilepath(const base::FilePath& path); |
79 | 80 |
| 81 // The thread ReadIcon() should be called on. |
| 82 static content::BrowserThread::ID ReadIconThreadID(); |
| 83 |
80 void ReadGroup(); | 84 void ReadGroup(); |
81 void OnReadGroup(); | 85 void OnReadGroup(); |
82 void ReadIcon(); | 86 void ReadIcon(); |
83 | 87 |
84 void NotifyDelegate(); | 88 void NotifyDelegate(); |
85 | 89 |
86 // The message loop object of the thread in which we notify the delegate. | 90 // The message loop object of the thread in which we notify the delegate. |
87 scoped_refptr<base::MessageLoopProxy> target_message_loop_; | 91 scoped_refptr<base::MessageLoopProxy> target_message_loop_; |
88 | 92 |
89 base::FilePath file_path_; | 93 base::FilePath file_path_; |
90 | 94 |
91 IconGroupID group_; | 95 IconGroupID group_; |
92 | 96 |
93 IconSize icon_size_; | 97 IconSize icon_size_; |
94 | 98 |
95 scoped_ptr<gfx::Image> image_; | 99 scoped_ptr<gfx::Image> image_; |
96 | 100 |
97 Delegate* delegate_; | 101 Delegate* delegate_; |
98 | 102 |
99 DISALLOW_COPY_AND_ASSIGN(IconLoader); | 103 DISALLOW_COPY_AND_ASSIGN(IconLoader); |
100 }; | 104 }; |
101 | 105 |
102 #endif // CHROME_BROWSER_ICON_LOADER_H_ | 106 #endif // CHROME_BROWSER_ICON_LOADER_H_ |
OLD | NEW |