| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/app_list/arc/arc_app_icon.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_icon.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 void ArcAppIcon::LoadForScaleFactor(ui::ScaleFactor scale_factor) { | 260 void ArcAppIcon::LoadForScaleFactor(ui::ScaleFactor scale_factor) { |
| 261 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context_); | 261 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context_); |
| 262 DCHECK(prefs); | 262 DCHECK(prefs); |
| 263 | 263 |
| 264 base::FilePath path = prefs->GetIconPath(app_id_, scale_factor); | 264 base::FilePath path = prefs->GetIconPath(app_id_, scale_factor); |
| 265 if (path.empty()) | 265 if (path.empty()) |
| 266 return; | 266 return; |
| 267 | 267 |
| 268 base::PostTaskWithTraitsAndReplyWithResult( | 268 base::PostTaskWithTraitsAndReplyWithResult( |
| 269 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 269 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 270 base::TaskPriority::BACKGROUND), | |
| 271 base::Bind(&ArcAppIcon::ReadOnFileThread, scale_factor, path, | 270 base::Bind(&ArcAppIcon::ReadOnFileThread, scale_factor, path, |
| 272 prefs->MaybeGetIconPathForDefaultApp(app_id_, scale_factor)), | 271 prefs->MaybeGetIconPathForDefaultApp(app_id_, scale_factor)), |
| 273 base::Bind(&ArcAppIcon::OnIconRead, weak_ptr_factory_.GetWeakPtr())); | 272 base::Bind(&ArcAppIcon::OnIconRead, weak_ptr_factory_.GetWeakPtr())); |
| 274 } | 273 } |
| 275 | 274 |
| 276 void ArcAppIcon::MaybeRequestIcon(ui::ScaleFactor scale_factor) { | 275 void ArcAppIcon::MaybeRequestIcon(ui::ScaleFactor scale_factor) { |
| 277 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 276 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 278 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context_); | 277 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context_); |
| 279 DCHECK(prefs); | 278 DCHECK(prefs); |
| 280 | 279 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 void ArcAppIcon::DiscardDecodeRequest(DecodeRequest* request) { | 370 void ArcAppIcon::DiscardDecodeRequest(DecodeRequest* request) { |
| 372 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 371 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 373 | 372 |
| 374 auto it = std::find_if(decode_requests_.begin(), decode_requests_.end(), | 373 auto it = std::find_if(decode_requests_.begin(), decode_requests_.end(), |
| 375 [request](const std::unique_ptr<DecodeRequest>& ptr) { | 374 [request](const std::unique_ptr<DecodeRequest>& ptr) { |
| 376 return ptr.get() == request; | 375 return ptr.get() == request; |
| 377 }); | 376 }); |
| 378 CHECK(it != decode_requests_.end()); | 377 CHECK(it != decode_requests_.end()); |
| 379 decode_requests_.erase(it); | 378 decode_requests_.erase(it); |
| 380 } | 379 } |
| OLD | NEW |