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

Unified Diff: remoting/client/token_fetcher_proxy.cc

Issue 311983003: Third Party Authentication for Android Part I - TokenFetcherProxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing CR feedbacks 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
« no previous file with comments | « remoting/client/token_fetcher_proxy.h ('k') | remoting/remoting_srcs.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/token_fetcher_proxy.cc
diff --git a/remoting/client/token_fetcher_proxy.cc b/remoting/client/token_fetcher_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c1082b2d427050621df7b1ba380dc8f384a221ef
--- /dev/null
+++ b/remoting/client/token_fetcher_proxy.cc
@@ -0,0 +1,37 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/client/token_fetcher_proxy.h"
+
+namespace remoting {
+
+TokenFetcherProxy::TokenFetcherProxy(
+ const TokenFetcherCallback& token_fetcher_impl,
+ const std::string& host_public_key)
+ : host_public_key_(host_public_key),
+ token_fetcher_impl_(token_fetcher_impl),
+ weak_factory_(this) {
+}
+
+TokenFetcherProxy::~TokenFetcherProxy() {
+}
+
+void TokenFetcherProxy::FetchThirdPartyToken(
+ const GURL& token_url,
+ const std::string& scope,
+ const TokenFetchedCallback& token_fetched_callback) {
+ token_fetched_callback_ = token_fetched_callback;
+ token_fetcher_impl_.Run(
+ token_url, host_public_key_, scope, weak_factory_.GetWeakPtr());
+}
+
+void TokenFetcherProxy::OnTokenFetched(
+ const std::string& token, const std::string& shared_secret) {
+ if (!token_fetched_callback_.is_null()) {
+ token_fetched_callback_.Run(token, shared_secret);
+ token_fetched_callback_.Reset();
+ }
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/client/token_fetcher_proxy.h ('k') | remoting/remoting_srcs.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698