Enterprise policy: Ignore the deprecated ForceSafeSearch if ForceGoogleSafeSearch or ForceYoutubeSafetyMode are enabled
While we're here, remove the deprecated prefs::kForceSafeSearch and instead map the old policy to the new prefs
TBR=cbentzel@chromium.org for trivial io_thread.cc change
BUG=476908
Committed: https://crrev.com/2b18805daa18a3bc4d9892f50e44d5cfacdad451
Cr-Commit-Position: refs/heads/master@{#325620}
https://codereview.chromium.org/1056003003/diff/1/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/1/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && I guess this part isn't *strictly* ...
5 years, 8 months ago
(2015-04-14 13:27:15 UTC)
#2
Thanks for the fast CL! https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && This ...
5 years, 8 months ago
(2015-04-14 14:39:58 UTC)
#6
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && On 2015/04/14 14:55:37, Thiemo Nagel wrote: ...
5 years, 8 months ago
(2015-04-14 15:02:01 UTC)
#9
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.cc (right):
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search &&
On 2015/04/14 14:55:37, Thiemo Nagel wrote:
> On 2015/04/14 14:47:38, Marc Treib wrote:
> > At this point, we can't tell "policy is explicitly disabled" from "policy is
> not
> > set".
>
> Can't we use PrefMember<>::IsManaged() for that purpose?
Right, that should work! Might be a bit awkward to test though.
I'll update the CL tomorrow, have to run now...
Andrew T Wilson (Slow)
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && I actually don't think we want ...
5 years, 8 months ago
(2015-04-14 15:02:05 UTC)
#10
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.cc (right):
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search &&
I actually don't think we want force_safe_search to depend on youtube safety
mode, but I'll defer to Thiemo here. If we do, then we probably just want to
depend on the *presence* of it, not the actual value (so, even if they set
force_google_safe_search to false, it should override the force_safe_search
value.
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:438: force_safety_mode =
(force_safe_search_ && force_safe_search_->GetValue());
Ditto here - we want people to be able to set force_youtube_safety_mode_ = false
and always have it take effect, even if forceSafeSearch = true.
Thiemo Nagel
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && On 2015/04/14 15:02:05, Andrew T Wilson ...
5 years, 8 months ago
(2015-04-14 15:27:31 UTC)
#11
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.cc (right):
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search &&
On 2015/04/14 15:02:05, Andrew T Wilson wrote:
> I actually don't think we want force_safe_search to depend on youtube safety
> mode, but I'll defer to Thiemo here.
If someone used FSS for the sake of YouTube Safety Mode and thus sets FSS=1,
FGSS=undef and FYTSM=1, we probably don't want to force Safe Search on them.
[FSS=1, FGSS=undef, FYTSM=1] should be symmetric to [FSS=1, FGSS=1,
FYTSM=undef].
> If we do, then we probably just want to depend on the *presence* of it,
Absolutely.
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && On 2015/04/14 15:27:31, Thiemo Nagel wrote: ...
5 years, 8 months ago
(2015-04-15 07:48:31 UTC)
#13
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.cc (right):
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search &&
On 2015/04/14 15:27:31, Thiemo Nagel wrote:
> On 2015/04/14 15:02:05, Andrew T Wilson wrote:
> > I actually don't think we want force_safe_search to depend on youtube safety
> > mode, but I'll defer to Thiemo here.
>
> If someone used FSS for the sake of YouTube Safety Mode and thus sets FSS=1,
> FGSS=undef and FYTSM=1, we probably don't want to force Safe Search on them.
> [FSS=1, FGSS=undef, FYTSM=1] should be symmetric to [FSS=1, FGSS=1,
> FYTSM=undef].
>
> > If we do, then we probably just want to depend on the *presence* of it,
>
> Absolutely.
Stupid question: Why do we actually still have a prefs::kForceSafeSearch? From a
quick look at the code, it seems like we can just get rid of the legacy pref,
map the legacy policy to prefs in the correct way in the policy handler, and
have all consuming code just look at either prefs::kForceGoogleSafeSearch or
prefs::kForceYouTubeSafetyMode.
Thiemo Nagel
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && > Stupid question: Why do we ...
5 years, 8 months ago
(2015-04-15 08:03:56 UTC)
#14
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.cc (right):
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search &&
> Stupid question: Why do we actually still have a prefs::kForceSafeSearch? From
a
> quick look at the code, it seems like we can just get rid of the legacy pref,
> map the legacy policy to prefs in the correct way in the policy handler, and
> have all consuming code just look at either prefs::kForceGoogleSafeSearch or
> prefs::kForceYouTubeSafetyMode.
Sounds good!
Marc Treib
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && On 2015/04/15 08:03:56, Thiemo Nagel wrote: ...
5 years, 8 months ago
(2015-04-15 12:12:13 UTC)
#15
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.cc (right):
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search &&
On 2015/04/15 08:03:56, Thiemo Nagel wrote:
> > Stupid question: Why do we actually still have a prefs::kForceSafeSearch?
From
> a
> > quick look at the code, it seems like we can just get rid of the legacy
pref,
> > map the legacy policy to prefs in the correct way in the policy handler, and
> > have all consuming code just look at either prefs::kForceGoogleSafeSearch or
> > prefs::kForceYouTubeSafetyMode.
>
> Sounds good!
That would mean that we basically have to re-evaluate all three policies when
any of them change. (E.g. legacy SafeSearch is already set to 1. Now
GoogleSafeSearch is set; we'd have to remove the YouTube pref.)
Not sure if the policy system easily supports this - Thiemo?
Mattias Nissler (ping if slow)
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && On 2015/04/15 12:12:12, Marc Treib wrote: ...
5 years, 8 months ago
(2015-04-15 12:14:13 UTC)
#16
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.cc (right):
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search &&
On 2015/04/15 12:12:12, Marc Treib wrote:
> On 2015/04/15 08:03:56, Thiemo Nagel wrote:
> > > Stupid question: Why do we actually still have a prefs::kForceSafeSearch?
> From
> > a
> > > quick look at the code, it seems like we can just get rid of the legacy
> pref,
> > > map the legacy policy to prefs in the correct way in the policy handler,
and
> > > have all consuming code just look at either prefs::kForceGoogleSafeSearch
or
> > > prefs::kForceYouTubeSafetyMode.
> >
> > Sounds good!
>
> That would mean that we basically have to re-evaluate all three policies when
> any of them change. (E.g. legacy SafeSearch is already set to 1. Now
> GoogleSafeSearch is set; we'd have to remove the YouTube pref.)
> Not sure if the policy system easily supports this - Thiemo?
If I'm not mistaken, we do a full policy->pref mapping whenever policy changes,
so that shouldn't be a problem.
Thiemo Nagel
https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/1056003003/diff/20001/chrome/browser/net/chrome_network_delegate.cc#newcode401 chrome/browser/net/chrome_network_delegate.cc:401: if (!force_safe_search && > That would mean that we ...
5 years, 8 months ago
(2015-04-15 12:32:22 UTC)
#17
Alright, let's try this again. prefs::kForceSafeSearch removed, ForceSafeSearch policy updated not to do anything if ...
5 years, 8 months ago
(2015-04-16 09:39:23 UTC)
#18
Alright, let's try this again.
prefs::kForceSafeSearch removed, ForceSafeSearch policy updated not to do
anything if any of the Google or YouTube policies are defined. Also updated
policy_browsertests to test all combinations of the policies.
Andrew T Wilson (Slow)
lgtm, with one comment and one wording change. https://codereview.chromium.org/1056003003/diff/60001/chrome/browser/policy/policy_browsertest.cc File chrome/browser/policy/policy_browsertest.cc (right): https://codereview.chromium.org/1056003003/diff/60001/chrome/browser/policy/policy_browsertest.cc#newcode1131 chrome/browser/policy/policy_browsertest.cc:1131: for ...
5 years, 8 months ago
(2015-04-16 11:54:38 UTC)
#19
lgtm, with one comment and one wording change.
https://codereview.chromium.org/1056003003/diff/60001/chrome/browser/policy/p...
File chrome/browser/policy/policy_browsertest.cc (right):
https://codereview.chromium.org/1056003003/diff/60001/chrome/browser/policy/p...
chrome/browser/policy/policy_browsertest.cc:1131: for (int i = 0; i < 3 * 3 * 3;
i++) {
This is all fine, so you don't have to change it. But if you ever want to do
something like this again, consider just having a lookup table of all the cases
you want to deal with. It's easier to understand than a bunch of math/bit
twiddling as we have below.
https://codereview.chromium.org/1056003003/diff/60001/components/policy/resou...
File components/policy/resources/policy_templates.json (right):
https://codereview.chromium.org/1056003003/diff/60001/components/policy/resou...
components/policy/resources/policy_templates.json:896: 'desc': '''This policy is
deprecated, please use ForceGoogleSafeSearch and ForceYouTubeSafetyMode instead.
If any of ForceGoogleSafeSearch or ForceYouTubeSafetyMode is enabled, then the
value of this policy is ignored.
nit: change this to "The value of this policy will be ignored if either the
ForceGoogleSafeSearch or ForceYouTubeSafeSearch policies are set".
The current wording is ambiguous about what happens if I set a
ForceYouTubeSafetyMode=false policy.
Marc Treib
https://codereview.chromium.org/1056003003/diff/60001/components/policy/resources/policy_templates.json File components/policy/resources/policy_templates.json (right): https://codereview.chromium.org/1056003003/diff/60001/components/policy/resources/policy_templates.json#newcode896 components/policy/resources/policy_templates.json:896: 'desc': '''This policy is deprecated, please use ForceGoogleSafeSearch and ...
5 years, 8 months ago
(2015-04-16 12:00:40 UTC)
#20
https://codereview.chromium.org/1056003003/diff/60001/components/policy/resou...
File components/policy/resources/policy_templates.json (right):
https://codereview.chromium.org/1056003003/diff/60001/components/policy/resou...
components/policy/resources/policy_templates.json:896: 'desc': '''This policy is
deprecated, please use ForceGoogleSafeSearch and ForceYouTubeSafetyMode instead.
If any of ForceGoogleSafeSearch or ForceYouTubeSafetyMode is enabled, then the
value of this policy is ignored.
On 2015/04/16 11:54:37, Andrew T Wilson wrote:
> nit: change this to "The value of this policy will be ignored if either the
> ForceGoogleSafeSearch or ForceYouTubeSafeSearch policies are set".
>
> The current wording is ambiguous about what happens if I set a
> ForceYouTubeSafetyMode=false policy.
Right, forgot to update this. Good catch, thanks!
5 years, 8 months ago
(2015-04-16 12:01:11 UTC)
#22
+mlerman for c/b/profiles. PTAL!
Mike Lerman
profiles LGTM!
5 years, 8 months ago
(2015-04-16 12:50:39 UTC)
#23
profiles LGTM!
Mattias Nissler (ping if slow)
/me likes all the code deletion :) One further comment to improve clarity. https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/configuration_policy_handler_list_factory.cc File ...
5 years, 8 months ago
(2015-04-16 13:10:48 UTC)
#24
/me likes all the code deletion :)
One further comment to improve clarity.
https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/c...
File chrome/browser/policy/configuration_policy_handler_list_factory.cc (right):
https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/c...
chrome/browser/policy/configuration_policy_handler_list_factory.cc:504: class
ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler {
What you have works. However, I think an easier-to-follow solution would be to
drop the simple mappings declared above and move the responsibility for mapping
prefs::kFocreGoogleSafeSearch and prefs::kForceYouToubeSafetyMode into a single
place, namely this handler. That way, the reader has all the logic deciding the
pref values in one place and doesn't need to be aware of the simple mapping
declared in the table above.
Marc Treib
https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/configuration_policy_handler_list_factory.cc File chrome/browser/policy/configuration_policy_handler_list_factory.cc (right): https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/configuration_policy_handler_list_factory.cc#newcode504 chrome/browser/policy/configuration_policy_handler_list_factory.cc:504: class ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler { On 2015/04/16 13:10:47, ...
5 years, 8 months ago
(2015-04-16 13:18:23 UTC)
#25
https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/c...
File chrome/browser/policy/configuration_policy_handler_list_factory.cc (right):
https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/c...
chrome/browser/policy/configuration_policy_handler_list_factory.cc:504: class
ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler {
On 2015/04/16 13:10:47, Mattias Nissler wrote:
> What you have works. However, I think an easier-to-follow solution would be to
> drop the simple mappings declared above and move the responsibility for
mapping
> prefs::kFocreGoogleSafeSearch and prefs::kForceYouToubeSafetyMode into a
single
> place, namely this handler. That way, the reader has all the logic deciding
the
> pref values in one place and doesn't need to be aware of the simple mapping
> declared in the table above.
I considered that, and I actually prefer the way it is now: If you're only
interested in the non-legacy policies, you see the simple mapping above and know
all you need to know. Only the weirdly-behaving legacy policy has special code.
And if we can ever actually remove the legacy policy, it's as simple as removing
this class.
I've added a comment that refers to kSimplePolicyMap though :)
Mattias Nissler (ping if slow)
LGTM https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/configuration_policy_handler_list_factory.cc File chrome/browser/policy/configuration_policy_handler_list_factory.cc (right): https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/configuration_policy_handler_list_factory.cc#newcode504 chrome/browser/policy/configuration_policy_handler_list_factory.cc:504: class ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler { On 2015/04/16 ...
5 years, 8 months ago
(2015-04-16 13:27:56 UTC)
#26
LGTM
https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/c...
File chrome/browser/policy/configuration_policy_handler_list_factory.cc (right):
https://codereview.chromium.org/1056003003/diff/80001/chrome/browser/policy/c...
chrome/browser/policy/configuration_policy_handler_list_factory.cc:504: class
ForceSafeSearchPolicyHandler : public TypeCheckingPolicyHandler {
On 2015/04/16 13:18:23, Marc Treib wrote:
> On 2015/04/16 13:10:47, Mattias Nissler wrote:
> > What you have works. However, I think an easier-to-follow solution would be
to
> > drop the simple mappings declared above and move the responsibility for
> mapping
> > prefs::kFocreGoogleSafeSearch and prefs::kForceYouToubeSafetyMode into a
> single
> > place, namely this handler. That way, the reader has all the logic deciding
> the
> > pref values in one place and doesn't need to be aware of the simple mapping
> > declared in the table above.
>
> I considered that, and I actually prefer the way it is now: If you're only
> interested in the non-legacy policies, you see the simple mapping above and
know
> all you need to know. Only the weirdly-behaving legacy policy has special
code.
> And if we can ever actually remove the legacy policy, it's as simple as
removing
> this class.
> I've added a comment that refers to kSimplePolicyMap though :)
I suppose somebody trying to understand how these policies work would prefer to
have the full story told in a single place. Your comment achieves that same goal
though, so fine with me.
battre
LGTM to c/b/net
5 years, 8 months ago
(2015-04-17 09:55:19 UTC)
#27
LGTM to c/b/net
Marc Treib
The CQ bit was checked by treib@chromium.org
5 years, 8 months ago
(2015-04-17 10:11:06 UTC)
#28
Try jobs failed on following builders: android_compile_dbg on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_compile_dbg/builds/7239)
5 years, 8 months ago
(2015-04-17 10:58:29 UTC)
#32
The patchset sent to the CQ was uploaded after l-g-t-m from mlerman@chromium.org, atwilson@chromium.org, mnissler@chromium.org, battre@chromium.org ...
5 years, 8 months ago
(2015-04-17 11:34:55 UTC)
#37
Issue 1056003003: Policy: Ignore ForceSafeSearch if ForceGoogleSafeSearch or ForceYoutubeSafetyMode are enabled
(Closed)
Created 5 years, 8 months ago by Marc Treib
Modified 5 years, 8 months ago
Reviewers: Andrew T Wilson (Slow), battre, Thiemo Nagel, Mattias Nissler (ping if slow), Mike Lerman, Bernhard Bauer
Base URL: https://chromium.googlesource.com/chromium/src.git@master
Comments: 22