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

Issue 341043005: Wire up component cloud policy to device local accounts. (Closed)

Created:
6 years, 6 months ago by Joao da Silva
Modified:
6 years, 6 months ago
CC:
chromium-reviews, extensions-reviews_chromium.org, nkostylev+watch_chromium.org, oshima+watch_chromium.org, chromium-apps-reviews_chromium.org, stevenjb+watch_chromium.org, davemoore+watch_chromium.org
Project:
chromium
Visibility:
Public.

Description

Wire up component cloud policy to device local accounts. This enables policy-for-extensions running in Public Sessions, and for extensions running as Kiosk Apps too. TBR=bartfab@chromium.org BUG=224596 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=278518

Patch Set 1 #

Total comments: 5

Patch Set 2 : cleanups #

Patch Set 3 : fix tests #

Total comments: 48
Unified diffs Side-by-side diffs Delta from patch set Stats (+199 lines, -55 lines) Patch
M chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.cc View 1 chunk +3 lines, -0 lines 2 comments Download
M chrome/browser/chromeos/policy/device_local_account_browsertest.cc View 1 2 5 chunks +5 lines, -18 lines 4 comments Download
M chrome/browser/chromeos/policy/device_local_account_policy_provider.h View 5 chunks +17 lines, -1 line 4 comments Download
M chrome/browser/chromeos/policy/device_local_account_policy_provider.cc View 1 2 6 chunks +69 lines, -1 line 6 comments Download
M chrome/browser/chromeos/policy/device_local_account_policy_service.h View 1 2 6 chunks +17 lines, -0 lines 12 comments Download
M chrome/browser/chromeos/policy/device_local_account_policy_service.cc View 1 2 14 chunks +47 lines, -29 lines 4 comments Download
M chrome/browser/policy/test/policy_testserver.py View 8 chunks +21 lines, -6 lines 12 comments Download
M chromeos/chromeos_paths.h View 1 chunk +5 lines, -0 lines 4 comments Download
M chromeos/chromeos_paths.cc View 3 chunks +15 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
Joao da Silva
PTAL, thanks!
6 years, 6 months ago (2014-06-19 16:48:03 UTC) #1
Bernhard Bauer
LGTM https://codereview.chromium.org/341043005/diff/1/chrome/browser/chromeos/policy/device_local_account_policy_service.cc File chrome/browser/chromeos/policy/device_local_account_policy_service.cc (right): https://codereview.chromium.org/341043005/diff/1/chrome/browser/chromeos/policy/device_local_account_policy_service.cc#newcode455 chrome/browser/chromeos/policy/device_local_account_policy_service.cc:455: CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, Why a CHECK instead of a DCHECK? ...
6 years, 6 months ago (2014-06-19 16:59:27 UTC) #2
Joao da Silva
Thanks for the quick review! https://codereview.chromium.org/341043005/diff/1/chrome/browser/chromeos/policy/device_local_account_policy_service.cc File chrome/browser/chromeos/policy/device_local_account_policy_service.cc (right): https://codereview.chromium.org/341043005/diff/1/chrome/browser/chromeos/policy/device_local_account_policy_service.cc#newcode455 chrome/browser/chromeos/policy/device_local_account_policy_service.cc:455: CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, On 2014/06/19 16:59:27, ...
6 years, 6 months ago (2014-06-19 17:04:56 UTC) #3
Joao da Silva
The CQ bit was checked by joaodasilva@chromium.org
6 years, 6 months ago (2014-06-19 17:05:24 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/joaodasilva@chromium.org/341043005/20001
6 years, 6 months ago (2014-06-19 17:07:20 UTC) #5
Joao da Silva
TBRing this because QA needs a build ASAP, and today is a holiday in MUC. ...
6 years, 6 months ago (2014-06-19 17:07:49 UTC) #6
Bernhard Bauer
https://codereview.chromium.org/341043005/diff/1/chrome/browser/chromeos/policy/device_local_account_policy_service.cc File chrome/browser/chromeos/policy/device_local_account_policy_service.cc (right): https://codereview.chromium.org/341043005/diff/1/chrome/browser/chromeos/policy/device_local_account_policy_service.cc#newcode455 chrome/browser/chromeos/policy/device_local_account_policy_service.cc:455: CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, On 2014/06/19 17:04:56, Joao da Silva wrote: > ...
6 years, 6 months ago (2014-06-19 17:22:44 UTC) #7
Joao da Silva
The CQ bit was checked by joaodasilva@chromium.org
6 years, 6 months ago (2014-06-19 19:33:45 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/joaodasilva@chromium.org/341043005/40001
6 years, 6 months ago (2014-06-19 19:37:14 UTC) #9
commit-bot: I haz the power
Change committed as 278518
6 years, 6 months ago (2014-06-19 22:49:17 UTC) #10
bartfab (slow)
https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.cc File chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.cc (right): https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.cc#newcode70 chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.cc:70: "ongnjlefhnoajpbodoldndkbkdgfomlp", // Show Managed Storage You skipped process here ...
6 years, 6 months ago (2014-06-20 09:17:26 UTC) #11
Joao da Silva
6 years, 6 months ago (2014-06-20 11:48:46 UTC) #12
Message was sent while issue was closed.
Publishes comment to Bartosz's review, to be addressed in a subsequent CL.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
File
chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.cc
(right):

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.cc:70:
"ongnjlefhnoajpbodoldndkbkdgfomlp",  // Show Managed Storage
On 2014/06/20 09:17:24, bartfab wrote:
> You skipped process here :). We always ask Will or Sumit to sign off on
> apps/extensions before adding them to the whitelist. Since this is an
extension
> we wrote ourselves, I am not concerned that it may be requesting excessive
> permissions or doing something nasty but it would still be good to get their
> blessing.

Thanks, I've notified Will and Sumit. As discussed offline, this file should at
least have a comment about that process; having an OWNERS file with set
no-parent would be even better.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
File chrome/browser/chromeos/policy/device_local_account_browsertest.cc (right):

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_browsertest.cc:424:
base::FilePath GetCacheDirectoryForAccountID(const std::string& account_id) {
On 2014/06/20 09:17:24, bartfab wrote:
> Nit: This should be renamed to indicate that it refers to the extensions cache
> only.

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_browsertest.cc:426:
PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS,
On 2014/06/20 09:17:24, bartfab wrote:
> Nit: ADD_FAILURE() if PathService::Get() fails.

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
File chrome/browser/chromeos/policy/device_local_account_policy_provider.cc
(right):

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_provider.cc:112:
return component_policy_service_->is_initialized();
On 2014/06/20 09:17:25, bartfab wrote:
> Is it correct for this method to return |true| if the
> |component_policy_service_| has simply not been initialized yet?

Good observation. In the next CL the component_policy_service_ has already been
created by the time this is called; if it's NULL then it has been disabled via
the command line flag, and in that case this should return true.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_provider.cc:150: //
The |component_policy_service_| relies on the broker's CloudPolicyCore,
On 2014/06/20 09:17:24, bartfab wrote:
> Nit: s/broker/|broker|/

Obsolete in the next CL.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_provider.cc:151: //
so destroy it if the broker is going away.
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: s/broker/|broker|/

Same

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
File chrome/browser/chromeos/policy/device_local_account_policy_provider.h
(right):

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_provider.h:18:
#include "components/policy/core/common/cloud/resource_cache.h"
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: Move this to the implementation file. It is not used by the header.

Obsolete in the next CL.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_provider.h:29: // and
RefreshPolicies becomes a no-op.
On 2014/06/20 09:17:25, bartfab wrote:
> Document what happens to component policy in that case.

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
File chrome/browser/chromeos/policy/device_local_account_policy_service.cc
(right):

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_service.cc:76: //
extensions are cached for |account_id|. This is also used for the
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: Why not reword the comment to talk about both forice-installed extensions
> and component policy then, e.g.:
> 
> Get the subdirectory of the force-installed extension cache and the component
> policy cache used for |account_id|.

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_service.cc:78:
std::string EncodeAccountId(const std::string& account_id) {
On 2014/06/20 09:17:25, bartfab wrote:
> Why did you rename this? "Encode" could mean a million things.
> "GetCacheSubdirectory" is much more precise.

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
File chrome/browser/chromeos/policy/device_local_account_policy_service.h
(right):

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_service.h:91: //
Returns a directory where component policy for this account can be cached.
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: s/ a / the /

Obsolete in the next CL

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_service.h:92: // The
DeviceLocalAccountPolicyService takes care of cleaning up caches of
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: s /caches of/caches belonging to/

Obsolete in the next CL

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_service.h:127:
virtual void OnBrokerShutdown(DeviceLocalAccountPolicyBroker* broker) {}
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: Instead of exposing the internal detail that policy for device-local
> accounts is handled by Brokers, how about calling this something like
> OnPolicyServiceShutdown(const std::string& user_id)?

This method has been removed.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_service.h:228:
OrphanCacheDeletionState orphan_cache_deletion_state_;
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: The type, member name and comment need to be updated to clarify that they
> refer to the extensions cache only.

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_service.h:245: //
Path to the directory that contains the cached policies for components
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: s/policies/policy/

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/chromeos/...
chrome/browser/chromeos/policy/device_local_account_policy_service.h:246: // for
device local accounts.
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: s/device local/device-local/

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/policy/te...
File chrome/browser/policy/test/policy_testserver.py (right):

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/policy/te...
chrome/browser/policy/test/policy_testserver.py:446: # If this is a
publicaccount request then get the username now and use it
On 2014/06/20 09:17:25, bartfab wrote:
> Nit 1: s/publicaccount/|publicaccount|/
> Nit 2: s/username/|username|/

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/policy/te...
chrome/browser/policy/test/policy_testserver.py:448: # policy for extensions in
public accounts.
On 2014/06/20 09:17:25, bartfab wrote:
> 1: Nit: s/accounts/sessions/
> 2: Do we use the |publicaccount| type for single-app kiosk mode as well? If
so,
> the comment should say "device-local accounts" instead of "public sessions."

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/policy/te...
chrome/browser/policy/test/policy_testserver.py:449: username =
self.server.GetPolicies().get('policy_user', None)
On 2014/06/20 09:17:25, bartfab wrote:
> 1: Why is this needed? The code is prepared to handle |username == None|.
> 2: In ProcessCloudPolicy(), there is a comment that explains why the
|username|
> is read from global configuration. Here, it is done without any further
comment.

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/policy/te...
chrome/browser/policy/test/policy_testserver.py:452: username =
request.settings_entity_id
On 2014/06/20 09:17:25, bartfab wrote:
> What happens if we get requests for multiple public sessions together?

Then this doesn't work :-) The current client implementation has one separate
broker for each account, so there is one request to the server per account and
this works.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/policy/te...
chrome/browser/policy/test/policy_testserver.py:652: username: The username for
the response.
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: Add "May be None."

Done.

https://codereview.chromium.org/341043005/diff/40001/chrome/browser/policy/te...
chrome/browser/policy/test/policy_testserver.py:762: policy_data.username =
username
On 2014/06/20 09:17:25, bartfab wrote:
> Why can we not extract the username from |msg| here as we normally do for
public
> sessions?

Because the |msg| here is one of the repeated PolicyFetchRequests and doesn't
necessarily have the username. If this is a request for policy-for-extensions
then it doesn't have the username, for example. That's why it's extracted from
the sibling PolicyFetchRequest (for publicaccounts policy) and then passed in
here.

https://codereview.chromium.org/341043005/diff/40001/chromeos/chromeos_paths.h
File chromeos/chromeos_paths.h (right):

https://codereview.chromium.org/341043005/diff/40001/chromeos/chromeos_paths....
chromeos/chromeos_paths.h:41: DIR_DEVICE_LOCAL_ACCOUNT_COMPONENT_POLICY,  //
Directory where policy for the
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: This sentence is hard to parse. How about something like:
> 
> "Directory where policy for components is stored for device-local accounts."

Done.

https://codereview.chromium.org/341043005/diff/40001/chromeos/chromeos_paths....
chromeos/chromeos_paths.h:43: // account is stored. Currently
On 2014/06/20 09:17:25, bartfab wrote:
> Nit: s/account/accounts/

Done.

Powered by Google App Engine
This is Rietveld 408576698