Skip to content
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

Add brave::IsRegularProfile to exclude Tor profiles and guest sessions too #6608

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

yrliou
Copy link
Member

@yrliou yrliou commented Sep 9, 2020

Resolves brave/brave-browser#11218

Submitter Checklist:

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@yrliou yrliou added this to the 1.16.x - Nightly milestone Sep 9, 2020
@yrliou yrliou requested a review from NejcZdovc as a code owner September 9, 2020 23:26
@yrliou yrliou self-assigned this Sep 9, 2020
@@ -10,6 +10,7 @@
#include <utility>

#include "brave/browser/ui/brave_actions/brave_action_icon_with_badge_image_source.h"
#include "brave/browser/profiles/profile_util.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: order

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll force-push fix & skip CI right before merging.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot to push this before merging, I'll do a quick follow-up fix on this.

@@ -357,8 +357,7 @@ void AdsServiceImpl::OnTabUpdated(
return;
}

const bool is_incognito = profile_->IsOffTheRecord() ||
brave::IsTorProfile(profile_);
const bool is_incognito = !brave::IsRegularProfile(profile_);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Hmm, this will work as expected but I think this could make some confusing because non incogito profile could be false from brave::IsRegularProfile().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to do a minimum changes on original code here, maybe @tmancey could suggest what's preferred here and we could do a small quick follow-up on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, using is_regular seems more clear.
and calling bat_ads_->OnTabUpdated(tab_id.id(), url.spec(), is_active, is_browser_active, is_regular);

Copy link
Member Author

@yrliou yrliou Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm a bit confused why bat_ads_ need to take is_incognito param at all, why do we expect this function to be executed if we don't expect to create ads service in incognito profiles in the first place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I also think we don't need to use is_incognito or replace it with DCHECK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it might be better to separate this small piece out into a separate PR to keep this one simple and focused.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed this is legacy code which is no longer needed. We already have a DCHECK. I have raised brave/brave-browser#11648. Thanks

@yrliou
Copy link
Member Author

yrliou commented Sep 10, 2020

only CI failure is test-install on Windows platform which is unrelated to this PR.

Copy link
Contributor

@NejcZdovc NejcZdovc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewards code looks good

Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM++

@yrliou yrliou merged commit 7ef36fe into master Sep 10, 2020
@yrliou yrliou deleted the is_regular_profile branch September 10, 2020 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a util function to cover Profile::IsOffTheRecord, Tor profiles, and guest sessions
4 participants