-
Notifications
You must be signed in to change notification settings - Fork 901
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
Fixes hover card bubble chrome:// urls. #3687
Conversation
Tested this on macOS; works great! 😄 |
74b2012
to
3ebf237
Compare
232e25d
to
14bae84
Compare
CI failures are in lint and an unrelated browser test. |
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.
LGTM! 😄
#define BRAVE_TAB_HOVER_CARD_BUBBLE_VIEW_H_ \ | ||
\ | ||
protected: \ | ||
class BraveAnonymous; \ |
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 understanding what is happening here. Why are we creating an inner class that just has a single static method? Why do we need a class here at all?
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 am using an inner class here because inner classes have access to private members.
Because I am redefining TabHoverCardBubbleView
as TabHoverCardBubbleView_ChromiumImpl
(and then declaring the subclass as TabHoverCardBubbleView
) I can't add a friend class TabHoverCardBubbleView
.
}; | ||
|
||
void TabHoverCardBubbleView::UpdateCardContent(const Tab* tab) { | ||
TabHoverCardBubbleView_ChromiumImpl::BraveAnonymous::UpdateCardContent( |
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.
re https://github.com/brave/brave-core/pull/3687/files#r335575232 - why aren't we just directly calling the code in TabHoverCardBubbleView_ChromiumImpl::BraveAnonymous::UpdateCardContent
?
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.
Similarly here, I am going through the inner class method to get to the private members of the base class (because I couldn't make the subclass a friend with this approach).
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.
why rename it? Wouldn't it be simpler to subclass/friend and override in tab_strip.cc? You need a patch in TabHoverCardBubbleView either way and it would be simpler to understand imo
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.
Mainly was just trying out a way to make changes without having to patch tab_strip.cc.
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.
you wouldn't have to patch tab_strip.cc, you can change the class name with a chromium_src override
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.
Yes, but with TabHoverCardBubbleView
, tab_strip.cc:126 also has
TabHoverCardEventSniffer(TabHoverCardBubbleView* hover_card, TabStrip* tab_strip)
which would get redefined.
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.
why does that matter? I saw it, but maybe I'm missing something?
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.
ok, I see why it matters (TabHoverCardBubbleView* hover_card_ = nullptr;
) in the header, but can't you just override in the header as well?
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 mean, what you have works, it's just harder to follow because it's very different from what we would normally do in this case. If we can subclass and override I think it would be better for long-term maintenance
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.
or if we went this route, wouldn't it be simpler to just directly patch in a method to TabHoverCardBubbleView_ChromiumImpl
instead of creating an inner class?
private: | ||
|
||
#define TabHoverCardBubbleView TabHoverCardBubbleView_ChromiumImpl | ||
#define UpdateCardContent virtual UpdateCardContent |
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.
this could be used to get rid of a lot of other patches for virtual
. I didn't realize it was valid to have void virtual Method(...)
cc @bbondy
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.
@mkarolin please take advantage of this when doing chromium updates for existing patches using virtual
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.
Yes, you can have virtual after the return type as long as the return type is not a pointer or a reference. If they are then you need to have A virtual *function
, which doesn't help us.
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.
that's the case even though the standard for chromium code is T* function()
? Shouldn't the preprocessor replacement work correctly for that?
af7ec45
to
3dbda8d
Compare
Fixes brave/brave-browser#6385 Replaces chrome:// scheme with brave:// in the hover card text. Added a browser test to test the same. Also, organized brave_browser_tests sources alphabetically in test/BUILD.gn.
3dbda8d
to
defda68
Compare
CI fails in an unrelated unit test. |
Fixes hover card bubble chrome:// urls.
Fixes hover card bubble chrome:// urls.
Fixes hover card bubble chrome:// urls.
Fixes brave/brave-browser#6385
Replaces chrome:// scheme with brave://.
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist:
After-merge Checklist:
changes has landed on.