Index: ash/common/wm_shell.cc |
diff --git a/ash/common/wm_shell.cc b/ash/common/wm_shell.cc |
index 0ef8c86b88330f965d3ad0dc1a03741e9ace4c68..8276b5fd8bb72f2e9b01ef3ffc3e6449f192d932 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::kServiceName, |
+ 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. |
dcheng
2016/12/08 23:13:01
I'm not sure what this comment means: if the conne
jonross
2016/12/08 23:32:54
The Catalog implementation does call this if there
|
+ // 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 |