Chromium Code Reviews| Index: ash/common/wm_shell.cc |
| diff --git a/ash/common/wm_shell.cc b/ash/common/wm_shell.cc |
| index 0ef8c86b88330f965d3ad0dc1a03741e9ace4c68..bf563544777c121463bc2ff82bee924ced1d460d 100644 |
| --- a/ash/common/wm_shell.cc |
| +++ b/ash/common/wm_shell.cc |
| @@ -46,6 +46,10 @@ |
| #include "base/bind.h" |
| #include "base/logging.h" |
| #include "base/memory/ptr_util.h" |
| +#include "services/catalog/public/interfaces/constants.mojom.h" |
| +#include "services/preferences/public/cpp/pref_observer_store.h" |
| +#include "services/preferences/public/interfaces/preferences.mojom.h" |
| +#include "services/service_manager/public/cpp/connector.h" |
| #include "ui/app_list/presenter/app_list_presenter.h" |
| #include "ui/display/display.h" |
| #include "ui/views/focus/focus_manager_factory.h" |
| @@ -120,6 +124,9 @@ void WmShell::Shutdown() { |
| // Balances the Install() in Initialize(). |
| views::FocusManagerFactory::Install(nullptr); |
| + |
| + // Removes itself as an observer of |pref_store_|. |
| + shelf_controller_.reset(); |
| } |
| ShelfModel* WmShell::shelf_model() { |
| @@ -268,6 +275,11 @@ WmShell::WmShell(std::unique_ptr<ShellDelegate> shell_delegate) |
| keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); |
| vpn_list_ = base::MakeUnique<VpnList>(); |
| #endif |
| + delegate_->GetShellConnector()->ConnectToInterface( |
| + catalog::mojom::kServiceName, &catalog_); |
| + catalog_->GetEntriesProvidingCapability( |
| + prefs::mojom::kCapabilityName, |
|
Ben Goodger (Google)
2016/12/19 20:41:55
I understand how this mechanism may have been usef
jonross
2016/12/20 22:07:17
Done.
|
| + base::Bind(&WmShell::OnGotCatalogEntries, base::Unretained(this))); |
| } |
| WmShell::~WmShell() {} |
| @@ -411,4 +423,16 @@ void WmShell::SetAcceleratorController( |
| accelerator_controller_ = std::move(accelerator_controller); |
| } |
| +void WmShell::OnGotCatalogEntries( |
| + std::vector<catalog::mojom::EntryPtr> entries) { |
| + // If there are zero entries, this is failing to connect to the service. |
| + // TODO(jonross): if there are more than once service this needs to be updated |
| + // to work with mulitple PreferencesManagers |
| + DCHECK_EQ(1u, entries.size()); |
| + prefs::mojom::PreferencesManagerPtr pref_manager_ptr; |
| + delegate_->GetShellConnector()->ConnectToInterface((*entries.begin())->name, |
| + &pref_manager_ptr); |
| + pref_store_ = new preferences::PrefObserverStore(std::move(pref_manager_ptr)); |
| +} |
| + |
| } // namespace ash |