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

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

Issue 10855094: launcher: Remove old files and update DEPS whitelist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc
diff --git a/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc b/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc
deleted file mode 100644
index 4f6060d58c058e2f500dde72acca8e5201bb1354..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h"
-
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
-#include "chrome/common/extensions/extension.h"
-
-namespace {
-
-const extensions::Extension* GetExtensionByID(Profile* profile,
- const std::string& id) {
- ExtensionService* service = profile->GetExtensionService();
- if (!service)
- return NULL;
- return service->extensions()->GetByID(id);
-}
-
-} // namespace
-
-
-LauncherAppIconLoader::LauncherAppIconLoader(
- Profile* profile,
- ChromeLauncherController* controller)
- : profile_(profile),
- host_(controller) {
-}
-
-LauncherAppIconLoader::~LauncherAppIconLoader() {
-}
-
-void LauncherAppIconLoader::FetchImage(const std::string& id) {
- for (ImageLoaderIDToExtensionIDMap::const_iterator i = map_.begin();
- i != map_.end(); ++i) {
- if (i->second == id)
- return; // Already loading the image.
- }
-
- const extensions::Extension* extension = GetExtensionByID(profile_, id);
- if (!extension)
- return;
- if (!image_loader_.get())
- image_loader_.reset(new ImageLoadingTracker(this));
- map_[image_loader_->next_id()] = id;
- image_loader_->LoadImage(
- extension,
- extension->GetIconResource(ExtensionIconSet::EXTENSION_ICON_SMALL,
- ExtensionIconSet::MATCH_BIGGER),
- gfx::Size(ExtensionIconSet::EXTENSION_ICON_SMALL,
- ExtensionIconSet::EXTENSION_ICON_SMALL),
- ImageLoadingTracker::CACHE);
-}
-
-void LauncherAppIconLoader::OnImageLoaded(const gfx::Image& image,
- const std::string& extension_id,
- int index) {
- ImageLoaderIDToExtensionIDMap::iterator i = map_.find(index);
- if (i == map_.end())
- return; // The tab has since been removed, do nothing.
-
- std::string id = i->second;
- map_.erase(i);
- if (image.IsEmpty())
- host_->SetAppImage(id, extensions::Extension::GetDefaultIcon(true));
- else
- host_->SetAppImage(id, *image.ToImageSkia());
-}

Powered by Google App Engine
This is Rietveld 408576698