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/policy/user_cloud_policy_manager.h" | 5 #include "chrome/browser/policy/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 "chrome/browser/policy/cloud_policy_service.h" | 9 #include "chrome/browser/policy/cloud_policy_service.h" |
10 #include "chrome/browser/policy/policy_types.h" | 10 #include "chrome/browser/policy/policy_types.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 UserCloudPolicyManager::~UserCloudPolicyManager() { | 26 UserCloudPolicyManager::~UserCloudPolicyManager() { |
27 UserCloudPolicyManagerFactory::GetInstance()->Unregister(profile_, this); | 27 UserCloudPolicyManagerFactory::GetInstance()->Unregister(profile_, this); |
28 } | 28 } |
29 | 29 |
30 void UserCloudPolicyManager::Initialize( | 30 void UserCloudPolicyManager::Initialize( |
31 PrefService* local_state, | 31 PrefService* local_state, |
32 DeviceManagementService* device_management_service) { | 32 DeviceManagementService* device_management_service) { |
33 InitializeService( | 33 InitializeService( |
34 make_scoped_ptr(new CloudPolicyClient(std::string(), std::string(), | 34 make_scoped_ptr(new CloudPolicyClient(std::string(), std::string(), |
35 USER_AFFILIATION_NONE, | 35 USER_AFFILIATION_NONE, |
36 POLICY_SCOPE_USER, NULL, | 36 CloudPolicyClient::POLICY_TYPE_USER, |
37 device_management_service))); | 37 NULL, device_management_service))); |
38 StartRefreshScheduler(local_state, prefs::kUserPolicyRefreshRate); | 38 StartRefreshScheduler(local_state, prefs::kUserPolicyRefreshRate); |
39 } | 39 } |
40 | 40 |
41 void UserCloudPolicyManager::ShutdownAndRemovePolicy() { | 41 void UserCloudPolicyManager::ShutdownAndRemovePolicy() { |
42 ShutdownService(); | 42 ShutdownService(); |
43 store_->Clear(); | 43 store_->Clear(); |
44 } | 44 } |
45 | 45 |
46 bool UserCloudPolicyManager::IsClientRegistered() const { | 46 bool UserCloudPolicyManager::IsClientRegistered() const { |
47 return cloud_policy_client() && cloud_policy_client()->is_registered(); | 47 return cloud_policy_client() && cloud_policy_client()->is_registered(); |
48 } | 48 } |
49 | 49 |
50 void UserCloudPolicyManager::RegisterClient(const std::string& access_token) { | 50 void UserCloudPolicyManager::RegisterClient(const std::string& access_token) { |
51 DCHECK(cloud_policy_client()) << "Callers must invoke Initialize() first"; | 51 DCHECK(cloud_policy_client()) << "Callers must invoke Initialize() first"; |
52 if (!cloud_policy_client()->is_registered()) { | 52 if (!cloud_policy_client()->is_registered()) { |
53 DVLOG(1) << "Registering client with access token: " << access_token; | 53 DVLOG(1) << "Registering client with access token: " << access_token; |
54 cloud_policy_client()->Register(access_token); | 54 cloud_policy_client()->Register(access_token); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 } // namespace policy | 58 } // namespace policy |
OLD | NEW |