| 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 | 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 ArcAppIcon::Source::~Source() { | 80 ArcAppIcon::Source::~Source() { |
| 81 } | 81 } |
| 82 | 82 |
| 83 gfx::ImageSkiaRep ArcAppIcon::Source::GetImageForScale(float scale) { | 83 gfx::ImageSkiaRep ArcAppIcon::Source::GetImageForScale(float scale) { |
| 84 if (host_) | 84 if (host_) |
| 85 host_->LoadForScaleFactor(ui::GetSupportedScaleFactor(scale)); | 85 host_->LoadForScaleFactor(ui::GetSupportedScaleFactor(scale)); |
| 86 | 86 |
| 87 // Host loads icon asynchronously, so use default icon so far. | 87 // Host loads icon asynchronously, so use default icon so far. |
| 88 const int resource_id = host_ && host_->app_id() == arc::kPlayStoreAppId ? | 88 int resource_id; |
| 89 IDR_ARC_SUPPORT_ICON : IDR_APP_DEFAULT_ICON; | 89 if (host_ && host_->app_id() == arc::kPlayStoreAppId) { |
| 90 resource_id = scale >= 1.5f ? |
| 91 IDR_ARC_SUPPORT_ICON_48 : IDR_ARC_SUPPORT_ICON_96; |
| 92 } else { |
| 93 resource_id = IDR_APP_DEFAULT_ICON; |
| 94 } |
| 90 const gfx::ImageSkia* default_image = ResourceBundle::GetSharedInstance(). | 95 const gfx::ImageSkia* default_image = ResourceBundle::GetSharedInstance(). |
| 91 GetImageSkiaNamed(resource_id); | 96 GetImageSkiaNamed(resource_id); |
| 92 CHECK(default_image); | 97 CHECK(default_image); |
| 93 return gfx::ImageSkiaOperations::CreateResizedImage( | 98 return gfx::ImageSkiaOperations::CreateResizedImage( |
| 94 *default_image, | 99 *default_image, |
| 95 skia::ImageOperations::RESIZE_BEST, | 100 skia::ImageOperations::RESIZE_BEST, |
| 96 gfx::Size(resource_size_in_dip_, resource_size_in_dip_)). | 101 gfx::Size(resource_size_in_dip_, resource_size_in_dip_)). |
| 97 GetRepresentation(scale); | 102 GetRepresentation(scale); |
| 98 } | 103 } |
| 99 | 104 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 306 |
| 302 void ArcAppIcon::DiscardDecodeRequest(DecodeRequest* request) { | 307 void ArcAppIcon::DiscardDecodeRequest(DecodeRequest* request) { |
| 303 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 308 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 304 | 309 |
| 305 ScopedVector<DecodeRequest>::iterator it = std::find(decode_requests_.begin(), | 310 ScopedVector<DecodeRequest>::iterator it = std::find(decode_requests_.begin(), |
| 306 decode_requests_.end(), | 311 decode_requests_.end(), |
| 307 request); | 312 request); |
| 308 CHECK(it != decode_requests_.end()); | 313 CHECK(it != decode_requests_.end()); |
| 309 decode_requests_.erase(it); | 314 decode_requests_.erase(it); |
| 310 } | 315 } |
| OLD | NEW |