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

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: Add some deps only for gn deps check script. 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: 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..657d9fe1b5a91f5daa3ab4d1156161b88edd8bf2 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,27 @@ 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(
nyquist 2016/08/12 05:47:05 Is it so that MakeUnique can't be used because the
xingliu 2016/08/12 17:58:28 Yes, the reason to use abstract class here is main
+ SigninManagerFactory::GetForProfile(profile_),
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_),
+ base::Closure()));
+}
+
+void ChromeBlimpClientContextDelegate::OnError(
+ BlimpClientContextDelegate::BlimpError error) {
+ switch (error) {
nyquist 2016/08/12 05:47:05 Should this have a default statement?
xingliu 2016/08/12 17:58:28 Done.
+ case BlimpError::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 BlimpError::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;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698