| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 5 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 10 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // static | 66 // static |
| 67 scoped_ptr<CloudPolicyClient> | 67 scoped_ptr<CloudPolicyClient> |
| 68 UserCloudPolicyManager::CreateCloudPolicyClient( | 68 UserCloudPolicyManager::CreateCloudPolicyClient( |
| 69 DeviceManagementService* device_management_service, | 69 DeviceManagementService* device_management_service, |
| 70 scoped_refptr<net::URLRequestContextGetter> request_context) { | 70 scoped_refptr<net::URLRequestContextGetter> request_context) { |
| 71 return make_scoped_ptr( | 71 return make_scoped_ptr( |
| 72 new CloudPolicyClient( | 72 new CloudPolicyClient( |
| 73 std::string(), | 73 std::string(), |
| 74 std::string(), | 74 std::string(), |
| 75 kPolicyVerificationKeyHash, |
| 75 USER_AFFILIATION_NONE, | 76 USER_AFFILIATION_NONE, |
| 76 NULL, | 77 NULL, |
| 77 device_management_service, | 78 device_management_service, |
| 78 request_context)).Pass(); | 79 request_context)).Pass(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void UserCloudPolicyManager::DisconnectAndRemovePolicy() { | 82 void UserCloudPolicyManager::DisconnectAndRemovePolicy() { |
| 82 if (external_data_manager_) | 83 if (external_data_manager_) |
| 83 external_data_manager_->Disconnect(); | 84 external_data_manager_->Disconnect(); |
| 84 core()->Disconnect(); | 85 core()->Disconnect(); |
| 85 | 86 |
| 86 // store_->Clear() will publish the updated, empty policy. The component | 87 // store_->Clear() will publish the updated, empty policy. The component |
| 87 // policy service must be cleared before OnStoreLoaded() is issued, so that | 88 // policy service must be cleared before OnStoreLoaded() is issued, so that |
| 88 // component policies are also empty at CheckAndPublishPolicy(). | 89 // component policies are also empty at CheckAndPublishPolicy(). |
| 89 ClearAndDestroyComponentCloudPolicyService(); | 90 ClearAndDestroyComponentCloudPolicyService(); |
| 90 | 91 |
| 91 // When the |store_| is cleared, it informs the |external_data_manager_| that | 92 // When the |store_| is cleared, it informs the |external_data_manager_| that |
| 92 // all external data references have been removed, causing the | 93 // all external data references have been removed, causing the |
| 93 // |external_data_manager_| to clear its cache as well. | 94 // |external_data_manager_| to clear its cache as well. |
| 94 store_->Clear(); | 95 store_->Clear(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 bool UserCloudPolicyManager::IsClientRegistered() const { | 98 bool UserCloudPolicyManager::IsClientRegistered() const { |
| 98 return client() && client()->is_registered(); | 99 return client() && client()->is_registered(); |
| 99 } | 100 } |
| 100 | 101 |
| 101 } // namespace policy | 102 } // namespace policy |
| OLD | NEW |