| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 void KeyPermissions::RegisterProfilePrefs( | 370 void KeyPermissions::RegisterProfilePrefs( |
| 371 user_prefs::PrefRegistrySyncable* registry) { | 371 user_prefs::PrefRegistrySyncable* registry) { |
| 372 // For the format of the dictionary see the documentation at kPrefKeyUsage. | 372 // For the format of the dictionary see the documentation at kPrefKeyUsage. |
| 373 registry->RegisterDictionaryPref(prefs::kPlatformKeys); | 373 registry->RegisterDictionaryPref(prefs::kPlatformKeys); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void KeyPermissions::CreatePermissionObjectAndPassToCallback( | 376 void KeyPermissions::CreatePermissionObjectAndPassToCallback( |
| 377 const std::string& extension_id, | 377 const std::string& extension_id, |
| 378 const PermissionsCallback& callback, | 378 const PermissionsCallback& callback, |
| 379 std::unique_ptr<base::Value> value) { | 379 std::unique_ptr<base::Value> value) { |
| 380 callback.Run(base::WrapUnique( | 380 callback.Run(base::MakeUnique<PermissionsForExtension>( |
| 381 new PermissionsForExtension(extension_id, std::move(value), | 381 extension_id, std::move(value), profile_prefs_, profile_policies_, this)); |
| 382 profile_prefs_, profile_policies_, this))); | |
| 383 } | 382 } |
| 384 | 383 |
| 385 void KeyPermissions::SetPlatformKeysOfExtension( | 384 void KeyPermissions::SetPlatformKeysOfExtension( |
| 386 const std::string& extension_id, | 385 const std::string& extension_id, |
| 387 std::unique_ptr<base::Value> value) { | 386 std::unique_ptr<base::Value> value) { |
| 388 extensions_state_store_->SetExtensionValue( | 387 extensions_state_store_->SetExtensionValue( |
| 389 extension_id, kStateStorePlatformKeys, std::move(value)); | 388 extension_id, kStateStorePlatformKeys, std::move(value)); |
| 390 } | 389 } |
| 391 | 390 |
| 392 const base::DictionaryValue* KeyPermissions::GetPrefsEntry( | 391 const base::DictionaryValue* KeyPermissions::GetPrefsEntry( |
| 393 const std::string& public_key_spki_der_b64) const { | 392 const std::string& public_key_spki_der_b64) const { |
| 394 const base::DictionaryValue* platform_keys = | 393 const base::DictionaryValue* platform_keys = |
| 395 profile_prefs_->GetDictionary(prefs::kPlatformKeys); | 394 profile_prefs_->GetDictionary(prefs::kPlatformKeys); |
| 396 | 395 |
| 397 const base::DictionaryValue* key_entry = nullptr; | 396 const base::DictionaryValue* key_entry = nullptr; |
| 398 platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64, | 397 platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64, |
| 399 &key_entry); | 398 &key_entry); |
| 400 return key_entry; | 399 return key_entry; |
| 401 } | 400 } |
| 402 | 401 |
| 403 } // namespace chromeos | 402 } // namespace chromeos |
| OLD | NEW |