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

Side by Side Diff: chrome/browser/ui/views/aura/launcher/launcher_icon_loader.cc

Issue 9586018: Add support for multiple icon sizes for Mac platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 8 years, 9 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 | Annotate | Revision Log
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/aura/launcher/launcher_icon_loader.h" 5 #include "chrome/browser/ui/views/aura/launcher/launcher_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_wrapper.h" 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 map_[image_loader_->next_id()] = id; 44 map_[image_loader_->next_id()] = id;
45 image_loader_->LoadImage( 45 image_loader_->LoadImage(
46 extension, 46 extension,
47 extension->GetIconResource(ExtensionIconSet::EXTENSION_ICON_SMALL, 47 extension->GetIconResource(ExtensionIconSet::EXTENSION_ICON_SMALL,
48 ExtensionIconSet::MATCH_BIGGER), 48 ExtensionIconSet::MATCH_BIGGER),
49 gfx::Size(ExtensionIconSet::EXTENSION_ICON_SMALL, 49 gfx::Size(ExtensionIconSet::EXTENSION_ICON_SMALL,
50 ExtensionIconSet::EXTENSION_ICON_SMALL), 50 ExtensionIconSet::EXTENSION_ICON_SMALL),
51 ImageLoadingTracker::CACHE); 51 ImageLoadingTracker::CACHE);
52 } 52 }
53 53
54 void LauncherIconLoader::OnImageLoaded(SkBitmap* image, 54 void LauncherIconLoader::OnImageLoaded(const gfx::Image& image,
55 const ExtensionResource& resource, 55 const std::string& extension_id,
56 int index) { 56 int index) {
57 ImageLoaderIDToExtensionIDMap::iterator i = map_.find(index); 57 ImageLoaderIDToExtensionIDMap::iterator i = map_.find(index);
58 if (i == map_.end()) 58 if (i == map_.end())
59 return; // The tab has since been removed, do nothing. 59 return; // The tab has since been removed, do nothing.
60 60
61 std::string id = i->second; 61 std::string id = i->second;
62 map_.erase(i); 62 map_.erase(i);
63 host_->SetAppImage(id, image); 63 if (image.IsEmpty())
64 host_->SetAppImage(id, NULL);
65 else
66 host_->SetAppImage(id, image.ToSkBitmap());
64 } 67 }
65 68
66 const Extension* LauncherIconLoader::GetExtensionForTab( 69 const Extension* LauncherIconLoader::GetExtensionForTab(
67 TabContentsWrapper* tab) { 70 TabContentsWrapper* tab) {
68 ExtensionService* extension_service = profile_->GetExtensionService(); 71 ExtensionService* extension_service = profile_->GetExtensionService();
69 if (!extension_service) 72 if (!extension_service)
70 return NULL; 73 return NULL;
71 return extension_service->GetInstalledApp(tab->web_contents()->GetURL()); 74 return extension_service->GetInstalledApp(tab->web_contents()->GetURL());
72 } 75 }
73 76
74 const Extension* LauncherIconLoader::GetExtensionByID(const std::string& id) { 77 const Extension* LauncherIconLoader::GetExtensionByID(const std::string& id) {
75 ExtensionService* service = profile_->GetExtensionService(); 78 ExtensionService* service = profile_->GetExtensionService();
76 if (!service) 79 if (!service)
77 return NULL; 80 return NULL;
78 return service->GetInstalledExtension(id); 81 return service->GetInstalledExtension(id);
79 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/aura/launcher/launcher_icon_loader.h ('k') | chrome/browser/ui/views/browser_actions_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698