Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
jkleinsc committed Jan 11, 2021
1 parent 1339296 commit c03b688
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
9 changes: 4 additions & 5 deletions shell/browser/browser_win.cc
Expand Up @@ -658,7 +658,7 @@ bool Browser::SetBadgeCount(base::Optional<int> count) {
}

void Browser::UpdateBadgeContents(HWND hwnd) {
auto badge = std::make_unique<SkBitmap>();
SkBitmap badge;
if (badge_content_) {
std::string content = badge_content_.value();
constexpr int kOverlayIconSize = 16;
Expand All @@ -674,9 +674,8 @@ void Browser::UpdateBadgeContents(HWND hwnd) {
constexpr int kMaxTextSize = 24; // Max size for our text.
constexpr int kMinTextSize = 7; // Min size for our text.

badge->allocN32Pixels(kOverlayIconSize, kOverlayIconSize);
SkCanvas canvas(*badge.get(),
skia::LegacyDisplayGlobals::GetSkSurfaceProps());
badge.allocN32Pixels(kOverlayIconSize, kOverlayIconSize);
SkCanvas canvas(badge, skia::LegacyDisplayGlobals::GetSkSurfaceProps());

SkPaint paint;
paint.setAntiAlias(true);
Expand Down Expand Up @@ -706,7 +705,7 @@ void Browser::UpdateBadgeContents(HWND hwnd) {
kRadius - bounds.width() / 2 - bounds.x(),
kRadius - bounds.height() / 2 - bounds.y(), font, paint);
}
taskbar_host_.SetOverlayIcon(hwnd, badge.get(), badge_alt_string_);
taskbar_host_.SetOverlayIcon(hwnd, badge, badge_alt_string_);
}

void Browser::SetLoginItemSettings(LoginItemSettings settings) {
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/native_window_views.cc
Expand Up @@ -1209,7 +1209,7 @@ void NativeWindowViews::SetOverlayIcon(const gfx::Image& overlay,
const std::string& description) {
#if defined(OS_WIN)
SkBitmap overlay_bitmap = overlay.AsBitmap();
taskbar_host_.SetOverlayIcon(GetAcceleratedWidget(), &overlay_bitmap,
taskbar_host_.SetOverlayIcon(GetAcceleratedWidget(), overlay_bitmap,
description);
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions shell/browser/ui/win/taskbar_host.cc
Expand Up @@ -166,12 +166,12 @@ bool TaskbarHost::SetProgressBar(HWND window,
}

bool TaskbarHost::SetOverlayIcon(HWND window,
SkBitmap* overlay,
const SkBitmap& overlay,
const std::string& text) {
if (!InitializeTaskbar())
return false;

base::win::ScopedHICON icon(IconUtil::CreateHICONFromSkBitmap(*overlay));
base::win::ScopedHICON icon(IconUtil::CreateHICONFromSkBitmap(overlay));
return SUCCEEDED(taskbar_->SetOverlayIcon(window, icon.get(),
base::UTF8ToUTF16(text).c_str()));
}
Expand Down
4 changes: 3 additions & 1 deletion shell/browser/ui/win/taskbar_host.h
Expand Up @@ -47,7 +47,9 @@ class TaskbarHost {
const NativeWindow::ProgressState state);

// Set the overlay icon in taskbar.
bool SetOverlayIcon(HWND window, SkBitmap* overlay, const std::string& text);
bool SetOverlayIcon(HWND window,
const SkBitmap& overlay,
const std::string& text);

// Set the region of the window to show as a thumbnail in taskbar.
bool SetThumbnailClip(HWND window, const gfx::Rect& region);
Expand Down

0 comments on commit c03b688

Please sign in to comment.