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

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: Created 5 years, 11 months 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 const content::NotificationSource& source, 325 const content::NotificationSource& source,
326 const content::NotificationDetails& details) { 326 const content::NotificationDetails& details) {
327 DCHECK(thread_checker_.CalledOnValidThread()); 327 DCHECK(thread_checker_.CalledOnValidThread());
328 if (type != chrome::NOTIFICATION_PROFILE_CREATED) { 328 if (type != chrome::NOTIFICATION_PROFILE_CREATED) {
329 NOTREACHED(); 329 NOTREACHED();
330 return; 330 return;
331 } 331 }
332 332
333 Profile* profile = content::Source<Profile>(source).ptr(); 333 Profile* profile = content::Source<Profile>(source).ptr();
334 if (profile != profile_) { 334 if (profile != profile_) {
335 LOG(ERROR) << "===== profile = " << profile;
ygorshenin1 2015/01/12 10:08:55 Could you please replace these two error messages
davidyu 2015/01/13 05:43:52 I'll just remove the debug message that I forgot t
336 LOG(ERROR) << "===== profile_ = " << profile_;
335 NOTREACHED(); 337 NOTREACHED();
336 return; 338 return;
337 } 339 }
338 340
339 waiting_for_profile_creation_ = false; 341 waiting_for_profile_creation_ = false;
340 ReloadKeypair(); 342 ReloadKeypair();
341 } 343 }
342 344
343 void OwnerSettingsServiceChromeOS::OwnerKeySet(bool success) { 345 void OwnerSettingsServiceChromeOS::OwnerKeySet(bool success) {
344 DCHECK(thread_checker_.CalledOnValidThread()); 346 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 for (const auto& change : pending_changes_) 714 for (const auto& change : pending_changes_)
713 UpdateDeviceSettings(change.first, *change.second, settings); 715 UpdateDeviceSettings(change.first, *change.second, settings);
714 pending_changes_.clear(); 716 pending_changes_.clear();
715 717
716 scoped_ptr<em::PolicyData> policy = AssemblePolicy( 718 scoped_ptr<em::PolicyData> policy = AssemblePolicy(
717 user_id_, device_settings_service_->policy_data(), &settings); 719 user_id_, device_settings_service_->policy_data(), &settings);
718 720
719 if (has_pending_management_settings_) { 721 if (has_pending_management_settings_) {
720 policy::SetManagementMode(*policy, 722 policy::SetManagementMode(*policy,
721 pending_management_settings_.management_mode); 723 pending_management_settings_.management_mode);
722 policy->set_request_token(pending_management_settings_.request_token); 724
723 policy->set_device_id(pending_management_settings_.device_id); 725 if (pending_management_settings_.request_token.empty())
726 policy->clear_request_token();
727 else
728 policy->set_request_token(pending_management_settings_.request_token);
729
730 if (pending_management_settings_.device_id.empty())
731 policy->clear_device_id();
732 else
733 policy->set_device_id(pending_management_settings_.device_id);
724 } 734 }
725 has_pending_management_settings_ = false; 735 has_pending_management_settings_ = false;
726 736
727 bool rv = AssembleAndSignPolicyAsync( 737 bool rv = AssembleAndSignPolicyAsync(
728 content::BrowserThread::GetBlockingPool(), policy.Pass(), 738 content::BrowserThread::GetBlockingPool(), policy.Pass(),
729 base::Bind(&OwnerSettingsServiceChromeOS::OnPolicyAssembledAndSigned, 739 base::Bind(&OwnerSettingsServiceChromeOS::OnPolicyAssembledAndSigned,
730 store_settings_factory_.GetWeakPtr())); 740 store_settings_factory_.GetWeakPtr()));
731 if (!rv) 741 if (!rv)
732 ReportStatusAndContinueStoring(false /* success */); 742 ReportStatusAndContinueStoring(false /* success */);
733 } 743 }
(...skipping 27 matching lines...) Expand all
761 std::vector<OnManagementSettingsSetCallback> callbacks; 771 std::vector<OnManagementSettingsSetCallback> callbacks;
762 pending_management_settings_callbacks_.swap(callbacks); 772 pending_management_settings_callbacks_.swap(callbacks);
763 for (const auto& callback : callbacks) { 773 for (const auto& callback : callbacks) {
764 if (!callback.is_null()) 774 if (!callback.is_null())
765 callback.Run(success); 775 callback.Run(success);
766 } 776 }
767 StorePendingChanges(); 777 StorePendingChanges();
768 } 778 }
769 779
770 } // namespace chromeos 780 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698