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

Unified Diff: blimp/client/core/blimp_client_context_impl.cc

Issue 2204223005: Blimp OAuth2 token retreival on application start up. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fix. Created 4 years, 4 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: blimp/client/core/blimp_client_context_impl.cc
diff --git a/blimp/client/core/blimp_client_context_impl.cc b/blimp/client/core/blimp_client_context_impl.cc
index f90b1dc02b222929b3e0851a1a240809064d7aa0..2fcc12ad6aea205c8a2c43443b3e4cbfd6fba498 100644
--- a/blimp/client/core/blimp_client_context_impl.cc
+++ b/blimp/client/core/blimp_client_context_impl.cc
@@ -81,7 +81,22 @@ std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents() {
return blimp_contents;
}
-void BlimpClientContextImpl::Connect(const std::string& client_auth_token) {
+void BlimpClientContextImpl::Connect() {
+ // Lazy initialization of IdentitySource.
+ if (!identity_source_) {
+ identity_source_ = base::MakeUnique<IdentitySource>(delegate_);
+ identity_source_->SetTokenCallback(
+ base::Bind(&BlimpClientContextImpl::ConnectToAssignmentSource,
+ base::Unretained(this)));
+ }
+
+ // Start Blimp authentication flow. The OAuth2 token will be used in
+ // assignment source.
+ identity_source_->Connect();
+}
+
+void BlimpClientContextImpl::ConnectToAssignmentSource(
+ const std::string& client_auth_token) {
if (!assignment_source_) {
assignment_source_.reset(new AssignmentSource(
GetAssignerURL(), io_thread_task_runner_, file_thread_task_runner_));

Powered by Google App Engine
This is Rietveld 408576698