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

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_icon.cc

Issue 2865813002: arc: Prevent overwriting of the Chrome Play Store icon. (Closed)
Patch Set: Created 3 years, 7 months 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/notifications/arc_application_notifier_source_chromeos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 Observer* observer) 245 Observer* observer)
246 : context_(context), 246 : context_(context),
247 app_id_(GetAppFromAppOrGroupId(context, app_id)), 247 app_id_(GetAppFromAppOrGroupId(context, app_id)),
248 resource_size_in_dip_(resource_size_in_dip), 248 resource_size_in_dip_(resource_size_in_dip),
249 observer_(observer), 249 observer_(observer),
250 weak_ptr_factory_(this) { 250 weak_ptr_factory_(this) {
251 CHECK(observer_ != nullptr); 251 CHECK(observer_ != nullptr);
252 source_ = new Source(weak_ptr_factory_.GetWeakPtr(), resource_size_in_dip); 252 source_ = new Source(weak_ptr_factory_.GetWeakPtr(), resource_size_in_dip);
253 gfx::Size resource_size(resource_size_in_dip, resource_size_in_dip); 253 gfx::Size resource_size(resource_size_in_dip, resource_size_in_dip);
254 image_skia_ = gfx::ImageSkia(source_, resource_size); 254 image_skia_ = gfx::ImageSkia(source_, resource_size);
255 image_ = gfx::Image(image_skia_);
khmel 2017/05/06 01:03:36 This fixes yet another problem, when in case someb
xiyuan 2017/05/08 16:15:13 Get rid of this member and make image() to do the
khmel 2017/05/08 16:36:07 Yes, it is rather confusing than helpful. Discarde
255 } 256 }
256 257
257 ArcAppIcon::~ArcAppIcon() { 258 ArcAppIcon::~ArcAppIcon() {
258 } 259 }
259 260
260 void ArcAppIcon::LoadForScaleFactor(ui::ScaleFactor scale_factor) { 261 void ArcAppIcon::LoadForScaleFactor(ui::ScaleFactor scale_factor) {
khmel 2017/05/06 01:03:36 LoadForScaleFactor is internal ARC Icon function a
xiyuan 2017/05/08 16:15:13 Make this private and make ArcAppIconLoader/ArcMod
khmel 2017/05/08 16:36:07 Done.
261 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context_); 262 // We provide Play Store icon from Chrome resources and it is not expected
263 // that we have external load request.
264 DCHECK_NE(app_id_, arc::kPlayStoreAppId);
265
266 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(context_);
262 DCHECK(prefs); 267 DCHECK(prefs);
263 268
264 base::FilePath path = prefs->GetIconPath(app_id_, scale_factor); 269 const base::FilePath path = prefs->GetIconPath(app_id_, scale_factor);
265 if (path.empty()) 270 if (path.empty())
266 return; 271 return;
267 272
268 base::PostTaskWithTraitsAndReplyWithResult( 273 base::PostTaskWithTraitsAndReplyWithResult(
269 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, 274 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
270 base::Bind(&ArcAppIcon::ReadOnFileThread, scale_factor, path, 275 base::Bind(&ArcAppIcon::ReadOnFileThread, scale_factor, path,
271 prefs->MaybeGetIconPathForDefaultApp(app_id_, scale_factor)), 276 prefs->MaybeGetIconPathForDefaultApp(app_id_, scale_factor)),
272 base::Bind(&ArcAppIcon::OnIconRead, weak_ptr_factory_.GetWeakPtr())); 277 base::Bind(&ArcAppIcon::OnIconRead, weak_ptr_factory_.GetWeakPtr()));
273 } 278 }
274 279
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 void ArcAppIcon::DiscardDecodeRequest(DecodeRequest* request) { 375 void ArcAppIcon::DiscardDecodeRequest(DecodeRequest* request) {
371 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 376 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
372 377
373 auto it = std::find_if(decode_requests_.begin(), decode_requests_.end(), 378 auto it = std::find_if(decode_requests_.begin(), decode_requests_.end(),
374 [request](const std::unique_ptr<DecodeRequest>& ptr) { 379 [request](const std::unique_ptr<DecodeRequest>& ptr) {
375 return ptr.get() == request; 380 return ptr.get() == request;
376 }); 381 });
377 CHECK(it != decode_requests_.end()); 382 CHECK(it != decode_requests_.end());
378 decode_requests_.erase(it); 383 decode_requests_.erase(it);
379 } 384 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/arc_application_notifier_source_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698