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

Follow up on comments for c76 update #2903

Merged
merged 9 commits into from
Jul 18, 2019
Merged

Follow up on comments for c76 update #2903

merged 9 commits into from
Jul 18, 2019

Conversation

darkdh
Copy link
Member

@darkdh darkdh commented Jul 11, 2019

fix brave/brave-browser#5222

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.

@darkdh darkdh force-pushed the 76.0.3809.62-followup branch 2 times, most recently from 7384a2c to c46a565 Compare July 12, 2019 00:27
@mkarolin mkarolin self-assigned this Jul 12, 2019
@mkarolin mkarolin added this to the 0.69.x - Nightly milestone Jul 12, 2019
@darkdh darkdh marked this pull request as ready for review July 12, 2019 17:01
@darkdh darkdh requested a review from bridiver as a code owner July 12, 2019 17:01
@@ -34,4 +35,16 @@ bool IsRegionForQwant(Profile* profile) {
TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_QWANT;
}

bool IsOTRGuestProfile(Profile* profile) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm still confused by this. Is there more than one kind of guest profile?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess it depends on what you call a guest profile. IsGuestSession is set to true for regular and off-the-record profiles of a profile with "guest" path. GetProfileType only returns GUEST_PROFILE type for the off-the-record profile.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For a short while (5/20 - 5/29) Chromium had an ideal method Profile::IsGuestProfile for what we need, but they removed it: https://chromium.googlesource.com/chromium/src/+/5f95c46d5ce37d3b271b1f99063459e5d715761e

DCHECK(IsGuestProfile(otr_profile));
DCHECK(!otr_profile->IsTorProfile());
DCHECK(brave::IsOTRGuestProfile(otr_profile));
DCHECK(!tor::IsTorProfile(otr_profile));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is necessary. If it's a guest profile from the path then it's definitely not a tor profile and this check will be even more irrelevant once Tor profiles are not based on guest profiles

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the original intent (Profile::GetProfileType() == GUEST_PROFILE) here was not that it was a guest profile, but that it was an OTR profile.

@@ -32,7 +34,7 @@ KeyedService* InitializeSearchEngineProviderServiceIfNeeded(Profile* profile) {

// Regardless of qwant region, tor profile needs controller to store
// previously set search engine provider.
if (profile->IsTorProfile() && IsGuestProfile(profile)) {
if (tor::IsTorProfile(profile) && brave::IsOTRGuestProfile(profile)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

IsOTRGuestProfile is not needed here

DCHECK(otr_profile->IsTorProfile());
DCHECK(IsGuestProfile(otr_profile));
DCHECK(tor::IsTorProfile(otr_profile));
DCHECK(brave::IsOTRGuestProfile(otr_profile));
Copy link
Collaborator

Choose a reason for hiding this comment

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

this check is not needed and won't be relevant when tor profiles are not based on guest profiles

// profile to check for guest.
DCHECK(profile);
return (profile->HasOffTheRecordProfile() &&
profile->GetOffTheRecordProfile() == profile &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

lint - 4 spaces for continuation of a line

@mkarolin mkarolin force-pushed the 76.0.3809.62-followup branch 2 times, most recently from a7306ec to 0294bdc Compare July 17, 2019 22:30
#endif
}

bool IsOffTheRecordProfile(Profile* profile) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this isn't needed BrowserContext::IsOffTheRecord already exists

@@ -32,7 +34,7 @@ KeyedService* InitializeSearchEngineProviderServiceIfNeeded(Profile* profile) {

// Regardless of qwant region, tor profile needs controller to store
// previously set search engine provider.
if (profile->IsTorProfile() && IsGuestProfile(profile)) {
if (brave::IsTorProfile(profile) && brave::IsOffTheRecordProfile(profile)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we want to differentiate with OTR here. All Tor profiles should use TorWindowSearchEngineProviderService

@@ -41,7 +43,7 @@ KeyedService* InitializeSearchEngineProviderServiceIfNeeded(Profile* profile) {
if (brave::IsRegionForQwant(profile))
return nullptr;

if (IsGuestProfile(profile)) {
if (brave::IsGuestProfile(profile) && brave::IsOffTheRecordProfile(profile)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here as above

// That means changing normal profile's provider doesn't affect otr profile's.
// This controller monitor's normal profile's service and apply it's change to
// This controller monitor's normal profile's service and apply its change to
// otr profile to use same provider.
// Private profile's setting is shared with normal profile's setting.
if (profile->IsIncognitoProfile()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please move this check to the end

IsGuestProfile was IsOTRGuestProfile, but no longer checks for OTR
profile.
@mkarolin mkarolin merged commit de551ba into master Jul 18, 2019
@mkarolin mkarolin deleted the 76.0.3809.62-followup branch July 18, 2019 18:03
mkarolin added a commit that referenced this pull request Jul 18, 2019
Follow up on comments for c76 update
mkarolin added a commit that referenced this pull request Jul 18, 2019
Follow up on comments for c76 update
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.

Follow up on comments for c76 update.
3 participants