| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/policy/device_local_account_policy_service.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 // Purge the component policy caches of any accounts that have been removed. | 522 // Purge the component policy caches of any accounts that have been removed. |
| 523 // Do this only after any obsolete brokers have been destroyed. | 523 // Do this only after any obsolete brokers have been destroyed. |
| 524 // TODO(joaodasilva): for now this must be posted to the FILE thread, | 524 // TODO(joaodasilva): for now this must be posted to the FILE thread, |
| 525 // to avoid racing with the ComponentCloudPolicyStore. Use a task runner | 525 // to avoid racing with the ComponentCloudPolicyStore. Use a task runner |
| 526 // once that class supports another background thread too. | 526 // once that class supports another background thread too. |
| 527 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, | 527 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, |
| 528 base::Bind(&DeleteOrphanedCaches, | 528 base::Bind(&DeleteOrphanedCaches, |
| 529 component_policy_cache_root_, | 529 component_policy_cache_root_, |
| 530 subdirectories_to_keep)); | 530 subdirectories_to_keep)); |
| 531 | 531 |
| 532 FOR_EACH_OBSERVER(Observer, observers_, OnDeviceLocalAccountsChanged()); | 532 for (auto& observer : observers_) |
| 533 observer.OnDeviceLocalAccountsChanged(); |
| 533 } | 534 } |
| 534 | 535 |
| 535 void DeviceLocalAccountPolicyService::DeleteBrokers(PolicyBrokerMap* map) { | 536 void DeviceLocalAccountPolicyService::DeleteBrokers(PolicyBrokerMap* map) { |
| 536 for (PolicyBrokerMap::iterator it = map->begin(); it != map->end(); ++it) { | 537 for (PolicyBrokerMap::iterator it = map->begin(); it != map->end(); ++it) { |
| 537 scoped_refptr<chromeos::DeviceLocalAccountExternalPolicyLoader> | 538 scoped_refptr<chromeos::DeviceLocalAccountExternalPolicyLoader> |
| 538 extension_loader = it->second->extension_loader(); | 539 extension_loader = it->second->extension_loader(); |
| 539 if (extension_loader->IsCacheRunning()) { | 540 if (extension_loader->IsCacheRunning()) { |
| 540 DCHECK(!IsExtensionCacheDirectoryBusy(it->second->account_id())); | 541 DCHECK(!IsExtensionCacheDirectoryBusy(it->second->account_id())); |
| 541 busy_extension_cache_directories_.insert(it->second->account_id()); | 542 busy_extension_cache_directories_.insert(it->second->account_id()); |
| 542 extension_loader->StopCache(base::Bind( | 543 extension_loader->StopCache(base::Bind( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 556 for (PolicyBrokerMap::iterator it(policy_brokers_.begin()); | 557 for (PolicyBrokerMap::iterator it(policy_brokers_.begin()); |
| 557 it != policy_brokers_.end(); ++it) { | 558 it != policy_brokers_.end(); ++it) { |
| 558 if (it->second->core()->store() == store) | 559 if (it->second->core()->store() == store) |
| 559 return it->second; | 560 return it->second; |
| 560 } | 561 } |
| 561 return nullptr; | 562 return nullptr; |
| 562 } | 563 } |
| 563 | 564 |
| 564 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( | 565 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( |
| 565 const std::string& user_id) { | 566 const std::string& user_id) { |
| 566 FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(user_id)); | 567 for (auto& observer : observers_) |
| 568 observer.OnPolicyUpdated(user_id); |
| 567 } | 569 } |
| 568 | 570 |
| 569 } // namespace policy | 571 } // namespace policy |
| OLD | NEW |