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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_whitelist_service.cc

Issue 879993005: Add support for uninstalling components and use it in SupervisedUserWhitelistInstaller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fix Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h" 5 #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 void SupervisedUserWhitelistService::SetWhitelistProperties( 267 void SupervisedUserWhitelistService::SetWhitelistProperties(
268 base::DictionaryValue* dict, 268 base::DictionaryValue* dict,
269 const sync_pb::ManagedUserWhitelistSpecifics& whitelist) { 269 const sync_pb::ManagedUserWhitelistSpecifics& whitelist) {
270 dict->SetString(kName, whitelist.name()); 270 dict->SetString(kName, whitelist.name());
271 } 271 }
272 272
273 void SupervisedUserWhitelistService::RemoveWhitelist( 273 void SupervisedUserWhitelistService::RemoveWhitelist(
274 base::DictionaryValue* pref_dict, 274 base::DictionaryValue* pref_dict,
275 const std::string& id) { 275 const std::string& id) {
276 pref_dict->RemoveWithoutPathExpansion(id, NULL); 276 pref_dict->RemoveWithoutPathExpansion(id, NULL);
277 installer_->UnregisterWhitelist(id); 277 installer_->UninstallWhitelist(id);
278 UnloadWhitelist(id); 278 UnloadWhitelist(id);
279 } 279 }
280 280
281 void SupervisedUserWhitelistService::RegisterWhitelist(const std::string& id, 281 void SupervisedUserWhitelistService::RegisterWhitelist(const std::string& id,
282 const std::string& name, 282 const std::string& name,
283 bool new_installation) { 283 bool new_installation) {
284 bool result = registered_whitelists_.insert(id).second; 284 bool result = registered_whitelists_.insert(id).second;
285 DCHECK(result); 285 DCHECK(result);
286 286
287 installer_->RegisterWhitelist( 287 installer_->RegisterWhitelist(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 UMA_HISTOGRAM_TIMES("ManagedUsers.Whitelist.TotalLoadDuration", 329 UMA_HISTOGRAM_TIMES("ManagedUsers.Whitelist.TotalLoadDuration",
330 base::TimeTicks::Now() - start_time); 330 base::TimeTicks::Now() - start_time);
331 331
332 // If the whitelist has been unregistered in the mean time, ignore it. 332 // If the whitelist has been unregistered in the mean time, ignore it.
333 if (registered_whitelists_.count(id) == 0u) 333 if (registered_whitelists_.count(id) == 0u)
334 return; 334 return;
335 335
336 loaded_whitelists_[id] = whitelist; 336 loaded_whitelists_[id] = whitelist;
337 NotifyWhitelistsChanged(); 337 NotifyWhitelistsChanged();
338 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698