Chromium Code Reviews| Index: chrome/browser/supervised_user/supervised_user_whitelist_service.cc |
| diff --git a/chrome/browser/supervised_user/supervised_user_whitelist_service.cc b/chrome/browser/supervised_user/supervised_user_whitelist_service.cc |
| index c688abe35f3bed99174dcad6b445349b4ce7410c..45faa00f0870e62d04f9c5326eedee49ee977374 100644 |
| --- a/chrome/browser/supervised_user/supervised_user_whitelist_service.cc |
| +++ b/chrome/browser/supervised_user/supervised_user_whitelist_service.cc |
| @@ -84,12 +84,7 @@ void SupervisedUserWhitelistService::Init() { |
| whitelist.CopyToString(&id); |
| } |
| - // Skip whitelists that were already registered. |
| - if (registered_whitelists_.count(id) > 0u) |
| - continue; |
| - |
| - bool new_installation = true; |
| - RegisterWhitelist(id, name, new_installation); |
| + RegisterWhitelist(id, name, FROM_COMMAND_LINE); |
| } |
| } |
| @@ -269,8 +264,7 @@ void SupervisedUserWhitelistService::AddNewWhitelist( |
| const sync_pb::ManagedUserWhitelistSpecifics& whitelist) { |
| base::RecordAction(base::UserMetricsAction("ManagedUsers_Whitelist_Added")); |
| - bool new_installation = true; |
| - RegisterWhitelist(whitelist.id(), whitelist.name(), new_installation); |
| + RegisterWhitelist(whitelist.id(), whitelist.name(), FROM_SYNC); |
| scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
| SetWhitelistProperties(dict.get(), whitelist); |
| pref_dict->SetWithoutPathExpansion(whitelist.id(), dict.release()); |
| @@ -294,11 +288,19 @@ void SupervisedUserWhitelistService::RemoveWhitelist( |
| void SupervisedUserWhitelistService::RegisterWhitelist(const std::string& id, |
| const std::string& name, |
| - bool new_installation) { |
| + WhitelistSource source) { |
| bool result = registered_whitelists_.insert(id).second; |
| DCHECK(result); |
| - installer_->RegisterWhitelist(client_id_, id, name); |
| + // Using an empty client ID for whitelists installed from the command line |
| + // causes the installer to not persist the installation, so the whitelist will |
| + // be removed the next time the browser is started without the command line |
| + // flag. |
| + std::string client_id; |
| + if (source == FROM_SYNC) |
| + client_id = client_id_; |
|
Marc Treib
2015/10/16 11:03:58
nit: I'd have put this inline, like
(source == FRO
Bernhard Bauer
2015/10/16 11:23:13
Done.
|
| + |
| + installer_->RegisterWhitelist(client_id, id, name); |
| } |
| void SupervisedUserWhitelistService::GetLoadedWhitelists( |