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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 int resource_size_in_dip) | 120 int resource_size_in_dip) |
121 : host_(host), | 121 : host_(host), |
122 resource_size_in_dip_(resource_size_in_dip) { | 122 resource_size_in_dip_(resource_size_in_dip) { |
123 } | 123 } |
124 | 124 |
125 ArcAppIcon::Source::~Source() { | 125 ArcAppIcon::Source::~Source() { |
126 } | 126 } |
127 | 127 |
128 gfx::ImageSkiaRep ArcAppIcon::Source::GetImageForScale(float scale) { | 128 gfx::ImageSkiaRep ArcAppIcon::Source::GetImageForScale(float scale) { |
129 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 129 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
130 if (host_) | |
131 host_->LoadForScaleFactor(ui::GetSupportedScaleFactor(scale)); | |
132 | 130 |
133 // Host loads icon asynchronously, so use default icon so far. | 131 // Host loads icon asynchronously, so use default icon so far. |
134 int resource_id; | 132 int resource_id; |
135 if (host_ && host_->app_id() == arc::kPlayStoreAppId) { | 133 if (host_ && host_->app_id() == arc::kPlayStoreAppId) { |
| 134 // Don't request icon from Android side. Use overloaded Chrome icon for Play |
| 135 // Store that is adopted according Chrome style. |
136 resource_id = scale >= 1.5f ? | 136 resource_id = scale >= 1.5f ? |
137 IDR_ARC_SUPPORT_ICON_96 : IDR_ARC_SUPPORT_ICON_48; | 137 IDR_ARC_SUPPORT_ICON_96 : IDR_ARC_SUPPORT_ICON_48; |
138 } else { | 138 } else { |
| 139 if (host_) |
| 140 host_->LoadForScaleFactor(ui::GetSupportedScaleFactor(scale)); |
139 resource_id = IDR_APP_DEFAULT_ICON; | 141 resource_id = IDR_APP_DEFAULT_ICON; |
140 } | 142 } |
141 | 143 |
142 // Check |default_icons_cache_| and returns the existing one if possible. | 144 // Check |default_icons_cache_| and returns the existing one if possible. |
143 const auto key = std::make_pair(resource_id, resource_size_in_dip_); | 145 const auto key = std::make_pair(resource_id, resource_size_in_dip_); |
144 const auto it = default_icons_cache_.Get().find(key); | 146 const auto it = default_icons_cache_.Get().find(key); |
145 if (it != default_icons_cache_.Get().end()) | 147 if (it != default_icons_cache_.Get().end()) |
146 return it->second.GetRepresentation(scale); | 148 return it->second.GetRepresentation(scale); |
147 | 149 |
148 const gfx::ImageSkia* default_image = ResourceBundle::GetSharedInstance(). | 150 const gfx::ImageSkia* default_image = ResourceBundle::GetSharedInstance(). |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 365 |
364 void ArcAppIcon::DiscardDecodeRequest(DecodeRequest* request) { | 366 void ArcAppIcon::DiscardDecodeRequest(DecodeRequest* request) { |
365 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 367 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
366 | 368 |
367 ScopedVector<DecodeRequest>::iterator it = std::find(decode_requests_.begin(), | 369 ScopedVector<DecodeRequest>::iterator it = std::find(decode_requests_.begin(), |
368 decode_requests_.end(), | 370 decode_requests_.end(), |
369 request); | 371 request); |
370 CHECK(it != decode_requests_.end()); | 372 CHECK(it != decode_requests_.end()); |
371 decode_requests_.erase(it); | 373 decode_requests_.erase(it); |
372 } | 374 } |
OLD | NEW |