| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ownership/owner_settings_service_chromeos.h" | 5 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 for (const auto& change : pending_changes_) | 712 for (const auto& change : pending_changes_) |
| 713 UpdateDeviceSettings(change.first, *change.second, settings); | 713 UpdateDeviceSettings(change.first, *change.second, settings); |
| 714 pending_changes_.clear(); | 714 pending_changes_.clear(); |
| 715 | 715 |
| 716 scoped_ptr<em::PolicyData> policy = AssemblePolicy( | 716 scoped_ptr<em::PolicyData> policy = AssemblePolicy( |
| 717 user_id_, device_settings_service_->policy_data(), &settings); | 717 user_id_, device_settings_service_->policy_data(), &settings); |
| 718 | 718 |
| 719 if (has_pending_management_settings_) { | 719 if (has_pending_management_settings_) { |
| 720 policy::SetManagementMode(*policy, | 720 policy::SetManagementMode(*policy, |
| 721 pending_management_settings_.management_mode); | 721 pending_management_settings_.management_mode); |
| 722 | 722 policy->set_request_token(pending_management_settings_.request_token); |
| 723 if (pending_management_settings_.request_token.empty()) | 723 policy->set_device_id(pending_management_settings_.device_id); |
| 724 policy->clear_request_token(); | |
| 725 else | |
| 726 policy->set_request_token(pending_management_settings_.request_token); | |
| 727 | |
| 728 if (pending_management_settings_.device_id.empty()) | |
| 729 policy->clear_device_id(); | |
| 730 else | |
| 731 policy->set_device_id(pending_management_settings_.device_id); | |
| 732 } | 724 } |
| 733 has_pending_management_settings_ = false; | 725 has_pending_management_settings_ = false; |
| 734 | 726 |
| 735 bool rv = AssembleAndSignPolicyAsync( | 727 bool rv = AssembleAndSignPolicyAsync( |
| 736 content::BrowserThread::GetBlockingPool(), policy.Pass(), | 728 content::BrowserThread::GetBlockingPool(), policy.Pass(), |
| 737 base::Bind(&OwnerSettingsServiceChromeOS::OnPolicyAssembledAndSigned, | 729 base::Bind(&OwnerSettingsServiceChromeOS::OnPolicyAssembledAndSigned, |
| 738 store_settings_factory_.GetWeakPtr())); | 730 store_settings_factory_.GetWeakPtr())); |
| 739 if (!rv) | 731 if (!rv) |
| 740 ReportStatusAndContinueStoring(false /* success */); | 732 ReportStatusAndContinueStoring(false /* success */); |
| 741 } | 733 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 769 std::vector<OnManagementSettingsSetCallback> callbacks; | 761 std::vector<OnManagementSettingsSetCallback> callbacks; |
| 770 pending_management_settings_callbacks_.swap(callbacks); | 762 pending_management_settings_callbacks_.swap(callbacks); |
| 771 for (const auto& callback : callbacks) { | 763 for (const auto& callback : callbacks) { |
| 772 if (!callback.is_null()) | 764 if (!callback.is_null()) |
| 773 callback.Run(success); | 765 callback.Run(success); |
| 774 } | 766 } |
| 775 StorePendingChanges(); | 767 StorePendingChanges(); |
| 776 } | 768 } |
| 777 | 769 |
| 778 } // namespace chromeos | 770 } // namespace chromeos |
| OLD | NEW |