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

Unified Diff: blimp/client/core/session/identity_source.cc

Issue 2406403003: Clean up Assignment Create in BlimpClientContextImpl. (Closed)
Patch Set: Addresses dtrainor's #14 comments. Created 4 years, 2 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 | « blimp/client/core/session/identity_source.h ('k') | blimp/client/core/session/identity_source_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/core/session/identity_source.cc
diff --git a/blimp/client/core/session/identity_source.cc b/blimp/client/core/session/identity_source.cc
index 40d91cf33b5186d06a4478c26895566635e03a6b..9cc74120ce7bba4cda7201b17c6a0977283abba2 100644
--- a/blimp/client/core/session/identity_source.cc
+++ b/blimp/client/core/session/identity_source.cc
@@ -4,6 +4,8 @@
#include "blimp/client/core/session/identity_source.h"
+#include <utility>
+
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "blimp/client/core/switches/blimp_client_switches.h"
@@ -20,17 +22,16 @@ const char kOAuth2TokenScope[] =
const int kTokenRequestCancelMaxRetry = 3;
} // namespace
-IdentitySource::IdentitySource(BlimpClientContextDelegate* delegate,
- const TokenCallback& callback)
+IdentitySource::IdentitySource(
+ std::unique_ptr<IdentityProvider> identity_provider,
+ const base::Callback<void(const GoogleServiceAuthError&)>& error_callback,
+ const TokenCallback& callback)
: OAuth2TokenService::Consumer("blimp_client"),
+ identity_provider_(std::move(identity_provider)),
+ error_callback_(error_callback),
token_callback_(callback),
is_fetching_token_(false),
- retry_times_(0),
- delegate_(delegate) {
- DCHECK(delegate_);
-
- // Create identity provider.
- identity_provider_ = delegate_->CreateIdentityProvider();
+ retry_times_(0) {
DCHECK(identity_provider_.get());
identity_provider_->AddObserver(this);
}
@@ -115,10 +116,7 @@ void IdentitySource::OnGetTokenFailure(
is_fetching_token_ = false;
retry_times_ = 0;
VLOG(1) << "OAuth2 token error: " << error.state();
-
- // Propagate the error.
- DCHECK(delegate_);
- delegate_->OnAuthenticationError(error);
+ error_callback_.Run(error);
}
void IdentitySource::OnRefreshTokenAvailable(const std::string& account_id) {
« no previous file with comments | « blimp/client/core/session/identity_source.h ('k') | blimp/client/core/session/identity_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698