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

Side by Side Diff: chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc

Issue 10830123: crbug.com/124865 - DCHECK failure when pinning Chrome Web Store to Launcher (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add check (!resource.empty()) to ImageLoadingTracker Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/ash/launcher/launcher_app_icon_loader.h" 5 #include "chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h"
6 6
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents.h" 9 #include "chrome/browser/ui/tab_contents/tab_contents.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 27 matching lines...) Expand all
38 if (i->second == id) 38 if (i->second == id)
39 return; // Already loading the image. 39 return; // Already loading the image.
40 } 40 }
41 41
42 const extensions::Extension* extension = GetExtensionByID(profile_, id); 42 const extensions::Extension* extension = GetExtensionByID(profile_, id);
43 if (!extension) 43 if (!extension)
44 return; 44 return;
45 if (!image_loader_.get()) 45 if (!image_loader_.get())
46 image_loader_.reset(new ImageLoadingTracker(this)); 46 image_loader_.reset(new ImageLoadingTracker(this));
47 map_[image_loader_->next_id()] = id; 47 map_[image_loader_->next_id()] = id;
48 ExtensionResource extension_resource =
49 extension->GetIconResource(ExtensionIconSet::EXTENSION_ICON_SMALL,
Aaron Boodman 2012/08/08 21:42:01 You can undo these changes now, right?
sschmitz 2012/08/08 22:04:30 Done.
50 ExtensionIconSet::MATCH_BIGGER);
48 image_loader_->LoadImage( 51 image_loader_->LoadImage(
49 extension, 52 extension,
50 extension->GetIconResource(ExtensionIconSet::EXTENSION_ICON_SMALL, 53 extension_resource,
51 ExtensionIconSet::MATCH_BIGGER),
52 gfx::Size(ExtensionIconSet::EXTENSION_ICON_SMALL, 54 gfx::Size(ExtensionIconSet::EXTENSION_ICON_SMALL,
53 ExtensionIconSet::EXTENSION_ICON_SMALL), 55 ExtensionIconSet::EXTENSION_ICON_SMALL),
54 ImageLoadingTracker::CACHE); 56 extension_resource.empty() ? ImageLoadingTracker::DONT_CACHE :
57 ImageLoadingTracker::CACHE);
55 } 58 }
56 59
57 void LauncherAppIconLoader::OnImageLoaded(const gfx::Image& image, 60 void LauncherAppIconLoader::OnImageLoaded(const gfx::Image& image,
58 const std::string& extension_id, 61 const std::string& extension_id,
59 int index) { 62 int index) {
60 ImageLoaderIDToExtensionIDMap::iterator i = map_.find(index); 63 ImageLoaderIDToExtensionIDMap::iterator i = map_.find(index);
61 if (i == map_.end()) 64 if (i == map_.end())
62 return; // The tab has since been removed, do nothing. 65 return; // The tab has since been removed, do nothing.
63 66
64 std::string id = i->second; 67 std::string id = i->second;
65 map_.erase(i); 68 map_.erase(i);
66 if (image.IsEmpty()) 69 if (image.IsEmpty())
67 host_->SetAppImage(id, extensions::Extension::GetDefaultIcon(true)); 70 host_->SetAppImage(id, extensions::Extension::GetDefaultIcon(true));
68 else 71 else
69 host_->SetAppImage(id, *image.ToImageSkia()); 72 host_->SetAppImage(id, *image.ToImageSkia());
70 } 73 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.cc ('k') | chrome/common/extensions/extension_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698