| OLD | NEW |
| 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 Loading... |
| 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 host_->SetAppImage(id, image.ToSkBitmap()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 const Extension* LauncherIconLoader::GetExtensionForTab( | 66 const Extension* LauncherIconLoader::GetExtensionForTab( |
| 67 TabContentsWrapper* tab) { | 67 TabContentsWrapper* tab) { |
| 68 ExtensionService* extension_service = profile_->GetExtensionService(); | 68 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 69 if (!extension_service) | 69 if (!extension_service) |
| 70 return NULL; | 70 return NULL; |
| 71 return extension_service->GetInstalledApp(tab->web_contents()->GetURL()); | 71 return extension_service->GetInstalledApp(tab->web_contents()->GetURL()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 const Extension* LauncherIconLoader::GetExtensionByID(const std::string& id) { | 74 const Extension* LauncherIconLoader::GetExtensionByID(const std::string& id) { |
| 75 ExtensionService* service = profile_->GetExtensionService(); | 75 ExtensionService* service = profile_->GetExtensionService(); |
| 76 if (!service) | 76 if (!service) |
| 77 return NULL; | 77 return NULL; |
| 78 return service->GetInstalledExtension(id); | 78 return service->GetInstalledExtension(id); |
| 79 } | 79 } |
| OLD | NEW |