New issue
Advanced search Search tips

Issue 729589 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug


Sign in to add a comment

Eliminate IdentityAPI using AccountTracker

Project Member Reported by blundell@chromium.org, Jun 5 2017

Issue description

AccountTracker is not a class that we want to support in the Identity Service:
- It's not well-understood by the current chrome identity team
- It has functionality that overlaps in odd and hard-to-understand ways with the classes that *are* well-understood and invested in by the chrome identity team (ProfileOAuth2TokenService, AccountTrackerService)

As part of porting the Identity extension API impl to use the Identity Service, we need to eliminate its usage of AccountTracker. Once the blocking bugs are fixed, this should be just getting rid of IdentityAPI having an AccountTracker ivar.
 
Blocking: 729590
Note that at the same time we do this we can and should eliminate IdentityAPI's usage of ProfileIdentityProvider, since that's only needed to construct its AccountTracker ivar.
Components: Services>SignIn
Components: Internals>Services>Identity
Blocking: 809927
Marking this as a blocking bug of crbug.com/809927 per c#2 above.
Project Member

Comment 6 by bugdroid1@chromium.org, Mar 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/798a107597af39aba4fd365d920d58015516c9b4

commit 798a107597af39aba4fd365d920d58015516c9b4
Author: Colin Blundell <blundell@chromium.org>
Date: Thu Mar 22 15:43:47 2018

Change undefined behavior of chrome.identity.onSigninChanged event

The chrome.identity.onSigninChanged extension API event is defined
as follows:

"Fired when signin state changes for an account on the user's profile."
(https://developer.chrome.com/apps/identity#event-onSignInChanged)

The current browser-side implementation uses gaia::AccountTracker,
which ignores events for secondary accounts if there is no primary
account (i.e., syncing account) present. Thus, this browser-side
implementation also fires events for secondary accounts only if there is
a primary account present.

However:

(1) This behavior is not defined in the documented semantics above
(2) In practice, this case has historically never been encountered by
end users, as it has been impossible in desktop Chrome to have a
secondary account without a primary account present.

This CL changes this undocumented behavior, so that events for
secondary events will fire regardless of whether a primary account is
present. Post-project DICE, it will be possible for this case to be
encountered by end users. In that world, it will actually be more
sensible for events to fire for secondary accounts regardless of
whether or not the user has designated a syncing account.

The CL implements this change by porting IdentityAPI away from using
gaia::AccountTracker to observing ProfileOAuth2TokenService and
AccountTrackerService directly. By doing so, IdentityAPI observes
(and fires events for) signin change events for secondary accounts
regardless of whether a primary account is present.

This change has a side benefit in removing usage of the AccountTracker
class, which is deprecated with an eye toward complete removal
(see details in crbug.com/729590). It will be followed up by a
conversion of this code to use the Identity Service client library.

To test, install a Chrome extension with the identity permissions in
its manifest. Go to chrome://extensions, enable developer mode, and
inspect the background page of the above app. At the JS console that
that brings up, execute:
chrome.identity.onSignInChanged.addListener((account, signed_in) => {console.log(account.id + " " + signed_in);} )
Sign out of the browser. Verify that you receive a callback at the console
with a value of false.
Sign back in. Verify that you receive another callback at the console for
the same account ID with a value of true.

Bug:  729589 ,  729542 ,  769700 
Change-Id: I99dd48d34b380067ac34a2207effd9d3279191fd
Reviewed-on: https://chromium-review.googlesource.com/596368
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545081}
[modify] https://crrev.com/798a107597af39aba4fd365d920d58015516c9b4/chrome/browser/extensions/api/identity/identity_api.cc
[modify] https://crrev.com/798a107597af39aba4fd365d920d58015516c9b4/chrome/browser/extensions/api/identity/identity_api.h
[modify] https://crrev.com/798a107597af39aba4fd365d920d58015516c9b4/chrome/browser/extensions/api/identity/identity_apitest.cc

Owner: blundell@chromium.org
Status: Fixed (was: Available)

Sign in to add a comment