Index: chrome/browser/icon_loader.cc |
diff --git a/chrome/browser/icon_loader.cc b/chrome/browser/icon_loader.cc |
index 39919477640e6295c44c322b3f62171eea2c0556..b9c0b669b1d529be8f8290077ecf984579b670c5 100644 |
--- a/chrome/browser/icon_loader.cc |
+++ b/chrome/browser/icon_loader.cc |
@@ -6,6 +6,7 @@ |
#include "base/basictypes.h" |
#include "base/bind.h" |
+#include "chrome/browser/icon_manager.h" |
#include "content/public/browser/browser_thread.h" |
#if defined(TOOLKIT_GTK) |
@@ -14,10 +15,10 @@ |
using content::BrowserThread; |
-IconLoader::IconLoader(const IconGroupID& group, IconSize size, |
+IconLoader::IconLoader(const base::FilePath& file_path, IconSize size, |
Delegate* delegate) |
: target_message_loop_(NULL), |
- group_(group), |
+ file_path_(file_path), |
icon_size_(size), |
image_(NULL), |
delegate_(delegate) { |
@@ -34,13 +35,28 @@ void IconLoader::Start() { |
base::nix::DetectGtkTheme(); |
#endif |
- BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
- base::Bind(&IconLoader::ReadIcon, this)); |
+ IconGroupID* group = new IconGroupID(); |
Robert Sesek
2013/02/12 16:49:25
Who owns this? When is it deleted? Can't this just
shatch
2013/02/13 16:14:52
Done.
|
+ |
+ BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, |
+ base::Bind(&IconLoader::ReadGroup, this, base::Unretained(group)), |
+ base::Bind(&IconLoader::OnReadGroup, this, base::Owned(group))); |
+} |
+ |
+void IconLoader::ReadGroup(IconGroupID* group) { |
+ *group = IconManager::ReadGroupIDFromFilepath(file_path_); |
+} |
+ |
+void IconLoader::OnReadGroup(const IconGroupID* group) { |
+ if (!delegate_->OnGroupLoaded(this, *group)) { |
+ IconGroupID g = *group; |
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
+ base::Bind(&IconLoader::ReadIcon, this, g)); |
+ } |
} |
-void IconLoader::NotifyDelegate() { |
+void IconLoader::NotifyDelegate(const IconGroupID& group) { |
// If the delegate takes ownership of the Image, release it from the scoped |
// pointer. |
- if (delegate_->OnImageLoaded(this, image_.get())) |
+ if (delegate_->OnImageLoaded(this, image_.get(), group)) |
ignore_result(image_.release()); // Can't ignore return value. |
} |