Index: ash/common/wm_shell.cc |
diff --git a/ash/common/wm_shell.cc b/ash/common/wm_shell.cc |
index 5af6bc9777796f77cf685287f6eb91f23d4bf896..7c87f10802169c99be00e783257ee4a28f51fe3d 100644 |
--- a/ash/common/wm_shell.cc |
+++ b/ash/common/wm_shell.cc |
@@ -45,6 +45,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" |
@@ -267,6 +271,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() {} |
@@ -410,4 +419,15 @@ void WmShell::SetAcceleratorController( |
accelerator_controller_ = std::move(accelerator_controller); |
} |
+void WmShell::OnGotCatalogEntries( |
+ std::vector<catalog::mojom::EntryPtr> entries) { |
+ DCHECK(!entries.empty()); |
sadrul
2016/12/06 18:34:29
Maybe actually DCHECK that size() == 1?
jonross
2016/12/06 21:09:32
From discussions about a full standalone prefs ser
sadrul
2016/12/07 04:11:58
Indeed. That's why I want this to be a DCHECK(), s
jonross
2016/12/07 15:46:39
Oh... I follow now, sorry. Done.
|
+ // TODO(jonross): Update this if we end up with more than one |
+ // PreferencesManager service. |
+ prefs::mojom::PreferencesManagerPtr pref_manager_ptr; |
+ delegate_->GetShellConnector()->ConnectToInterface((*entries.begin())->name, |
+ &pref_manager_ptr); |
+ pref_store_ = new PrefObserverStore(std::move(pref_manager_ptr)); |
+} |
+ |
} // namespace ash |