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

Unified Diff: chrome/browser/supervised_user/supervised_user_whitelist_service.cc

Issue 1408023003: Don't persist registrations for whitelists installed from the command line. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_whitelist_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7fdc0c19f8ce70de5cde7d305a65c3c53b8565ae 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,16 @@ 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.
+ installer_->RegisterWhitelist(
+ source == FROM_COMMAND_LINE ? std::string() : client_id_, id, name);
}
void SupervisedUserWhitelistService::GetLoadedWhitelists(
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_whitelist_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698