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

Unified Diff: chrome/browser/android/blimp/chrome_blimp_client_context_delegate.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 | « chrome/browser/android/blimp/chrome_blimp_client_context_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/blimp/chrome_blimp_client_context_delegate.cc
diff --git a/chrome/browser/android/blimp/chrome_blimp_client_context_delegate.cc b/chrome/browser/android/blimp/chrome_blimp_client_context_delegate.cc
index dc1ca4e39be3ad3d18ed7e325992707d0939d9e7..704a1dd9b0964507a96155f43d635fa1bcc7c796 100644
--- a/chrome/browser/android/blimp/chrome_blimp_client_context_delegate.cc
+++ b/chrome/browser/android/blimp/chrome_blimp_client_context_delegate.cc
@@ -4,12 +4,17 @@
#include "chrome/browser/android/blimp/chrome_blimp_client_context_delegate.h"
+#include "base/memory/ptr_util.h"
#include "blimp/client/public/blimp_client_context.h"
#include "blimp/client/public/blimp_client_context_delegate.h"
#include "blimp/client/public/contents/blimp_contents.h"
#include "chrome/browser/android/blimp/blimp_client_context_factory.h"
#include "chrome/browser/android/blimp/blimp_contents_profile_attachment.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
+#include "components/signin/core/browser/profile_identity_provider.h"
+#include "components/signin/core/browser/signin_manager.h"
ChromeBlimpClientContextDelegate::ChromeBlimpClientContextDelegate(
Profile* profile)
@@ -31,3 +36,29 @@ void ChromeBlimpClientContextDelegate::AttachBlimpContentsHelpers(
void ChromeBlimpClientContextDelegate::OnAssignmentConnectionAttempted(
blimp::client::AssignmentRequestResult result,
const blimp::client::Assignment& assignment) {}
+
+std::unique_ptr<IdentityProvider>
+ChromeBlimpClientContextDelegate::CreateIdentityProvider() {
+ return base::WrapUnique<IdentityProvider>(new ProfileIdentityProvider(
+ SigninManagerFactory::GetForProfile(profile_),
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_),
+ base::Closure()));
+}
+
+void ChromeBlimpClientContextDelegate::OnAuthenticationError(
+ BlimpClientContextDelegate::AuthError error) {
+ switch (error) {
+ case AuthError::NOT_SIGNED_IN:
+ // User need to signed in first, on Android it's handled in Java layer
+ // before the connection.
+ VLOG(1) << "User is not signed in before connection to Blimp.";
+ break;
+ case AuthError::OAUTH_TOKEN_FAIL:
+ // TODO(xingliu): Alert the user in UI.
+ // There is an known issue that ongoing request can be cancelled when
+ // Android layer updates the refresh token.
+ break;
+ default:
+ LOG(WARNING) << "Unknown Blimp error.";
+ }
+}
« no previous file with comments | « chrome/browser/android/blimp/chrome_blimp_client_context_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698