| 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/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void LauncherAppIconLoader::OnImageLoaded(const gfx::Image& image, | 56 void LauncherAppIconLoader::OnImageLoaded(const gfx::Image& image, |
| 57 const std::string& extension_id, | 57 const std::string& extension_id, |
| 58 int index) { | 58 int index) { |
| 59 ImageLoaderIDToExtensionIDMap::iterator i = map_.find(index); | 59 ImageLoaderIDToExtensionIDMap::iterator i = map_.find(index); |
| 60 if (i == map_.end()) | 60 if (i == map_.end()) |
| 61 return; // The tab has since been removed, do nothing. | 61 return; // The tab has since been removed, do nothing. |
| 62 | 62 |
| 63 std::string id = i->second; | 63 std::string id = i->second; |
| 64 map_.erase(i); | 64 map_.erase(i); |
| 65 if (image.IsEmpty()) | 65 if (image.IsEmpty()) |
| 66 host_->SetAppImage(id, NULL); | 66 host_->SetAppImage(id, extensions::Extension::GetDefaultIcon(true)); |
| 67 else | 67 else |
| 68 host_->SetAppImage(id, image.ToSkBitmap()); | 68 host_->SetAppImage(id, *image.ToImageSkia()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 const extensions::Extension* LauncherAppIconLoader::GetExtensionForTab( | 71 const extensions::Extension* LauncherAppIconLoader::GetExtensionForTab( |
| 72 TabContents* tab) { | 72 TabContents* tab) { |
| 73 ExtensionService* extension_service = profile_->GetExtensionService(); | 73 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 74 if (!extension_service) | 74 if (!extension_service) |
| 75 return NULL; | 75 return NULL; |
| 76 return extension_service->GetInstalledApp(tab->web_contents()->GetURL()); | 76 return extension_service->GetInstalledApp(tab->web_contents()->GetURL()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 const extensions::Extension* LauncherAppIconLoader::GetExtensionByID( | 79 const extensions::Extension* LauncherAppIconLoader::GetExtensionByID( |
| 80 const std::string& id) { | 80 const std::string& id) { |
| 81 ExtensionService* service = profile_->GetExtensionService(); | 81 ExtensionService* service = profile_->GetExtensionService(); |
| 82 if (!service) | 82 if (!service) |
| 83 return NULL; | 83 return NULL; |
| 84 return service->extensions()->GetByID(id); | 84 return service->extensions()->GetByID(id); |
| 85 } | 85 } |
| OLD | NEW |