OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/chromeos/app_mode/kiosk_app_icon_loader.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_icon_loader.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 private: | 42 private: |
43 ~IconImageRequest() override = default; | 43 ~IconImageRequest() override = default; |
44 KioskAppIconLoader::ResultCallback result_callback_; | 44 KioskAppIconLoader::ResultCallback result_callback_; |
45 }; | 45 }; |
46 | 46 |
47 void LoadOnBlockingPool( | 47 void LoadOnBlockingPool( |
48 const base::FilePath& icon_path, | 48 const base::FilePath& icon_path, |
49 scoped_refptr<base::SequencedTaskRunner> callback_task_runner, | 49 scoped_refptr<base::SequencedTaskRunner> callback_task_runner, |
50 KioskAppIconLoader::ResultCallback result_callback) { | 50 KioskAppIconLoader::ResultCallback result_callback) { |
51 DCHECK(callback_task_runner->RunsTasksOnCurrentThread()); | 51 DCHECK(callback_task_runner->RunsTasksInCurrentSequence()); |
52 | 52 |
53 std::string data; | 53 std::string data; |
54 if (!base::ReadFileToString(base::FilePath(icon_path), &data)) { | 54 if (!base::ReadFileToString(base::FilePath(icon_path), &data)) { |
55 LOG(ERROR) << "Failed to read icon file."; | 55 LOG(ERROR) << "Failed to read icon file."; |
56 BrowserThread::PostTask( | 56 BrowserThread::PostTask( |
57 BrowserThread::UI, FROM_HERE, | 57 BrowserThread::UI, FROM_HERE, |
58 base::Bind(result_callback, base::Optional<gfx::ImageSkia>())); | 58 base::Bind(result_callback, base::Optional<gfx::ImageSkia>())); |
59 return; | 59 return; |
60 } | 60 } |
61 | 61 |
(...skipping 26 matching lines...) Expand all Loading... |
88 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 88 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
89 | 89 |
90 if (result.has_value()) { | 90 if (result.has_value()) { |
91 delegate_->OnIconLoadSuccess(result.value()); | 91 delegate_->OnIconLoadSuccess(result.value()); |
92 } else { | 92 } else { |
93 delegate_->OnIconLoadFailure(); | 93 delegate_->OnIconLoadFailure(); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 } // namespace chromeos | 97 } // namespace chromeos |
OLD | NEW |