Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Issue 830193002: Using PolicyServiceWatcher instead of PolicyWatcherLinux/Win/Mac. (Closed)

Created:
5 years, 11 months ago by Łukasz Anforowicz
Modified:
5 years, 11 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, chromoting-reviews_chromium.org, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Using PolicyServiceWatcher instead of PolicyWatcherLinux/Win/Mac. This changelist removes PolicyWatcherLinux/Win/Mac from src/remoting/host/policy_hack (which had most of the code copied from various classes that are now refactored into src/components/policy) and replaces these classes with PolicyServiceWatcher that wraps a PolicyService from src/components/policy. PolicyServiceWatcher is based on a mostly unchanged PolicyWatcherChromeOS, which has been made applicable to other OS-es, by enabling wrapping an *owned* PolicyService (and by adding code that creates the owned PolicyService). This changelist focuses on making minimal changes that: 1) preserve current behavior of PolicyWatcher 2) replace PolicyWatcherLinux/Win/Mac with PolicyServiceWatcher The focused/minimal nature of the changelist means that some undesirable or questionable aspects of PolicyWatcher remain untouched. For example: A) src/remoting/host/policy_hack uses same policy dir path on Chrome and Chromium (unlike src/chrome/browser/policy) B) PolicyWatcher still contains quite a bit of business logic (i.e. for filling out default values or using special fallback values in case of incorrect value types) C) PolicyWatcher's users consume policies via base::DictionaryValue rather than policy::PolicyMap D) Users of PolicyWatcher have to be aware of threading gotchas (i.e. It2MeHost::OnPolicyUpdate has to account for the fact that on ChromeOS, PolicyWatcher's callbacks are called on browser's UI thread rather than on Chromoting's network_task_runner) The changelist fails to preserve the following behavior of PolicyWatcher: *) Policy parsing errors are not surfaced anymore to users of PolicyWatcher Not retaining this behavior is probably okay because: i) If the security lock down response to parsing errors is desirable, then we should detect and surface this from component/policy, so that all Chrome policies benefit (i.e. security-sensitive AlwaysAuthorizePlugins, AudioCaptureAllowed or URLBlacklist) ii) Code reuse from the current changelist allows detecting currently undetected policy authoring problems in Chromoting scenarios (i.e. by making it possible to validate policy value types via policy::Schema). iii) Current policy-errors behavior is far from bullet-proof: - Misspelled policy names are inherently undetectable - Invalid types of policy values are ignored on Windows and Mac (as mentioned above in (ii) and tracked by crbug.com/427513) - Up until recently (until changelist here: https://chromium.googlesource.com/chromium/src.git/+/142f8e1d3e4b75c901f33cb771cd848019630c1e) malformed json files prevented chromoting host from starting but did *not* stop an already running host (only prevented the already running host from ever refreshing policies from other, still parseable files). iv) Reuniting remoting/host/policy_hack with components/policy is automatically bringing in other features (i.e. detecting policy updates on Mac). The changelist has been tested by manually dumping and verifying policy contents via the newly added unit test on Linux, Windows and Mac. BUG=368321 Committed: https://crrev.com/d5a6bda8b9cb6db9ee89e20e889916072a738ed4 Cr-Commit-Position: refs/heads/master@{#311994}

Patch Set 1 #

Patch Set 2 : Fixed building for Chrome OS. #

Total comments: 44

Patch Set 3 : Addressed code review feedback from Mattias. #

Total comments: 16

Patch Set 4 : Addressed 2nd round of feedback from Mattias. #

Patch Set 5 : Reuploading with lower "similarity". #

Total comments: 16

Patch Set 6 : Addressed code review feedback from Sergey. #

Total comments: 6

Patch Set 7 : Addressed code review feedback from Sergey. #

Total comments: 2

Patch Set 8 : Fixed the incorrect edit of BUILD.gn. #

Patch Set 9 : Rebasing... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+439 lines, -922 lines) Patch
M chrome/browser/policy/chrome_browser_policy_connector.cc View 1 2 2 chunks +1 line, -10 lines 0 comments Download
M chrome/common/chrome_paths.h View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/common/chrome_paths.cc View 1 2 1 chunk +0 lines, -12 lines 0 comments Download
M components/policy/core/common/BUILD.gn View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M components/policy/core/common/policy_loader_mac.h View 1 2 3 3 chunks +18 lines, -0 lines 0 comments Download
M components/policy/core/common/policy_loader_mac.cc View 1 2 1 chunk +0 lines, -160 lines 0 comments Download
A + components/policy/core/common/policy_loader_mac.mm View 1 2 3 4 5 6 7 chunks +59 lines, -25 lines 0 comments Download
M components/policy/core/common/policy_service_impl.h View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -0 lines 0 comments Download
M components/policy/core/common/policy_service_impl.cc View 1 2 6 chunks +10 lines, -0 lines 0 comments Download
M components/policy/policy_common.gypi View 1 2 1 chunk +1 line, -1 line 0 comments Download
M remoting/host/BUILD.gn View 1 2 3 4 5 6 7 8 3 chunks +1 line, -2 lines 0 comments Download
M remoting/host/policy_hack/fake_policy_watcher.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M remoting/host/policy_hack/fake_policy_watcher.cc View 1 2 1 chunk +0 lines, -3 lines 0 comments Download
A remoting/host/policy_hack/policy_service_watcher.cc View 1 2 3 4 5 6 1 chunk +233 lines, -0 lines 0 comments Download
M remoting/host/policy_hack/policy_watcher.h View 1 2 3 4 5 6 7 8 6 chunks +35 lines, -13 lines 0 comments Download
M remoting/host/policy_hack/policy_watcher.cc View 1 2 3 4 5 6 7 8 4 chunks +1 line, -20 lines 0 comments Download
D remoting/host/policy_hack/policy_watcher_chromeos.cc View 1 chunk +0 lines, -90 lines 0 comments Download
D remoting/host/policy_hack/policy_watcher_linux.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -256 lines 0 comments Download
D remoting/host/policy_hack/policy_watcher_mac.mm View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -92 lines 0 comments Download
M remoting/host/policy_hack/policy_watcher_unittest.cc View 1 2 3 4 5 6 7 8 2 chunks +73 lines, -2 lines 0 comments Download
D remoting/host/policy_hack/policy_watcher_win.cc View 1 chunk +0 lines, -226 lines 0 comments Download
M remoting/remoting_host.gypi View 1 2 3 4 5 6 7 8 3 chunks +1 line, -2 lines 0 comments Download
M remoting/remoting_host_srcs.gypi View 1 2 3 4 5 6 7 8 1 chunk +1 line, -4 lines 0 comments Download

