-
Notifications
You must be signed in to change notification settings - Fork 894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated toolbar download button style #17769
Conversation
88c8bb4
to
f1b137d
Compare
namespace { | ||
|
||
-constexpr int kProgressRingRadius = 9; | ||
+constexpr int kProgressRingRadius = 12; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made patch here. I think this is the most simplest way.
As this value is used in the middle of PaintButtonContents()
,
we need to override that method and copy the most of that method's impls.
} \ | ||
\ | ||
protected: \ | ||
DownloadDisplayController* display_controller() const { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to call this from the const method (GetIconColor()
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: returning mutable from const
is not great, so another option here is to implement this as DownloadDisplayController::IconInfo GetIconInfo() const { return controller_->GetIconInfo(); }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the return type should be const DownloadDisplayController*
based on https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/const.md - The returned member could be changed so this getter doesn't seem to be logically const.
But changing return type like so would make us use const_cast<>, so I think we can remove this getter here and just use const_cast<> from the callsite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks both! https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/const.md is nice doc :)
} \ | ||
\ | ||
protected: \ | ||
DownloadDisplayController* display_controller() const { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: returning mutable from const
is not great, so another option here is to implement this as DownloadDisplayController::IconInfo GetIconInfo() const { return controller_->GetIconInfo(); }
.
|
||
#define DownloadToolbarButtonView DownloadToolbarButtonViewChromium | ||
|
||
#include "src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc" | ||
|
||
#undef DownloadToolbarButtonView | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's worth, but can we remove the patch file by overriding gfx::RectFToSkRect() like this?
#define DownloadToolbarButtonView DownloadToolbarButtonViewChromium | |
#include "src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc" | |
#undef DownloadToolbarButtonView | |
#include "ui/gfx/geometry/skia_conversions.h" | |
namespace gfx { | |
SkRect AdjustRingBounds(const gfx::RectF& ring_bounds); | |
} | |
#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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, removed patch!
} \ | ||
\ | ||
protected: \ | ||
DownloadDisplayController* display_controller() const { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the return type should be const DownloadDisplayController*
based on https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/const.md - The returned member could be changed so this getter doesn't seem to be logically const.
But changing return type like so would make us use const_cast<>, so I think we can remove this getter here and just use const_cast<> from the callsite.
f1b137d
to
9ba33a2
Compare
Updated toolbar download button style
Verification PASSED on
Using the examples mentioned via #17769 (comment) & brave/brave-browser#29324 (comment), verified the following:
|
Merge pull request #17769 from brave/update_download_button_style Updated toolbar download button style
Normal state -
In-progress -
Completed and user doesn't click the button yet.
fix brave/brave-browser#29324
Resolves
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: