Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc

Issue 751703003: Implemented consumer management unenrollment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dcpm
Patch Set: Rebase. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 for (const auto& change : pending_changes_) 678 for (const auto& change : pending_changes_)
679 UpdateDeviceSettings(change.first, *change.second, settings); 679 UpdateDeviceSettings(change.first, *change.second, settings);
680 pending_changes_.clear(); 680 pending_changes_.clear();
681 681
682 scoped_ptr<em::PolicyData> policy = AssemblePolicy( 682 scoped_ptr<em::PolicyData> policy = AssemblePolicy(
683 user_id_, device_settings_service_->policy_data(), &settings); 683 user_id_, device_settings_service_->policy_data(), &settings);
684 684
685 if (has_pending_management_settings_) { 685 if (has_pending_management_settings_) {
686 policy::SetManagementMode(*policy, 686 policy::SetManagementMode(*policy,
687 pending_management_settings_.management_mode); 687 pending_management_settings_.management_mode);
688 policy->set_request_token(pending_management_settings_.request_token); 688
689 policy->set_device_id(pending_management_settings_.device_id); 689 if (pending_management_settings_.request_token.empty())
690 policy->clear_request_token();
691 else
692 policy->set_request_token(pending_management_settings_.request_token);
693
694 if (pending_management_settings_.device_id.empty())
695 policy->clear_device_id();
696 else
697 policy->set_device_id(pending_management_settings_.device_id);
690 } 698 }
691 has_pending_management_settings_ = false; 699 has_pending_management_settings_ = false;
692 700
693 bool rv = AssembleAndSignPolicyAsync( 701 bool rv = AssembleAndSignPolicyAsync(
694 content::BrowserThread::GetBlockingPool(), policy.Pass(), 702 content::BrowserThread::GetBlockingPool(), policy.Pass(),
695 base::Bind(&OwnerSettingsServiceChromeOS::OnPolicyAssembledAndSigned, 703 base::Bind(&OwnerSettingsServiceChromeOS::OnPolicyAssembledAndSigned,
696 store_settings_factory_.GetWeakPtr())); 704 store_settings_factory_.GetWeakPtr()));
697 if (!rv) 705 if (!rv)
698 ReportStatusAndContinueStoring(false /* success */); 706 ReportStatusAndContinueStoring(false /* success */);
699 } 707 }
(...skipping 27 matching lines...) Expand all
727 std::vector<OnManagementSettingsSetCallback> callbacks; 735 std::vector<OnManagementSettingsSetCallback> callbacks;
728 pending_management_settings_callbacks_.swap(callbacks); 736 pending_management_settings_callbacks_.swap(callbacks);
729 for (const auto& callback : callbacks) { 737 for (const auto& callback : callbacks) {
730 if (!callback.is_null()) 738 if (!callback.is_null())
731 callback.Run(success); 739 callback.Run(success);
732 } 740 }
733 StorePendingChanges(); 741 StorePendingChanges();
734 } 742 }
735 743
736 } // namespace chromeos 744 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698