#include "chrome/browser/ui/views/elevation_icon_setter.h"
#include "base/functional/bind.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/views/controls/button/label_button.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include <shellapi.h>
#include "base/win/win_util.h"
#include "ui/display/win/dpi.h"
#include "ui/gfx/icon_util.h"
#endif
namespace {
#if BUILDFLAG(IS_WIN)
SkBitmap GetElevationIcon() {
if (!base::win::UserAccountControlIsEnabled())
return SkBitmap();
SHSTOCKICONINFO icon_info = { sizeof(SHSTOCKICONINFO) };
if (FAILED(SHGetStockIconInfo(SIID_SHIELD, SHGSI_ICON | SHGSI_SMALLICON,
&icon_info)))
return SkBitmap();
SkBitmap icon = IconUtil::CreateSkBitmapFromHICON(
icon_info.hIcon,
gfx::Size(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)));
DestroyIcon(icon_info.hIcon);
return icon;
}
#endif
}
ElevationIconSetter::ElevationIconSetter(views::LabelButton* button)
: … { … }
ElevationIconSetter::~ElevationIconSetter() { … }
void ElevationIconSetter::SetButtonIcon(const SkBitmap& icon) { … }