| Index: ash/shell.cc | 
| diff --git a/ash/shell.cc b/ash/shell.cc | 
| index b08021413c6e2188221ca9c02c7951733b8fecbd..a3d6992fae573aa5e72f3bad4b80ce8263e4efd9 100644 | 
| --- a/ash/shell.cc | 
| +++ b/ash/shell.cc | 
| @@ -124,8 +124,10 @@ | 
| #include "chromeos/chromeos_switches.h" | 
| #include "chromeos/dbus/dbus_thread_manager.h" | 
| #include "chromeos/system/devicemode.h" | 
| +#include "components/prefs/pref_registry_simple.h" | 
| +#include "components/prefs/pref_service.h" | 
| #include "components/ui_devtools/devtools_server.h" | 
| -#include "services/preferences/public/cpp/pref_client_store.h" | 
| +#include "services/preferences/public/cpp/pref_service_factory.h" | 
| #include "services/preferences/public/interfaces/preferences.mojom.h" | 
| #include "services/service_manager/public/cpp/connector.h" | 
| #include "services/ui/public/interfaces/constants.mojom.h" | 
| @@ -728,7 +730,7 @@ Shell::~Shell() { | 
| // Must be destroyed before FocusController. | 
| shelf_delegate_.reset(); | 
|  | 
| -  // Removes itself as an observer of |pref_store_|. | 
| +  // Removes itself as an observer of |pref_service_|. | 
| shelf_controller_.reset(); | 
|  | 
| wm_shell_->Shutdown(); | 
| @@ -760,7 +762,7 @@ Shell::~Shell() { | 
| wm_shell_.reset(); | 
| session_controller_->RemoveSessionStateObserver(this); | 
| wallpaper_delegate_.reset(); | 
| -  pref_store_ = nullptr; | 
| +  pref_service_ = nullptr; | 
| shell_delegate_.reset(); | 
|  | 
| DCHECK(instance_ == this); | 
| @@ -775,11 +777,12 @@ void Shell::Init(const ShellInitParams& init_params) { | 
| wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); | 
|  | 
| // Can be null in tests. | 
| -  if (shell_delegate_->GetShellConnector()) { | 
| -    prefs::mojom::PreferencesServiceFactoryPtr pref_factory_ptr; | 
| -    shell_delegate_->GetShellConnector()->BindInterface( | 
| -        prefs::mojom::kServiceName, &pref_factory_ptr); | 
| -    pref_store_ = new preferences::PrefClientStore(std::move(pref_factory_ptr)); | 
| +  if (wm_shell_->IsRunningInMash() && shell_delegate_->GetShellConnector()) { | 
| +    prefs::ConnectToPrefService( | 
| +        shell_delegate_->GetShellConnector(), | 
| +        make_scoped_refptr(new PrefRegistrySimple()), | 
| +        base::Bind(&Shell::OnPrefServiceInitialized, base::Unretained(this)), | 
| +        prefs::mojom::kForwarderServiceName); | 
| } | 
|  | 
| // Some delegates access WmShell during their construction. Create them here | 
| @@ -1226,4 +1229,12 @@ void Shell::SessionStateChanged(session_manager::SessionState state) { | 
| } | 
| } | 
|  | 
| +void Shell::OnPrefServiceInitialized( | 
| +    std::unique_ptr<::PrefService> pref_service) { | 
| +  if (!instance_) | 
| +    return; | 
| +  DCHECK(pref_service); | 
| +  pref_service_ = std::move(pref_service); | 
| +} | 
| + | 
| }  // namespace ash | 
|  |