-
Notifications
You must be signed in to change notification settings - Fork 864
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
Fix brave ads check includes #25828
Fix brave ads check includes #25828
Conversation
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
2ed4e48
to
906a60f
Compare
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.
browser/widevine
++
@@ -1530,17 +1482,13 @@ void AdsServiceImpl::CanShowNotificationAds( | |||
void AdsServiceImpl::CanShowNotificationAdsWhileBrowserIsBackgrounded( | |||
CanShowNotificationAdsWhileBrowserIsBackgroundedCallback callback) { | |||
std::move(callback).Run( | |||
NotificationHelper::GetInstance() | |||
->CanShowSystemNotificationsWhileBrowserIsBackgrounded()); | |||
delegate_->CanShowSystemNotificationsWhileBrowserIsBackgrounded()); | |||
} | |||
|
|||
void AdsServiceImpl::ShowNotificationAd(base::Value::Dict dict) { |
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.
Maybe we can move this function to AdsServiceDelegate
and pass ShouldShowCustomNotificationAds()
value as a parameter? Declaration can look something like:
virtual void ShowNotificationAd(
bool should_show_custom_notification_ads,
const std::string& id,
const std::u16string& title,
const std::u16string& body);
If so, we will get rid of ui/message_center
dependency in header because the new function will replace following functions in AdsService::Delegate
:
virtual void Display(const message_center::Notification& notification) = 0;
virtual void ShowNotificationAd(const std::string& id,
const std::u16string& title,
const std::u16string& body);
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 there's still quite a bit of refactoring that needs to be done here, but for this first pass my goal is just to remove check_includes = false
@@ -1584,28 +1531,23 @@ void AdsServiceImpl::ShowNotificationAd(base::Value::Dict dict) { | |||
notification->set_never_timeout(true); | |||
#endif | |||
|
|||
display_service_->Display(NotificationHandler::Type::BRAVE_ADS, | |||
*notification, /*metadata=*/nullptr); | |||
delegate_->Display(*notification); | |||
} | |||
|
|||
StartNotificationAdTimeOutTimer(ad.placement_id); | |||
} | |||
|
|||
void AdsServiceImpl::CloseNotificationAd(const std::string& placement_id) { |
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.
Maybe we can move this function to AdsServiceDelegate
and pass ShouldShowCustomNotificationAds()
value as a parameter? Declaration can look something like:
virtual void CloseNotificationAd(
bool should_show_custom_notification_ads,
const std::string& placement_id);
If so, the new function will replace following functions in AdsService::Delegate
:
virtual void Close(const std::string& notification_id) = 0;
virtual void CloseNotificationAd(const std::string& id) = 0;
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.
Great change! left few comments, thanks!
ca85ed1
to
a75c474
Compare
[puLL-Merge] - brave/brave-core@25828 DescriptionThis PR introduces a new ChangesChanges
Possible Issues
Security HotspotsNone identified. The changes primarily focus on architectural improvements and don't introduce new security risks. |
a75c474
to
17760b8
Compare
17760b8
to
892cdad
Compare
unrelated test failure on macos |
Released in v1.72.65 |
virtual void Close(const std::string& notification_id) = 0; | ||
virtual void ShowNotificationAd(const std::string& id, | ||
const std::u16string& title, | ||
const std::u16string& body); |
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.
Missed = 0? I've got 'undefined symbol' referenced by 'const brave_ads::AdsService::Delegate::`vftable'
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.
oops, I wonder why it wasn't caught in CI
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.
@cdesouza-chromium says he is creating a PR for it
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.
@boocmp what build were you running when you saw that?
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've already merged a fix. I should have linked to it #25847
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 believe it may have been debug builds only. At least, that's what it seemed like when I encountered it.
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, it only fails when optimization is turned off
This PR has broken the ubsan build for me:
|
Resolves brave/brave-browser#24163
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 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: