cros: Refine local state prefs usage in ash

Desktop / Chromium - James Cook [chromium.org] - 8 August 2017 14:32 EDT

On mash the ash process has to connect to the mojo pref service before local state prefs are available, which means there is a window during startup where they are not available. Classic ash allows immediate access to local state prefs, which makes it easy to write code that works in classic but not in mash.

Make classic ash and mash local state behavior more similar:
- Add ShellObserver::OnLocalStatePrefServiceReady()
- Make Shell::GetLocalStatePrefService() return null until that observer method is fired
- Eliminate ShellDelegate::GetLocalStatePrefService() so that code in classic ash can't use the delegate to get the PrefService too early
- Fix PaletteTray to use the new approach

WallpaperController will need to be fixed in a separate CL because wallpaper also has other differences between classic and mash.

Bug: 752671, 751191, 752997 Test: added to ash_unittests Change-Id: Iead4ae3f4c2fc4ed065a0eb9ebae7668dadc6c25 Reviewed-on: https://chromium-review.googlesource.com/604478 Commit-Queue: James Cook

bbe5cb1 cros: Refine local state prefs usage in ash
ash/mus/shell_delegate_mus.cc | 8 --
ash/mus/shell_delegate_mus.h | 1 -
ash/shell.cc | 33 ++++++--
ash/shell.h | 12 ++-
ash/shell/shell_delegate_impl.cc | 4 -
ash/shell/shell_delegate_impl.h | 1 -
ash/shell_delegate.h | 3 +-
ash/shell_observer.h | 4 +
ash/shell_test_api.cc | 6 ++
ash/shell_test_api.h | 6 ++
ash/shell_unittest.cc | 63 ++++++++++++++-
ash/system/palette/palette_tray.cc | 48 +++++------
ash/system/palette/palette_tray.h | 1 +
ash/system/palette/palette_tray_unittest.cc | 105 ++++++++++---------------
ash/test_shell_delegate.cc | 4 -
ash/test_shell_delegate.h | 6 --
chrome/browser/ui/ash/ash_init.cc | 4 +
chrome/browser/ui/ash/chrome_shell_delegate.cc | 4 -
chrome/browser/ui/ash/chrome_shell_delegate.h | 1 -
19 files changed, 184 insertions(+), 130 deletions(-)

Upstream: git.chromium.org


  • Share