Messages

Total messages: 24 (6 generated)
Łukasz Anforowicz
Hi Daniel, I am working on getting rid of copy&pasted policy code from src/remoting/host/policy_hack. Could ...
5 years, 11 months ago (2015-01-02 22:42:07 UTC) #2
Łukasz Anforowicz
Patchset#2 fixes problems building for ChromeOS.
5 years, 11 months ago (2015-01-04 04:23:41 UTC) #3
Łukasz Anforowicz
Patchset#2 fixes problems building for ChromeOS.
5 years, 11 months ago (2015-01-04 04:23:42 UTC) #4
Łukasz Anforowicz
Mattias, could you please take a look at this changelist as well? Thanks, Lukasz
5 years, 11 months ago (2015-01-06 04:10:19 UTC) #6
Mattias Nissler (ping if slow)
I very much like the direction of this, in particular the removal of the duplicated ...
5 years, 11 months ago (2015-01-06 09:06:12 UTC) #7
Łukasz Anforowicz
Thanks for the feedback Mattias - I tried addressing it in patchset #3. Could you ...
5 years, 11 months ago (2015-01-07 17:54:15 UTC) #9
Mattias Nissler (ping if slow)
LGTM w/ nits. https://codereview.chromium.org/830193002/diff/20001/remoting/host/policy_hack/policy_service_watcher.cc File remoting/host/policy_hack/policy_service_watcher.cc (right): https://codereview.chromium.org/830193002/diff/20001/remoting/host/policy_hack/policy_service_watcher.cc#newcode38 remoting/host/policy_hack/policy_service_watcher.cc:38: // an instance of PolicyService. On ...
5 years, 11 months ago (2015-01-08 09:58:37 UTC) #10
Łukasz Anforowicz
I've addressed the remaining feedback from Mattias. Sergey - could you please take a look ...
5 years, 11 months ago (2015-01-08 23:09:27 UTC) #11
Sergey Ulanov
looks mostly good, but I'm not sure why we need to keep PolicyServiceWatcher separate from ...
5 years, 11 months ago (2015-01-13 01:17:04 UTC) #12
Łukasz Anforowicz
Thanks for the feedback Sergey. I've addressed most of it in patchset #6. I started ...
5 years, 11 months ago (2015-01-13 18:28:29 UTC) #14
Sergey Ulanov
lgtm https://codereview.chromium.org/830193002/diff/120001/components/policy/core/common/policy_loader_mac.mm File components/policy/core/common/policy_loader_mac.mm (right): https://codereview.chromium.org/830193002/diff/120001/components/policy/core/common/policy_loader_mac.mm#newcode1 components/policy/core/common/policy_loader_mac.mm:1: // Copyright (c) 2012 The Chromium Authors. All ...
5 years, 11 months ago (2015-01-13 22:30:02 UTC) #15
Łukasz Anforowicz
Hi Lei, Could you please take a look at the changes to chrome/common/chrome_paths.h/.cc? You are ...
5 years, 11 months ago (2015-01-13 23:21:24 UTC) #17
Lei Zhang
I'm all for moving code out of chrome/common when it's not needed there. LGTM with ...
5 years, 11 months ago (2015-01-14 00:20:02 UTC) #18
Łukasz Anforowicz
Thanks Lei for taking a look and catching the issue in BUILD.gn. I'll try to ...
5 years, 11 months ago (2015-01-14 00:48:51 UTC) #19
Łukasz Anforowicz
Rebasing...
5 years, 11 months ago (2015-01-16 23:55:19 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/830193002/180001
5 years, 11 months ago (2015-01-16 23:55:33 UTC) #22
commit-bot: I haz the power
Committed patchset #9 (id:180001)
5 years, 11 months ago (2015-01-17 00:43:55 UTC) #23
commit-bot: I haz the power
5 years, 11 months ago (2015-01-17 00:45:18 UTC) #24
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/d5a6bda8b9cb6db9ee89e20e889916072a738ed4
Cr-Commit-Position: refs/heads/master@{#311994}

Powered by Google App Engine
This is Rietveld 408576698