// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ #define EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/scoped_observation.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry_observer.h" #include "extensions/common/icons/extension_icon_set.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia.h" namespace content { class BrowserContext; } namespace extensions { class Extension; } namespace gfx { class Image; } namespace extensions { // A class that provides an ImageSkia for UI code to use. It handles extension // icon resource loading, screen scale factor change etc. UI code that uses // extension icon should host this class. In painting code, UI code paints with // the ImageSkia provided by this class. If the required extension icon resource // is not already present, this class tries to load it and calls its observer // interface when the image get updated. Until the resource is loaded, the UI // code will be provided with a blank, transparent image. // If the requested resource doesn't exist or can't be loaded and a default // icon was supplied in the constructor, icon image will be updated with the // default icon's resource. // The default icon doesn't need to be supplied, but in that case, icon image // representation will be left blank if the resource loading fails. // If default icon is supplied, it is assumed that it contains or can // synchronously create (when |GetRepresentation| is called on it) // representations for all the scale factors supported by the current platform. // Note that |IconImage| is not thread safe. class IconImage : public ExtensionRegistryObserver { … }; } // namespace extensions #endif // EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_