#include "extensions/browser/extension_action.h"
#include <algorithm>
#include <memory>
#include <utility>
#include "base/base64.h"
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/strings/string_number_conversions.h"
#include "extensions/browser/extension_icon_image.h"
#include "extensions/browser/extension_icon_placeholder.h"
#include "extensions/common/constants.h"
#include "extensions/common/icons/extension_icon_set.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "skia/public/mojom/bitmap.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/image/image_skia_source.h"
#include "ui/gfx/skbitmap_operations.h"
#include "url/gurl.h"
namespace extensions {
namespace {
class GetAttentionImageSource : public gfx::ImageSkiaSource { … };
struct IconRepresentationInfo { … };
template <class T>
bool HasValue(const std::map<int, T>& map, int tab_id) { … }
}
extension_misc::ExtensionIcons ExtensionAction::ActionIconSize() { … }
gfx::Image ExtensionAction::FallbackIcon() { … }
const int ExtensionAction::kDefaultTabId = …;
ExtensionAction::ExtensionAction(const Extension& extension,
const ActionInfo& manifest_data)
: … { … }
ExtensionAction::~ExtensionAction() = default;
void ExtensionAction::SetPopupUrl(int tab_id, const GURL& url) { … }
bool ExtensionAction::HasPopup(int tab_id) const { … }
GURL ExtensionAction::GetPopupUrl(int tab_id) const { … }
void ExtensionAction::SetIcon(int tab_id, const gfx::Image& image) { … }
ExtensionAction::IconParseResult ExtensionAction::ParseIconFromCanvasDictionary(
const base::Value::Dict& dict,
gfx::ImageSkia* icon) { … }
gfx::Image ExtensionAction::GetExplicitlySetIcon(int tab_id) const { … }
bool ExtensionAction::SetIsVisible(int tab_id, bool new_visibility) { … }
void ExtensionAction::DeclarativeShow(int tab_id) { … }
void ExtensionAction::UndoDeclarativeShow(int tab_id) { … }
void ExtensionAction::DeclarativeSetIcon(int tab_id,
int priority,
const gfx::Image& icon) { … }
void ExtensionAction::UndoDeclarativeSetIcon(int tab_id,
int priority,
const gfx::Image& icon) { … }
const gfx::Image ExtensionAction::GetDeclarativeIcon(int tab_id) const { … }
void ExtensionAction::ClearAllValuesForTab(int tab_id) { … }
void ExtensionAction::SetDefaultIconImage(
std::unique_ptr<IconImage> icon_image) { … }
gfx::Image ExtensionAction::GetDefaultIconImage() const { … }
gfx::Image ExtensionAction::GetPlaceholderIconImage() const { … }
std::string ExtensionAction::GetDisplayBadgeText(int tab_id) const { … }
bool ExtensionAction::HasPopupUrl(int tab_id) const { … }
bool ExtensionAction::HasTitle(int tab_id) const { … }
bool ExtensionAction::HasBadgeText(int tab_id) const { … }
bool ExtensionAction::HasBadgeBackgroundColor(int tab_id) const { … }
bool ExtensionAction::HasBadgeTextColor(int tab_id) const { … }
bool ExtensionAction::HasIsVisible(int tab_id) const { … }
bool ExtensionAction::HasIcon(int tab_id) const { … }
bool ExtensionAction::HasDNRActionCount(int tab_id) const { … }
void ExtensionAction::SetDefaultIconForTest(
std::unique_ptr<ExtensionIconSet> default_icon) { … }
void ExtensionAction::Populate(const Extension& extension,
const ActionInfo& manifest_data) { … }
int ExtensionAction::GetIconWidth(int tab_id) const { … }
bool ExtensionAction::GetIsVisibleInternal(int tab_id,
bool include_declarative) const { … }
}