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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 for (PolicyBrokerMap::iterator it(policy_brokers_.begin()); | 307 for (PolicyBrokerMap::iterator it(policy_brokers_.begin()); |
308 it != policy_brokers_.end(); ++it) { | 308 it != policy_brokers_.end(); ++it) { |
309 it->second->ConnectIfPossible(device_settings_service_, | 309 it->second->ConnectIfPossible(device_settings_service_, |
310 device_management_service_, | 310 device_management_service_, |
311 request_context_); | 311 request_context_); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 DeviceLocalAccountPolicyBroker* | 315 DeviceLocalAccountPolicyBroker* |
316 DeviceLocalAccountPolicyService::GetBrokerForUser( | 316 DeviceLocalAccountPolicyService::GetBrokerForUser( |
317 const std::string& user_id) { | 317 const user_manager::UserID& user_id) { |
318 PolicyBrokerMap::iterator entry = policy_brokers_.find(user_id); | 318 PolicyBrokerMap::iterator entry = policy_brokers_.find(user_id); |
319 if (entry == policy_brokers_.end()) | 319 if (entry == policy_brokers_.end()) |
320 return nullptr; | 320 return nullptr; |
321 | 321 |
322 return entry->second; | 322 return entry->second; |
323 } | 323 } |
324 | 324 |
325 bool DeviceLocalAccountPolicyService::IsPolicyAvailableForUser( | 325 bool DeviceLocalAccountPolicyService::IsPolicyAvailableForUser( |
326 const std::string& user_id) { | 326 const user_manager::UserID& user_id) { |
327 DeviceLocalAccountPolicyBroker* broker = GetBrokerForUser(user_id); | 327 DeviceLocalAccountPolicyBroker* broker = GetBrokerForUser(user_id); |
328 return broker && broker->core()->store()->is_managed(); | 328 return broker && broker->core()->store()->is_managed(); |
329 } | 329 } |
330 | 330 |
331 void DeviceLocalAccountPolicyService::AddObserver(Observer* observer) { | 331 void DeviceLocalAccountPolicyService::AddObserver(Observer* observer) { |
332 observers_.AddObserver(observer); | 332 observers_.AddObserver(observer); |
333 } | 333 } |
334 | 334 |
335 void DeviceLocalAccountPolicyService::RemoveObserver(Observer* observer) { | 335 void DeviceLocalAccountPolicyService::RemoveObserver(Observer* observer) { |
336 observers_.RemoveObserver(observer); | 336 observers_.RemoveObserver(observer); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 CloudPolicyStore* store) { | 570 CloudPolicyStore* store) { |
571 for (PolicyBrokerMap::iterator it(policy_brokers_.begin()); | 571 for (PolicyBrokerMap::iterator it(policy_brokers_.begin()); |
572 it != policy_brokers_.end(); ++it) { | 572 it != policy_brokers_.end(); ++it) { |
573 if (it->second->core()->store() == store) | 573 if (it->second->core()->store() == store) |
574 return it->second; | 574 return it->second; |
575 } | 575 } |
576 return nullptr; | 576 return nullptr; |
577 } | 577 } |
578 | 578 |
579 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( | 579 void DeviceLocalAccountPolicyService::NotifyPolicyUpdated( |
580 const std::string& user_id) { | 580 const user_manager::UserID& user_id) { |
581 FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(user_id)); | 581 FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(user_id)); |
582 } | 582 } |
583 | 583 |
584 } // namespace policy | 584 } // namespace policy |
OLD | NEW |