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

Unified Diff: chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc

Issue 323093003: Add the Sign-At-Most-Once restriction the enterprise.platformKeys API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
index cdf779cbf963192e5d3f4c13d40b7edd52a1a48a..97c54dab9299f5301d85a6bd369ce6e5db7af0ba 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
@@ -7,6 +7,8 @@
#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
+#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h"
+#include "chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h"
#include "chrome/common/extensions/api/enterprise_platform_keys.h"
#include "chrome/common/extensions/api/enterprise_platform_keys_internal.h"
#include "content/public/browser/browser_thread.h"
@@ -48,9 +50,15 @@ EnterprisePlatformKeysInternalGenerateKeyFunction::Run() {
if (!ValidateToken(params->token_id))
return RespondNow(Error(kErrorInvalidToken));
- chromeos::platform_keys::GenerateRSAKey(
+ chromeos::PlatformKeysService* service =
+ chromeos::PlatformKeysServiceFactory::GetInstance()->GetForBrowserContext(
+ browser_context());
+ DCHECK(service);
+
+ service->GenerateRSAKey(
params->token_id,
params->modulus_length,
+ extension_id(),
base::Bind(
&EnterprisePlatformKeysInternalGenerateKeyFunction::OnGeneratedKey,
this),
@@ -82,10 +90,16 @@ EnterprisePlatformKeysInternalSignFunction::Run() {
if (!ValidateToken(params->token_id))
return RespondNow(Error(kErrorInvalidToken));
- chromeos::platform_keys::Sign(
+ chromeos::PlatformKeysService* service =
+ chromeos::PlatformKeysServiceFactory::GetInstance()->GetForBrowserContext(
+ browser_context());
+ DCHECK(service);
+
+ service->Sign(
params->token_id,
params->public_key,
params->data,
+ extension_id(),
base::Bind(&EnterprisePlatformKeysInternalSignFunction::OnSigned, this),
GetProfile());
return RespondLater();

Powered by Google App Engine
This is Rietveld 408576698