Chromium Code Reviews| 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..80c1ed1a0e441bf43af24405508a5dffe74b7d99 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: |
| + VLOG(1) << "Unknown Blimp error."; |
|
nyquist
2016/08/16 18:38:06
I don't think this should ever happen, so maybe LO
xingliu
2016/08/17 00:32:24
Done.
|
| + } |
| +} |