Commit 9b1e871a authored by sdefresne's avatar sdefresne Committed by Commit bot

Revert of Access SigninErrorProvider through ChromeBrowserProvider. (patchset...

Revert of Access SigninErrorProvider through ChromeBrowserProvider. (patchset #1 id:1 of https://chromiumcodereview.appspot.com/2437003003/ )

Reason for revert:
Will break the autoroller (need to be split in two).

Original issue's description:
> Access SigninErrorProvider through ChromeBrowserProvider.
>
> BUG=475439

TBR=bzanotti@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=475439

Review-Url: https://chromiumcodereview.appspot.com/2435053003
Cr-Commit-Position: refs/heads/master@{#426559}
parent 75885ebb
......@@ -80,23 +80,24 @@ ProfileOAuth2TokenServiceIOSProviderImpl::GetAuthenticationErrorCategory(
return kAuthenticationErrorCategoryAuthorizationErrors;
}
ios::SigninErrorProvider* provider =
ios::GetChromeBrowserProvider()->GetSigninErrorProvider();
switch (provider->GetErrorCategory(error)) {
ios::SigninErrorCategory error_category =
ios::GetSigninErrorProvider()->GetErrorCategory(error);
switch (error_category) {
case ios::SigninErrorCategory::UNKNOWN_ERROR: {
// Google's OAuth 2 implementation returns a 400 with JSON body
// containing error key "invalid_grant" to indicate the refresh token
// is invalid or has been revoked by the user.
// Check that the underlying library does not categorize these errors as
// unknown.
NSString* json_error_key = provider->GetInvalidGrantJsonErrorKey();
DCHECK(!provider->IsBadRequest(error) ||
NSString* json_error_key =
ios::GetSigninErrorProvider()->GetInvalidGrantJsonErrorKey();
DCHECK(!ios::GetSigninErrorProvider()->IsBadRequest(error) ||
![[[error userInfo] valueForKeyPath:@"json.error"]
isEqual:json_error_key]);
return kAuthenticationErrorCategoryUnknownErrors;
}
case ios::SigninErrorCategory::AUTHORIZATION_ERROR:
if (provider->IsForbidden(error)) {
if (ios::GetSigninErrorProvider()->IsForbidden(error)) {
return kAuthenticationErrorCategoryAuthorizationForbiddenErrors;
}
return kAuthenticationErrorCategoryAuthorizationErrors;
......
......@@ -6,7 +6,6 @@
#include "base/strings/sys_string_conversions.h"
#include "google_apis/gaia/gaia_auth_util.h"
#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#import "ios/public/provider/chrome/browser/signin/chrome_identity.h"
#include "ios/public/provider/chrome/browser/signin/signin_error_provider.h"
......@@ -27,8 +26,7 @@ std::string GetCanonicalizedEmailForIdentity(ChromeIdentity* identity) {
}
bool ShouldHandleSigninError(NSError* error) {
ios::SigninErrorProvider* provider =
ios::GetChromeBrowserProvider()->GetSigninErrorProvider();
ios::SigninErrorProvider* provider = ios::GetSigninErrorProvider();
return ![provider->GetSigninErrorDomain() isEqualToString:error.domain] ||
(error.code != provider->GetCode(ios::SigninError::CANCELED) &&
error.code !=
......
......@@ -58,7 +58,6 @@ class ChromeBrowserProvider;
class ChromeBrowserState;
class ChromeIdentityService;
class GeolocationUpdaterProvider;
class SigninErrorProvider;
class SigninResourcesProvider;
class LiveTabContextProvider;
class UpdatableResourceProvider;
......@@ -87,8 +86,6 @@ class ChromeBrowserProvider {
virtual InfoBarViewPlaceholder CreateInfoBarView(
CGRect frame,
InfoBarViewDelegate* delegate) NS_RETURNS_RETAINED;
// Returns an instance of a signing error provider.
virtual SigninErrorProvider* GetSigninErrorProvider();
// Returns an instance of a signin resources provider.
virtual SigninResourcesProvider* GetSigninResourcesProvider();
// Sets the current instance of Chrome identity service. Used for testing.
......
......@@ -46,10 +46,6 @@ InfoBarViewPlaceholder ChromeBrowserProvider::CreateInfoBarView(
return nullptr;
}
SigninErrorProvider* ChromeBrowserProvider::GetSigninErrorProvider() {
return nullptr;
}
SigninResourcesProvider* ChromeBrowserProvider::GetSigninResourcesProvider() {
return nullptr;
}
......
......@@ -6,7 +6,6 @@
#include "base/mac/scoped_block.h"
#include "base/mac/scoped_nsobject.h"
#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h"
#include "ios/public/provider/chrome/browser/signin/signin_error_provider.h"
......@@ -162,8 +161,7 @@
}
- (NSError*)canceledError {
ios::SigninErrorProvider* provider =
ios::GetChromeBrowserProvider()->GetSigninErrorProvider();
ios::SigninErrorProvider* provider = ios::GetSigninErrorProvider();
return [NSError errorWithDomain:provider->GetSigninErrorDomain()
code:provider->GetCode(ios::SigninError::CANCELED)
userInfo:nil];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment