Commit 02bf1430 authored by nancy's avatar nancy Committed by Commit Bot

Remove internal app icon loader.

BUG=1016159

Change-Id: I9e80e8f759cc2f96dd15b5a2f5c06eafac92fd95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032758Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737987}
parent 91751899
......@@ -3695,8 +3695,6 @@ jumbo_static_library("ui") {
"app_list/extension_uninstaller.h",
"app_list/internal_app/internal_app_context_menu.cc",
"app_list/internal_app/internal_app_context_menu.h",
"app_list/internal_app/internal_app_icon_loader.cc",
"app_list/internal_app/internal_app_icon_loader.h",
"app_list/internal_app/internal_app_item.cc",
"app_list/internal_app/internal_app_item.h",
"app_list/internal_app/internal_app_metadata.cc",
......
// Copyright 2018 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/app_list/internal_app/internal_app_icon_loader.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/internal_app/internal_app_metadata.h"
InternalAppIconLoader::InternalAppIconLoader(Profile* profile,
int resource_size_in_dip,
AppIconLoaderDelegate* delegate)
: AppIconLoader(profile, resource_size_in_dip, delegate) {}
InternalAppIconLoader::~InternalAppIconLoader() = default;
bool InternalAppIconLoader::CanLoadImageForApp(const std::string& app_id) {
if (icon_map_.find(app_id) != icon_map_.end())
return true;
return app_list::IsInternalApp(app_id);
}
void InternalAppIconLoader::FetchImage(const std::string& app_id) {
if (icon_map_.find(app_id) != icon_map_.end())
return;
gfx::ImageSkia image_skia(app_list::GetIconForResourceId(
app_list::GetIconResourceIdByAppId(app_id), icon_size_in_dip()));
image_skia.EnsureRepsForSupportedScales();
icon_map_[app_id] = image_skia;
UpdateImage(app_id);
}
void InternalAppIconLoader::ClearImage(const std::string& app_id) {
icon_map_.erase(app_id);
}
void InternalAppIconLoader::UpdateImage(const std::string& app_id) {
AppIDToIconMap::const_iterator it = icon_map_.find(app_id);
if (it == icon_map_.end())
return;
delegate()->OnAppImageUpdated(app_id, it->second);
}
// Copyright 2018 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.
#ifndef CHROME_BROWSER_UI_APP_LIST_INTERNAL_APP_INTERNAL_APP_ICON_LOADER_H_
#define CHROME_BROWSER_UI_APP_LIST_INTERNAL_APP_INTERNAL_APP_ICON_LOADER_H_
#include <map>
#include <string>
#include "base/macros.h"
#include "chrome/browser/ui/app_icon_loader.h"
#include "ui/gfx/image/image_skia.h"
class Profile;
// An AppIconLoader that loads icons for internal apps. e.g. Settings.
class InternalAppIconLoader : public AppIconLoader {
public:
InternalAppIconLoader(Profile* profile,
int resource_size_in_dip,
AppIconLoaderDelegate* delegate);
~InternalAppIconLoader() override;
// AppIconLoader:
bool CanLoadImageForApp(const std::string& app_id) override;
void FetchImage(const std::string& app_id) override;
void ClearImage(const std::string& app_id) override;
void UpdateImage(const std::string& app_id) override;
private:
using AppIDToIconMap = std::map<std::string, gfx::ImageSkia>;
// Maps from internal app id to icon.
AppIDToIconMap icon_map_;
DISALLOW_COPY_AND_ASSIGN(InternalAppIconLoader);
};
#endif // CHROME_BROWSER_UI_APP_LIST_INTERNAL_APP_INTERNAL_APP_ICON_LOADER_H_
......@@ -38,7 +38,6 @@
#include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/app_list/crostini/crostini_app_icon_loader.h"
#include "chrome/browser/ui/app_list/internal_app/internal_app_icon_loader.h"
#include "chrome/browser/ui/app_list/md_icon_normalizer.h"
#include "chrome/browser/ui/apps/app_info_dialog.h"
#include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
......@@ -1333,11 +1332,6 @@ void ChromeLauncherController::AttachProfile(Profile* profile_to_attach) {
app_icon_loaders_.push_back(std::move(arc_app_icon_loader));
}
std::unique_ptr<AppIconLoader> internal_app_icon_loader =
std::make_unique<InternalAppIconLoader>(
profile_, extension_misc::EXTENSION_ICON_MEDIUM, this);
app_icon_loaders_.push_back(std::move(internal_app_icon_loader));
if (crostini::CrostiniFeatures::Get()->IsUIAllowed(profile_)) {
std::unique_ptr<AppIconLoader> crostini_app_icon_loader =
std::make_unique<CrostiniAppIconLoader>(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment