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; |
+ } |
+} |