| 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 "components/ownership/owner_settings_service.h" | 5 #include "components/ownership/owner_settings_service.h" |
| 6 | 6 |
| 7 #include <cryptohi.h> | 7 #include <cryptohi.h> |
| 8 #include <keyhi.h> | 8 #include <keyhi.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 bool OwnerSettingsService::SetDouble(const std::string& setting, double value) { | 131 bool OwnerSettingsService::SetDouble(const std::string& setting, double value) { |
| 132 DCHECK(thread_checker_.CalledOnValidThread()); | 132 DCHECK(thread_checker_.CalledOnValidThread()); |
| 133 base::Value in_value(value); | 133 base::Value in_value(value); |
| 134 return Set(setting, in_value); | 134 return Set(setting, in_value); |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool OwnerSettingsService::SetString(const std::string& setting, | 137 bool OwnerSettingsService::SetString(const std::string& setting, |
| 138 const std::string& value) { | 138 const std::string& value) { |
| 139 DCHECK(thread_checker_.CalledOnValidThread()); | 139 DCHECK(thread_checker_.CalledOnValidThread()); |
| 140 base::StringValue in_value(value); | 140 base::Value in_value(value); |
| 141 return Set(setting, in_value); | 141 return Set(setting, in_value); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void OwnerSettingsService::ReloadKeypair() { | 144 void OwnerSettingsService::ReloadKeypair() { |
| 145 ReloadKeypairImpl( | 145 ReloadKeypairImpl( |
| 146 base::Bind(&OwnerSettingsService::OnKeypairLoaded, as_weak_ptr())); | 146 base::Bind(&OwnerSettingsService::OnKeypairLoaded, as_weak_ptr())); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void OwnerSettingsService::OnKeypairLoaded( | 149 void OwnerSettingsService::OnKeypairLoaded( |
| 150 const scoped_refptr<PublicKey>& public_key, | 150 const scoped_refptr<PublicKey>& public_key, |
| 151 const scoped_refptr<PrivateKey>& private_key) { | 151 const scoped_refptr<PrivateKey>& private_key) { |
| 152 DCHECK(thread_checker_.CalledOnValidThread()); | 152 DCHECK(thread_checker_.CalledOnValidThread()); |
| 153 | 153 |
| 154 public_key_ = public_key; | 154 public_key_ = public_key; |
| 155 private_key_ = private_key; | 155 private_key_ = private_key; |
| 156 | 156 |
| 157 const bool is_owner = IsOwner(); | 157 const bool is_owner = IsOwner(); |
| 158 std::vector<IsOwnerCallback> is_owner_callbacks; | 158 std::vector<IsOwnerCallback> is_owner_callbacks; |
| 159 is_owner_callbacks.swap(pending_is_owner_callbacks_); | 159 is_owner_callbacks.swap(pending_is_owner_callbacks_); |
| 160 for (std::vector<IsOwnerCallback>::iterator it(is_owner_callbacks.begin()); | 160 for (std::vector<IsOwnerCallback>::iterator it(is_owner_callbacks.begin()); |
| 161 it != is_owner_callbacks.end(); | 161 it != is_owner_callbacks.end(); |
| 162 ++it) { | 162 ++it) { |
| 163 it->Run(is_owner); | 163 it->Run(is_owner); |
| 164 } | 164 } |
| 165 | 165 |
| 166 OnPostKeypairLoadedActions(); | 166 OnPostKeypairLoadedActions(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace ownership | 169 } // namespace ownership |
| OLD | NEW |