Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5567)

Unified Diff: chrome/browser/icon_loader.cc

Issue 2577273002: Clean up IconLoader. (Closed)
Patch Set: bind Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/icon_loader.h ('k') | chrome/browser/icon_loader_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_loader.cc
diff --git a/chrome/browser/icon_loader.cc b/chrome/browser/icon_loader.cc
index 262bc54a12e8aea0c863edebbf6809fb332df9e4..e00c890654ba390e25a12e6732ccf065bb0cdeef 100644
--- a/chrome/browser/icon_loader.cc
+++ b/chrome/browser/icon_loader.cc
@@ -10,33 +10,35 @@
using content::BrowserThread;
-IconLoader::IconLoader(const base::FilePath& file_path,
- IconSize size,
- Delegate* delegate)
- : file_path_(file_path),
- icon_size_(size),
- delegate_(delegate) {}
-
-IconLoader::~IconLoader() {
+// static
+IconLoader* IconLoader::Create(const base::FilePath& file_path,
+ IconSize size,
+ IconLoadedCallback callback) {
+ return new IconLoader(file_path, size, callback);
}
void IconLoader::Start() {
target_task_runner_ = base::ThreadTaskRunnerHandle::Get();
- BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE,
- base::Bind(&IconLoader::ReadGroup, this),
- base::Bind(&IconLoader::OnReadGroup, this));
+ BrowserThread::PostTaskAndReply(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&IconLoader::ReadGroup, base::Unretained(this)),
+ base::Bind(&IconLoader::OnReadGroup, base::Unretained(this)));
}
+IconLoader::IconLoader(const base::FilePath& file_path,
+ IconSize size,
+ IconLoadedCallback callback)
+ : file_path_(file_path), icon_size_(size), callback_(callback) {}
+
+IconLoader::~IconLoader() {}
+
void IconLoader::ReadGroup() {
group_ = GroupForFilepath(file_path_);
}
void IconLoader::OnReadGroup() {
- BrowserThread::PostTask(ReadIconThreadID(), FROM_HERE,
- base::Bind(&IconLoader::ReadIcon, this));
-}
-
-void IconLoader::NotifyDelegate() {
- delegate_->OnImageLoaded(this, std::move(image_), group_);
+ BrowserThread::PostTask(
+ ReadIconThreadID(), FROM_HERE,
+ base::Bind(&IconLoader::ReadIcon, base::Unretained(this)));
}
« no previous file with comments | « chrome/browser/icon_loader.h ('k') | chrome/browser/icon_loader_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698