-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated toolbar download button style (uplift to 1.50.x) (#17811)
Merge pull request #17769 from brave/update_download_button_style Updated toolbar download button style
- Loading branch information
Showing
6 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h" | ||
|
||
#include "brave/browser/ui/color/brave_color_id.h" | ||
#include "ui/gfx/geometry/skia_conversions.h" | ||
|
||
namespace gfx { | ||
|
||
SkRect AdjustRingBounds(const gfx::RectF& ring_bounds); | ||
|
||
} // namespace gfx | ||
|
||
#define RectFToSkRect(ring_bounds) AdjustRingBounds(ring_bounds) | ||
#define DownloadToolbarButtonView DownloadToolbarButtonViewChromium | ||
|
||
#include "src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc" | ||
|
||
#undef DownloadToolbarButtonView | ||
#undef RectFToSkRect | ||
|
||
namespace gfx { | ||
|
||
SkRect AdjustRingBounds(const gfx::RectF& ring_bounds) { | ||
const int chromium_ring_radius = ui::TouchUiController::Get()->touch_ui() | ||
? kProgressRingRadiusTouchMode | ||
: kProgressRingRadius; | ||
constexpr auto kBraveRingRadius = 12; | ||
const auto delta = kBraveRingRadius - chromium_ring_radius; | ||
gfx::RectF new_bounds(ring_bounds); | ||
new_bounds.Outset(gfx::OutsetsF(delta)); | ||
return gfx::RectFToSkRect(new_bounds); | ||
} | ||
|
||
} // namespace gfx | ||
|
||
SkColor DownloadToolbarButtonView::GetIconColor() const { | ||
const DownloadDisplayController::IconInfo icon_info = GetIconInfo(); | ||
|
||
// Apply active color only when download is completed and user doesn't | ||
// interact with this button. | ||
if (icon_info.icon_state == download::DownloadIconState::kComplete && | ||
icon_info.is_active) { | ||
return GetColorProvider()->GetColor(kColorBraveDownloadToolbarButtonActive); | ||
} | ||
|
||
// Otherwise, always use inactive color. | ||
return GetColorProvider()->GetColor(kColorDownloadToolbarButtonInactive); | ||
} |
38 changes: 38 additions & 0 deletions
38
chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_DOWNLOAD_BUBBLE_DOWNLOAD_TOOLBAR_BUTTON_VIEW_H_ | ||
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_DOWNLOAD_BUBBLE_DOWNLOAD_TOOLBAR_BUTTON_VIEW_H_ | ||
|
||
#include "chrome/browser/download/bubble/download_display_controller.h" | ||
|
||
#define DownloadToolbarButtonView DownloadToolbarButtonViewChromium | ||
#define GetIconColor \ | ||
UnUsed() { \ | ||
return SK_ColorTRANSPARENT; \ | ||
} \ | ||
\ | ||
protected: \ | ||
DownloadDisplayController::IconInfo GetIconInfo() const { \ | ||
return controller_->GetIconInfo(); \ | ||
} \ | ||
\ | ||
public: \ | ||
virtual SkColor GetIconColor | ||
|
||
#include "src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h" // IWYU pragma: export | ||
|
||
#undef GetIconColor | ||
#undef DownloadToolbarButtonView | ||
|
||
class DownloadToolbarButtonView : public DownloadToolbarButtonViewChromium { | ||
public: | ||
using DownloadToolbarButtonViewChromium::DownloadToolbarButtonViewChromium; | ||
|
||
// DownloadToolbarButtonViewChromium overrides: | ||
SkColor GetIconColor() const override; | ||
}; | ||
|
||
#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_DOWNLOAD_BUBBLE_DOWNLOAD_TOOLBAR_BUTTON_VIEW_H_ |
37 changes: 37 additions & 0 deletions
37
vector_icons/chrome/app/vector_icons/download_in_progress.icon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
CANVAS_DIMENSIONS, 16, | ||
MOVE_TO, 8, 0.76f, | ||
R_CUBIC_TO, 0.32f, 0, 0.59f, 0.27f, 0.59f, 0.59f, | ||
R_V_LINE_TO, 8.55f, | ||
R_LINE_TO, 2.32f, -2.32f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.84f, 0.84f, | ||
R_LINE_TO, -3.32f, 3.32f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, -0.84f, 0, | ||
LINE_TO, 4.26f, 8.42f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.84f, -0.84f, | ||
LINE_TO, 7.41f, 9.9f, | ||
V_LINE_TO, 1.35f, | ||
ARC_TO, 0.59f, 0.59f, 0, 0, 1, 8, 0.76f, | ||
CLOSE, | ||
R_MOVE_TO, -6.65f, 9.97f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.59f, 0.59f, | ||
R_V_LINE_TO, 1.66f, | ||
R_CUBIC_TO, 0, 0.59f, 0.48f, 1.07f, 1.07f, 1.07f, | ||
R_H_LINE_TO, 9.97f, | ||
R_CUBIC_TO, 0.59f, 0, 1.07f, -0.48f, 1.07f, -1.07f, | ||
R_V_LINE_TO, -1.66f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.59f, -0.59f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.59f, 0.59f, | ||
R_V_LINE_TO, 1.66f, | ||
R_ARC_TO, 2.25f, 2.25f, 0, 0, 1, -2.25f, 2.25f, | ||
H_LINE_TO, 3.02f, | ||
R_ARC_TO, 2.25f, 2.25f, 0, 0, 1, -2.25f, -2.25f, | ||
R_V_LINE_TO, -1.66f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.59f, -0.59f, | ||
CLOSE, | ||
R_MOVE_TO, 0, 0, | ||
CLOSE |
37 changes: 37 additions & 0 deletions
37
vector_icons/chrome/app/vector_icons/download_toolbar_button.icon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
CANVAS_DIMENSIONS, 16, | ||
MOVE_TO, 8, 0.76f, | ||
R_CUBIC_TO, 0.32f, 0, 0.59f, 0.27f, 0.59f, 0.59f, | ||
R_V_LINE_TO, 8.55f, | ||
R_LINE_TO, 2.32f, -2.32f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.84f, 0.84f, | ||
R_LINE_TO, -3.32f, 3.32f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, -0.84f, 0, | ||
LINE_TO, 4.26f, 8.42f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.84f, -0.84f, | ||
LINE_TO, 7.41f, 9.9f, | ||
V_LINE_TO, 1.35f, | ||
ARC_TO, 0.59f, 0.59f, 0, 0, 1, 8, 0.76f, | ||
CLOSE, | ||
R_MOVE_TO, -6.65f, 9.97f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.59f, 0.59f, | ||
R_V_LINE_TO, 1.66f, | ||
R_CUBIC_TO, 0, 0.59f, 0.48f, 1.07f, 1.07f, 1.07f, | ||
R_H_LINE_TO, 9.97f, | ||
R_CUBIC_TO, 0.59f, 0, 1.07f, -0.48f, 1.07f, -1.07f, | ||
R_V_LINE_TO, -1.66f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.59f, -0.59f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.59f, 0.59f, | ||
R_V_LINE_TO, 1.66f, | ||
R_ARC_TO, 2.25f, 2.25f, 0, 0, 1, -2.25f, 2.25f, | ||
H_LINE_TO, 3.02f, | ||
R_ARC_TO, 2.25f, 2.25f, 0, 0, 1, -2.25f, -2.25f, | ||
R_V_LINE_TO, -1.66f, | ||
R_ARC_TO, 0.59f, 0.59f, 0, 0, 1, 0.59f, -0.59f, | ||
CLOSE, | ||
R_MOVE_TO, 0, 0, | ||
CLOSE |