| 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 policy->set_request_token(pending_management_settings_.request_token); | 722 |
| 723 policy->set_device_id(pending_management_settings_.device_id); | 723 if (pending_management_settings_.request_token.empty()) |
| 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); |
| 724 } | 732 } |
| 725 has_pending_management_settings_ = false; | 733 has_pending_management_settings_ = false; |
| 726 | 734 |
| 727 bool rv = AssembleAndSignPolicyAsync( | 735 bool rv = AssembleAndSignPolicyAsync( |
| 728 content::BrowserThread::GetBlockingPool(), policy.Pass(), | 736 content::BrowserThread::GetBlockingPool(), policy.Pass(), |
| 729 base::Bind(&OwnerSettingsServiceChromeOS::OnPolicyAssembledAndSigned, | 737 base::Bind(&OwnerSettingsServiceChromeOS::OnPolicyAssembledAndSigned, |
| 730 store_settings_factory_.GetWeakPtr())); | 738 store_settings_factory_.GetWeakPtr())); |
| 731 if (!rv) | 739 if (!rv) |
| 732 ReportStatusAndContinueStoring(false /* success */); | 740 ReportStatusAndContinueStoring(false /* success */); |
| 733 } | 741 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 761 std::vector<OnManagementSettingsSetCallback> callbacks; | 769 std::vector<OnManagementSettingsSetCallback> callbacks; |
| 762 pending_management_settings_callbacks_.swap(callbacks); | 770 pending_management_settings_callbacks_.swap(callbacks); |
| 763 for (const auto& callback : callbacks) { | 771 for (const auto& callback : callbacks) { |
| 764 if (!callback.is_null()) | 772 if (!callback.is_null()) |
| 765 callback.Run(success); | 773 callback.Run(success); |
| 766 } | 774 } |
| 767 StorePendingChanges(); | 775 StorePendingChanges(); |
| 768 } | 776 } |
| 769 | 777 |
| 770 } // namespace chromeos | 778 } // namespace chromeos |
| OLD | NEW |