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

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: Fixes for nits. 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
« no previous file with comments | « blimp/client/core/blimp_client_context_impl.h ('k') | blimp/client/core/dummy_blimp_client_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..46ba505076f7823a8e839e48d8fbc31b10051ae3 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_,
+ 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_));
« no previous file with comments | « blimp/client/core/blimp_client_context_impl.h ('k') | blimp/client/core/dummy_blimp_client_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698