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

Side by Side Diff: chrome/browser/icon_loader.cc

Issue 2586003002: patch from issue 2577273002 at patchset 20001 (http://crrev.com/2577273002#ps20001)
Patch Set: Convert to OnceCallback, and make it compile at least on Linux. 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/icon_loader.h ('k') | chrome/browser/icon_loader_auralinux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/icon_loader.h" 5 #include "chrome/browser/icon_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
11 using content::BrowserThread; 11 using content::BrowserThread;
12 12
13 IconLoader::IconLoader(const base::FilePath& file_path, 13 IconLoader::IconLoader(const base::FilePath& file_path,
14 IconSize size, 14 IconSize size,
15 Delegate* delegate) 15 IconLoadedCallback callback)
16 : file_path_(file_path), 16 : file_path_(file_path), icon_size_(size), callback_(std::move(callback)) {}
17 icon_size_(size),
18 delegate_(delegate) {}
19 17
20 IconLoader::~IconLoader() { 18 IconLoader::~IconLoader() {
21 } 19 }
22 20
23 void IconLoader::Start() { 21 void IconLoader::Start() {
24 target_task_runner_ = base::ThreadTaskRunnerHandle::Get(); 22 target_task_runner_ = base::ThreadTaskRunnerHandle::Get();
25 23
26 BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, 24 BrowserThread::PostTaskAndReply(
27 base::Bind(&IconLoader::ReadGroup, this), 25 BrowserThread::FILE, FROM_HERE,
28 base::Bind(&IconLoader::OnReadGroup, this)); 26 base::Bind(&IconLoader::ReadGroup, base::Unretained(this)),
27 base::Bind(&IconLoader::OnReadGroup, base::Unretained(this)));
29 } 28 }
30 29
31 void IconLoader::ReadGroup() { 30 void IconLoader::ReadGroup() {
32 group_ = GroupForFilepath(file_path_); 31 group_ = GroupForFilepath(file_path_);
33 } 32 }
34 33
35 void IconLoader::OnReadGroup() { 34 void IconLoader::OnReadGroup() {
36 BrowserThread::PostTask(ReadIconThreadID(), FROM_HERE, 35 BrowserThread::PostTask(
37 base::Bind(&IconLoader::ReadIcon, this)); 36 ReadIconThreadID(), FROM_HERE,
37 base::Bind(&IconLoader::ReadIcon, base::Unretained(this)));
38 } 38 }
39
40 void IconLoader::NotifyDelegate() {
41 delegate_->OnImageLoaded(this, std::move(image_), group_);
42 }
OLDNEW
« no previous file with comments | « chrome/browser/icon_loader.h ('k') | chrome/browser/icon_loader_auralinux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698