| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/platform_keys/key_permissions.h" | 5 #include "chrome/browser/chromeos/platform_keys/key_permissions.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 WriteToStateStore(); | 169 WriteToStateStore(); |
| 170 | 170 |
| 171 DictionaryPrefUpdate update(profile_prefs_, prefs::kPlatformKeys); | 171 DictionaryPrefUpdate update(profile_prefs_, prefs::kPlatformKeys); |
| 172 | 172 |
| 173 std::unique_ptr<base::DictionaryValue> new_pref_entry( | 173 std::unique_ptr<base::DictionaryValue> new_pref_entry( |
| 174 new base::DictionaryValue); | 174 new base::DictionaryValue); |
| 175 new_pref_entry->SetStringWithoutPathExpansion(kPrefKeyUsage, | 175 new_pref_entry->SetStringWithoutPathExpansion(kPrefKeyUsage, |
| 176 kPrefKeyUsageCorporate); | 176 kPrefKeyUsageCorporate); |
| 177 | 177 |
| 178 update->SetWithoutPathExpansion(public_key_spki_der_b64, | 178 update->SetWithoutPathExpansion(public_key_spki_der_b64, |
| 179 new_pref_entry.release()); | 179 std::move(new_pref_entry)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void KeyPermissions::PermissionsForExtension::SetUserGrantedPermission( | 182 void KeyPermissions::PermissionsForExtension::SetUserGrantedPermission( |
| 183 const std::string& public_key_spki_der) { | 183 const std::string& public_key_spki_der) { |
| 184 if (!key_permissions_->CanUserGrantPermissionFor(public_key_spki_der)) { | 184 if (!key_permissions_->CanUserGrantPermissionFor(public_key_spki_der)) { |
| 185 LOG(WARNING) << "Tried to grant permission for a key although prohibited " | 185 LOG(WARNING) << "Tried to grant permission for a key although prohibited " |
| 186 "(either key is a corporate key or this account is " | 186 "(either key is a corporate key or this account is " |
| 187 "managed)."; | 187 "managed)."; |
| 188 return; | 188 return; |
| 189 } | 189 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 const base::DictionaryValue* platform_keys = | 393 const base::DictionaryValue* platform_keys = |
| 394 profile_prefs_->GetDictionary(prefs::kPlatformKeys); | 394 profile_prefs_->GetDictionary(prefs::kPlatformKeys); |
| 395 | 395 |
| 396 const base::DictionaryValue* key_entry = nullptr; | 396 const base::DictionaryValue* key_entry = nullptr; |
| 397 platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64, | 397 platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64, |
| 398 &key_entry); | 398 &key_entry); |
| 399 return key_entry; | 399 return key_entry; |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace chromeos | 402 } // namespace chromeos |
| OLD | NEW |