| 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 <keyhi.h> | 7 #include <keyhi.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 void ContinueLoadPrivateKeyOnIOThread( | 110 void ContinueLoadPrivateKeyOnIOThread( |
| 111 const scoped_refptr<OwnerKeyUtil>& owner_key_util, | 111 const scoped_refptr<OwnerKeyUtil>& owner_key_util, |
| 112 const std::string username_hash, | 112 const std::string username_hash, |
| 113 const ReloadKeyCallback& callback, | 113 const ReloadKeyCallback& callback, |
| 114 crypto::ScopedPK11Slot private_slot) { | 114 crypto::ScopedPK11Slot private_slot) { |
| 115 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 115 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 116 | 116 |
| 117 scoped_refptr<base::TaskRunner> task_runner = | 117 scoped_refptr<base::TaskRunner> task_runner = |
| 118 base::CreateTaskRunnerWithTraits( | 118 base::CreateTaskRunnerWithTraits( |
| 119 base::TaskTraits() | 119 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 120 .MayBlock() | 120 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); |
| 121 .WithPriority(base::TaskPriority::BACKGROUND) | |
| 122 .WithShutdownBehavior( | |
| 123 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)); | |
| 124 task_runner->PostTask( | 121 task_runner->PostTask( |
| 125 FROM_HERE, | 122 FROM_HERE, |
| 126 base::Bind( | 123 base::Bind( |
| 127 &LoadPrivateKeyByPublicKeyOnWorkerThread, owner_key_util, | 124 &LoadPrivateKeyByPublicKeyOnWorkerThread, owner_key_util, |
| 128 base::Passed(crypto::GetPublicSlotForChromeOSUser(username_hash)), | 125 base::Passed(crypto::GetPublicSlotForChromeOSUser(username_hash)), |
| 129 base::Passed(std::move(private_slot)), callback)); | 126 base::Passed(std::move(private_slot)), callback)); |
| 130 } | 127 } |
| 131 | 128 |
| 132 void LoadPrivateKeyOnIOThread(const scoped_refptr<OwnerKeyUtil>& owner_key_util, | 129 void LoadPrivateKeyOnIOThread(const scoped_refptr<OwnerKeyUtil>& owner_key_util, |
| 133 const std::string username_hash, | 130 const std::string username_hash, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 160 // not. Responds via |callback|. | 157 // not. Responds via |callback|. |
| 161 void DoesPrivateKeyExistAsync( | 158 void DoesPrivateKeyExistAsync( |
| 162 const scoped_refptr<OwnerKeyUtil>& owner_key_util, | 159 const scoped_refptr<OwnerKeyUtil>& owner_key_util, |
| 163 const OwnerSettingsServiceChromeOS::IsOwnerCallback& callback) { | 160 const OwnerSettingsServiceChromeOS::IsOwnerCallback& callback) { |
| 164 if (!owner_key_util.get()) { | 161 if (!owner_key_util.get()) { |
| 165 callback.Run(false); | 162 callback.Run(false); |
| 166 return; | 163 return; |
| 167 } | 164 } |
| 168 scoped_refptr<base::TaskRunner> task_runner = | 165 scoped_refptr<base::TaskRunner> task_runner = |
| 169 base::CreateTaskRunnerWithTraits( | 166 base::CreateTaskRunnerWithTraits( |
| 170 base::TaskTraits() | 167 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 171 .MayBlock() | 168 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); |
| 172 .WithPriority(base::TaskPriority::BACKGROUND) | |
| 173 .WithShutdownBehavior( | |
| 174 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)); | |
| 175 base::PostTaskAndReplyWithResult( | 169 base::PostTaskAndReplyWithResult( |
| 176 task_runner.get(), | 170 task_runner.get(), |
| 177 FROM_HERE, | 171 FROM_HERE, |
| 178 base::Bind(&DoesPrivateKeyExistAsyncHelper, owner_key_util), | 172 base::Bind(&DoesPrivateKeyExistAsyncHelper, owner_key_util), |
| 179 callback); | 173 callback); |
| 180 } | 174 } |
| 181 | 175 |
| 182 } // namespace | 176 } // namespace |
| 183 | 177 |
| 184 OwnerSettingsServiceChromeOS::ManagementSettings::ManagementSettings() { | 178 OwnerSettingsServiceChromeOS::ManagementSettings::ManagementSettings() { |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 | 746 |
| 753 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( | 747 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( |
| 754 bool success) { | 748 bool success) { |
| 755 store_settings_factory_.InvalidateWeakPtrs(); | 749 store_settings_factory_.InvalidateWeakPtrs(); |
| 756 for (auto& observer : observers_) | 750 for (auto& observer : observers_) |
| 757 observer.OnSignedPolicyStored(success); | 751 observer.OnSignedPolicyStored(success); |
| 758 StorePendingChanges(); | 752 StorePendingChanges(); |
| 759 } | 753 } |
| 760 | 754 |
| 761 } // namespace chromeos | 755 } // namespace chromeos |
| OLD | NEW |