-
Notifications
You must be signed in to change notification settings - Fork 904
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
Conversation
7384a2c
to
c46a565
Compare
browser/search_engines/tor_window_search_engine_provider_service.cc
Outdated
Show resolved
Hide resolved
5156e08
to
cd39beb
Compare
cd39beb
to
5f90b71
Compare
@@ -34,4 +35,16 @@ bool IsRegionForQwant(Profile* profile) { | |||
TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_QWANT; | |||
} | |||
|
|||
bool IsOTRGuestProfile(Profile* profile) { |
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 still confused by this. Is there more than one kind of guest profile?
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 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.
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.
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)); |
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 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
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 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)) { |
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.
IsOTRGuestProfile
is not needed here
DCHECK(otr_profile->IsTorProfile()); | ||
DCHECK(IsGuestProfile(otr_profile)); | ||
DCHECK(tor::IsTorProfile(otr_profile)); | ||
DCHECK(brave::IsOTRGuestProfile(otr_profile)); |
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 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 && |
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.
lint - 4 spaces for continuation of a line
a7306ec
to
0294bdc
Compare
IsOTRGuestProfile() in SearchEngineProviderServiceFactory
0294bdc
to
1fb5f08
Compare
browser/profiles/profile_util.cc
Outdated
#endif | ||
} | ||
|
||
bool IsOffTheRecordProfile(Profile* profile) { |
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 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)) { |
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 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)) { |
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.
same here as above
1fb5f08
to
fa55e87
Compare
// 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()) { |
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.
please move this check to the end
IsGuestProfile was IsOTRGuestProfile, but no longer checks for OTR profile.
fa55e87
to
a0212eb
Compare
Follow up on comments for c76 update
Follow up on comments for c76 update
fix brave/brave-browser#5222
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.