Skip to content

Commit

Permalink
Revert "Prepare to remove AreExtensionsRestrictedToPrimaryAccount"
Browse files Browse the repository at this point in the history
This reverts commit 4f95fb1.

Reason for revert: the CHECK triggers in kiosk mode on ChromeOS.

Original change's description:
> Prepare to remove AreExtensionsRestrictedToPrimaryAccount
>
> AreExtensionsRestrictedToPrimaryAccount returns true when account
> consistency (Mirror or DICE) is disabled. We distinguish 2 cases:
> a) On Desktop: DICE is disable only when sign-in is not allowed
> b) On ChromeOS: Mirror is disabled when account manager is not enabled.
> This corresponds to sessions like Guest, public session and kiosk mode
> where signing in to Chrome is disabled.
> https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/ash/account_manager/account_manager_util.cc
>
> This CL adds a DCHECK to validate that
> AreExtensionsRestrictedToPrimaryAccount() always returns false when
> sign-in is allowed. This is as a temporary CL to prepare the
> removal of AreExtensionsRestrictedToPrimaryAccount().
>
> Bug: 1181236
>
> Change-Id: I776124f95892b1b7c31022d33584ccd8770a7b81
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2713802
> Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
> Reviewed-by: Alex Ilin <alexilin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#856644}

(cherry picked from commit 6e1821a)

Bug: 1181236, 1186023
Change-Id: Ib15b5bac5b84405dc87497ac9351b2fec7f12de7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2743758
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: Alex Ilin <alexilin@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: David Roger <droger@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Original-Commit-Position: refs/heads/master@{#861109}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2748635
Cr-Commit-Position: refs/branch-heads/4430@{#311}
Cr-Branched-From: e5ce7dc-refs/heads/master@{#857950}
  • Loading branch information
David Roger authored and Chromium LUCI CQ committed Mar 10, 2021
1 parent 071cdaf commit 1fe8535
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions chrome/browser/extensions/api/identity/identity_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/common/extensions/api/identity.h"
#include "chrome/common/url_constants.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/extension.h"
Expand Down Expand Up @@ -134,20 +133,8 @@ base::CallbackListSubscription IdentityAPI::RegisterOnShutdownCallback(
}

bool IdentityAPI::AreExtensionsRestrictedToPrimaryAccount() {
bool extensions_restricted_to_primary_account =
!AccountConsistencyModeManager::IsDiceEnabledForProfile(profile_) &&
!AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile_);
if (extensions_restricted_to_primary_account) {
// TODO(crbug.com/1181236): Remove AreExtensionsRestrictedToPrimaryAccount
// as it always returns false when sign-in is allowed.
CHECK(!profile_->GetPrefs()->GetBoolean(prefs::kSigninAllowed))
<< "This is temporary check to verify that "
"AreExtensionsRestrictedToPrimaryAccount() returns true iff sign-in "
"is not allowed. In this case, chrome.identity API returns errors "
"when fetching access tokens. Therefore method "
"AreExtensionsRestrictedToPrimaryAccount() can be removed.";
}
return extensions_restricted_to_primary_account;
return !AccountConsistencyModeManager::IsDiceEnabledForProfile(profile_) &&
!AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile_);
}

IdentityAPI::IdentityAPI(Profile* profile,
Expand Down

0 comments on commit 1fe8535

Please sign in to comment.