| 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/device_local_account_policy_service.h" | 5 #include "chrome/browser/policy/device_local_account_policy_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/policy/cloud_policy_client.h" | 9 #include "chrome/browser/policy/cloud_policy_client.h" |
| 10 #include "chrome/browser/policy/cloud_policy_refresh_scheduler.h" | 10 #include "chrome/browser/policy/cloud_policy_refresh_scheduler.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 DeviceLocalAccountPolicyBroker::DeviceLocalAccountPolicyBroker( | 22 DeviceLocalAccountPolicyBroker::DeviceLocalAccountPolicyBroker( |
| 23 const std::string& account_id, | 23 const std::string& account_id, |
| 24 chromeos::SessionManagerClient* session_manager_client, | 24 chromeos::SessionManagerClient* session_manager_client, |
| 25 chromeos::DeviceSettingsService* device_settings_service) | 25 chromeos::DeviceSettingsService* device_settings_service) |
| 26 : account_id_(account_id), | 26 : account_id_(account_id), |
| 27 store_(account_id, session_manager_client, device_settings_service) {} | 27 store_(account_id, session_manager_client, device_settings_service) {} |
| 28 | 28 |
| 29 DeviceLocalAccountPolicyBroker::~DeviceLocalAccountPolicyBroker() {} | 29 DeviceLocalAccountPolicyBroker::~DeviceLocalAccountPolicyBroker() {} |
| 30 | 30 |
| 31 void DeviceLocalAccountPolicyBroker::RefreshPolicy( | 31 void DeviceLocalAccountPolicyBroker::RefreshPolicy( |
| 32 const base::Closure& callback) { | 32 const CloudPolicyService::RefreshPolicyCallback& callback) { |
| 33 if (service_.get()) | 33 if (service_.get()) |
| 34 service_->RefreshPolicy(callback); | 34 service_->RefreshPolicy(callback); |
| 35 else | 35 else |
| 36 callback.Run(); | 36 callback.Run(false); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void DeviceLocalAccountPolicyBroker::Connect( | 39 void DeviceLocalAccountPolicyBroker::Connect( |
| 40 scoped_ptr<CloudPolicyClient> client) { | 40 scoped_ptr<CloudPolicyClient> client) { |
| 41 DCHECK(!client_.get()); | 41 DCHECK(!client_.get()); |
| 42 client_ = client.Pass(); | 42 client_ = client.Pass(); |
| 43 service_.reset(new CloudPolicyService(client_.get(), &store_)); | 43 service_.reset(new CloudPolicyService(client_.get(), &store_)); |
| 44 refresh_scheduler_.reset( | 44 refresh_scheduler_.reset( |
| 45 new CloudPolicyRefreshScheduler( | 45 new CloudPolicyRefreshScheduler( |
| 46 client_.get(), &store_, | 46 client_.get(), &store_, |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 USER_AFFILIATION_MANAGED, | 238 USER_AFFILIATION_MANAGED, |
| 239 CloudPolicyClient::POLICY_TYPE_PUBLIC_ACCOUNT, | 239 CloudPolicyClient::POLICY_TYPE_PUBLIC_ACCOUNT, |
| 240 NULL, device_management_service_)); | 240 NULL, device_management_service_)); |
| 241 client->SetupRegistration(policy_data->request_token(), | 241 client->SetupRegistration(policy_data->request_token(), |
| 242 policy_data->device_id()); | 242 policy_data->device_id()); |
| 243 client->set_entity_id(account_id); | 243 client->set_entity_id(account_id); |
| 244 return client.Pass(); | 244 return client.Pass(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace policy | 247 } // namespace policy |
| OLD | NEW |