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

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

Issue 1685103003: Copy challenge*Key methods to enterprise.platformKeys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 5dcaea9cf2643dc5e168a13a708e7f06c9ea9608..3fdef72f56cb6425bd1165bbacbb1ef54a2aaaad 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
@@ -236,4 +236,79 @@ void EnterprisePlatformKeysInternalGetTokensFunction::OnGotTokens(
Respond(ArgumentList(api_epki::GetTokens::Results::Create(token_ids)));
}
+EnterprisePlatformKeysChallengeMachineKeyFunction::
+ EnterprisePlatformKeysChallengeMachineKeyFunction()
+ : default_impl_(new EPKPChallengeMachineKey), impl_(default_impl_.get()) {}
+
+EnterprisePlatformKeysChallengeMachineKeyFunction::
+ EnterprisePlatformKeysChallengeMachineKeyFunction(
+ EPKPChallengeMachineKey* impl_for_testing)
+ : impl_(impl_for_testing) {}
+
+EnterprisePlatformKeysChallengeMachineKeyFunction::
+ ~EnterprisePlatformKeysChallengeMachineKeyFunction() = default;
+
+ExtensionFunction::ResponseAction
+EnterprisePlatformKeysChallengeMachineKeyFunction::Run() {
+ scoped_ptr<api_epk::ChallengeMachineKey::Params> params(
+ api_epk::ChallengeMachineKey::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params);
+ ChallengeKeyCallback callback = base::Bind(
+ &EnterprisePlatformKeysChallengeMachineKeyFunction::OnChallengedKey,
+ this);
+ base::Closure task = base::Bind(
+ &EPKPChallengeMachineKey::Run, base::Unretained(impl_),
Devlin 2016/02/19 18:05:02 nit: please comment on why Unretained is safe here
Darren Krahn 2016/02/23 23:39:46 Done.
+ scoped_refptr<UIThreadExtensionFunction>(AsUIThreadExtensionFunction()),
+ callback, params->challenge);
+ content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, task);
+ return RespondLater();
+}
+
+void EnterprisePlatformKeysChallengeMachineKeyFunction::OnChallengedKey(
+ bool success,
+ const std::string& data) {
+ if (success) {
+ Respond(ArgumentList(api_epk::ChallengeMachineKey::Results::Create(data)));
+ } else {
+ Respond(Error(data));
+ }
+}
+
+EnterprisePlatformKeysChallengeUserKeyFunction::
+ EnterprisePlatformKeysChallengeUserKeyFunction()
+ : default_impl_(new EPKPChallengeUserKey), impl_(default_impl_.get()) {}
+
+EnterprisePlatformKeysChallengeUserKeyFunction::
+ EnterprisePlatformKeysChallengeUserKeyFunction(
+ EPKPChallengeUserKey* impl_for_testing)
+ : impl_(impl_for_testing) {}
+
+EnterprisePlatformKeysChallengeUserKeyFunction::
+ ~EnterprisePlatformKeysChallengeUserKeyFunction() = default;
+
+ExtensionFunction::ResponseAction
+EnterprisePlatformKeysChallengeUserKeyFunction::Run() {
+ scoped_ptr<api_epk::ChallengeUserKey::Params> params(
+ api_epk::ChallengeUserKey::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params);
+ ChallengeKeyCallback callback = base::Bind(
+ &EnterprisePlatformKeysChallengeUserKeyFunction::OnChallengedKey, this);
+ base::Closure task = base::Bind(
+ &EPKPChallengeUserKey::Run, base::Unretained(impl_),
Devlin 2016/02/19 18:05:02 ditto
Darren Krahn 2016/02/23 23:39:46 Done.
+ scoped_refptr<UIThreadExtensionFunction>(AsUIThreadExtensionFunction()),
+ callback, params->challenge, params->register_key);
+ content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, task);
+ return RespondLater();
+}
+
+void EnterprisePlatformKeysChallengeUserKeyFunction::OnChallengedKey(
+ bool success,
+ const std::string& data) {
+ if (success) {
+ Respond(ArgumentList(api_epk::ChallengeUserKey::Results::Create(data)));
+ } else {
+ Respond(Error(data));
+ }
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698