New issue
Advanced search Search tips

Issue 917836 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 8
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocking:
issue 917837



Sign in to add a comment

Change SigninErrorController to be layered above SigninManager and move it out of signin_internals target

Project Member Reported by blundell@chromium.org, Dec 26

Issue description

Currently, SigninManagerBase depends on SigninErrorController. This dependence means that SigninErrorController would need to be inside IdentityManager (and eventually the Identity Service). However, SigninErrorController does not conceptually belong inside the Identity Service: it simply collates authentication errors for UI-level consumers. All of the information that it presents is already available from the Token Service and SigninManager.

The dependence is so that SigninManagerBase can update SigninErrorController when the authenticated account is set/cleared. However, this only matters when SigninErrorController is used in PRIMARY_ACCOUNT mode, and SigninErrorController is used in PRIMARY_ACCOUNT mode only on desktop. In this context, it can simply observe SigninManager to get these updates.

This bug is for making the above change. We can add a DCHECK that the mode isn't set to PRIMARY_ACCOUNT on ChromeOS with a comment that if it's ever desired to use PRIMARY_ACCOUNT mode on ChromeOS, then the //chrome layer would need to take care of having SigninErrorController be given the primary account information at startup (after which it's never changed on CrOS). 
 
Summary: Change SigninErrorController to be layered above SigninManager and move it out of signin_internals target (was: Change SigninErrorController to be layered above SigninManager)
As part of this work, signin_error_controller.* should be moved out of the signin_internals GN target back into the browser target.
Blocking: 917837
Project Member

Comment 3 by bugdroid1@chromium.org, Jan 3

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

commit f9e6eec61d72b0617c8d5be61f11dd253e148852
Author: Colin Blundell <blundell@chromium.org>
Date: Thu Jan 03 13:11:07 2019

Change SigninErrorController to be layered above SigninManager

This CL inverts the dependency between SigninManager and
SigninErrorController: rather than the former depending on the latter,
the latter now depends on the former. The concrete motivation is that
SigninManager forms part of the core implementation of the Identity
Service, whereas SigninErrorController is fundamentally a client-side
class: it coalesces authentication errors from various underlying
sources in order to conveniently present global information to the UI.

The inversion of the dependency is conceptually straightforward.
Currently, SigninManager updates SigninErrorController's primary account
ID when its own primary account is set/cleared. This CL changes
SigninErrorController to explicitly check SigninManager's primary
account ID and to observe SigninManager for changes to the primary
account.

Note that this change means that if the primary account were to be
set/cleared on ChromeOS in an ongoing session, SigninErrorController
would not be notified (since the SigninManager observer callbacks are
not invoked on ChromeOS). However, in production on ChromeOS the
primary account is set when SigninManagerBase is created and is never
cleared. As of this CL, SigninManagerBase will be created before
SigninErrorController (since the latter now depends on the former).

This CL was unfortunately difficult to subdivide: the changes to
make SigninErrorController depend on SigninManager and the changes to
have SigninErrorController *use* SigninManager need to be made
atomically in order to avoid the two objects depending on each other,
which is an antipattern for KeyedServices. The meaningful changes are
the ones to signin_error_controller.* and signin_manager_base.*.

To test this change, I verified the following:
- Start Chrome
- Sign in to the browser
- Sign out on the web (e.g., in gmail)
- Observe that the "sync paused" error shows up in the avatator button
  on the top right of the chrome
- Restart Chrome
- Observe that the "sync paused" error is still present
- Sign in to the browser again
- Observe that the "sync paused" error goes away

I also verified that the above behavior is dependent on
SigninErrorController being correct by changing
SigninErrorController::Update() to return immediately and verifying
that the avatar button never changes through the above set of steps.

Followup CLs will move signin_error_controller.* out of the
signin_internals GN target and will port SigninErrorController to talk
to IdentityManager.

TBR=droger@chromium.org

Bug:  917836 
Change-Id: I7e4a66bcffa4c1d3a8f296dabbf6a7c38602b5fa
Reviewed-on: https://chromium-review.googlesource.com/c/1390012
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619627}
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/chrome/browser/signin/chrome_signin_client_unittest.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/chrome/browser/signin/dice_response_handler_unittest.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/chrome/browser/signin/fake_signin_manager_builder.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/chrome/browser/signin/signin_error_controller_factory.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/chrome/browser/signin/signin_manager_factory.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/chrome/test/base/chrome_render_view_host_test_harness.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/fake_signin_manager.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/fake_signin_manager.h
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/signin_error_controller.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/signin_error_controller.h
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/signin_error_controller_unittest.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/signin_manager.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/signin_manager.h
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/signin_manager_base.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/signin_manager_base.h
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/components/signin/core/browser/signin_manager_unittest.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/ios/chrome/browser/signin/signin_error_controller_factory.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/ios/chrome/browser/signin/signin_manager_factory.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/ios/web_view/internal/signin/web_view_signin_error_controller_factory.mm
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/ios/web_view/internal/signin/web_view_signin_manager_factory.mm
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/ios/web_view/internal/sync/cwv_sync_controller_unittest.mm
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/services/identity/public/cpp/identity_manager_unittest.cc
[modify] https://crrev.com/f9e6eec61d72b0617c8d5be61f11dd253e148852/services/identity/public/cpp/identity_test_environment.cc

Project Member

Comment 4 by bugdroid1@chromium.org, Jan 4

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

commit 23e285fd7f402631763256ee9c333dbdd3720009
Author: Colin Blundell <blundell@chromium.org>
Date: Fri Jan 04 09:07:15 2019

Move SigninErrorController out of signin_internals target

After https://chromium-review.googlesource.com/c/chromium/src/+/1390012,
SigninErrorController is now layered on top of signin internals code
rather than being part of it. This CL accordingly move it out of the
signin_internals GN target back into the browser target that is layered
on top of it.

I verified that making this change did not remove any dependencies from
the signin_internals target (that would have been a nice side-benefit).

Bug:  917836 
Change-Id: I5dc4947722c6183c91d3cee3225404919bd4b21a
Reviewed-on: https://chromium-review.googlesource.com/c/1391671
Reviewed-by: David Roger <droger@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619901}
[modify] https://crrev.com/23e285fd7f402631763256ee9c333dbdd3720009/components/signin/core/browser/BUILD.gn

Status: Fixed (was: Started)

Sign in to add a comment